Skip to content

Development#1

Open
Sam-H06 wants to merge 31 commits into
masterfrom
Development
Open

Development#1
Sam-H06 wants to merge 31 commits into
masterfrom
Development

Conversation

@Sam-H06

@Sam-H06 Sam-H06 commented Mar 12, 2025

Copy link
Copy Markdown
Owner

No description provided.

@Haydenwood2005

Copy link
Copy Markdown
Collaborator

I like the use of encapsulation, the use of getters and setters, and the overall idea of the code to layout the game design.
The layout of the code is clear and concise, the abstraction consistently throughout allows for an easy understanding of how to code works.
The comments throughout help to explain the code, however there is large gaps where no comments are present, so more comments could improve the structure within the ideas of the coding.

Comment thread Room/Room.cs
Comment on lines +20 to +52
case RoomT.passive:
description += " | PASSIVE ZONE |";
break;
case RoomType.normal:
description += " | NORMAL ROOM |";
break;
case RoomType.encounter:
description += " | ENCOUNTER ROOM |";
break;

case RoomType.Store:
description += " | STORE ROOM |";
break;

case RoomType.Event:
description += " | EVENT ROOM |";
break;
default:
break;

}

this.description = description;

this.roomT = roomT;
}


public string GetDescription() {

return description;
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add more comments! Make it clearer what the code is doing.

@Legopeeps Legopeeps left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, good pieces of code here, should get the job done. Looking at the requirements, it's clear that abstraction and encapsulation have been applied throughout to make quite a robust application. Error checking is evident, the code makes use of Object Oriented featrures as well as methods and classes. Add more comments throughout though I kept getting lost in the spaghetti code, and I saw you started using .XML Commenting Standards about midway down - keep that up they are very useful !!

Comment thread Character/Player.cs Outdated
using System.Text;
using System.Threading.Tasks;

namespace DungeonExplorer.Player {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting use of folders within the project, with a prototype of this size I wouldn't have expected it but it does future-proof the project

Comment thread Character/Player.cs Outdated
Comment on lines +10 to +15
public const int MAX_HEALTH = 100;
public const int MAX_DAMAGE = 40;
public string Name { get; set; }
public int Health { get; set; }
public int Damage { get; set; }
private List<Item.Item> inventory = new List<Item.Item>();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using encapsulation for these variables and object, the ideas have been abstracted down well

Comment thread Character/Player.cs Outdated
Comment on lines +17 to +22
public Player(string name, int health, int damage)
{
Name = name;
Health = health;
Damage = damage;
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

initialising the values, nicely done

Comment thread Character/Player.cs Outdated
Comment on lines +29 to +42
public void UseItem(Item.Item item)
{
// item usage logic here
if (InventoryContents().Contains(item))
{
Console.WriteLine($"{Name} uses {item.Name}");
// Apply item effects
item.Use(this);
}
else
{
Console.WriteLine($"{Name} does not have {item.Name}");
}
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.XML commenting standards could have been implemented here (and throughout) to make the document more readable

Comment thread Game/Game.cs
{
// Initialize the game with one room and one player
Player = new Player.Player("Player", 100);
Player.PickUpItem(new DamageBooster());

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comments could help aid ambiguity of what a DamageBooster is

Comment thread Game/Game.cs
Comment on lines +83 to +118
private bool HandlePlayerAction(string action)
{
// Method to handle player actions
if (int.TryParse(action, out int itemId))
{
var item = Player.InventoryContents().FirstOrDefault(i => i.Id == itemId);
if (item != null && item.Useable)
{
Player.UseItem(item);
}
else
{
Console.WriteLine("Invalid action. Please try again.");
}
}
else if (action.Equals("move up", StringComparison.OrdinalIgnoreCase) ||
action.Equals("move down", StringComparison.OrdinalIgnoreCase) ||
action.Equals("move left", StringComparison.OrdinalIgnoreCase) ||
action.Equals("move right", StringComparison.OrdinalIgnoreCase))
{
string direction = action.Split(' ')[1];
if (!RoomManager.MovePlayer(direction, Player))
{
Console.WriteLine("You can't move in that direction.");
}
}
else if (action.Equals("exit", StringComparison.OrdinalIgnoreCase))
{
return false;
}
else
{
Console.WriteLine("Invalid action. Please try again.");
}
return true;
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this needs more comments all around even in the same style as the rest of the class, however shows good signs, from what I can tell, of error checking. Looks robust to say the least.

Comment thread Item/DamageBooster.cs Outdated

/// Represents a Damage Booster item.

public class DamageBooster : Item {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inheriting from the item class, highlighting further encapsulation through inheritance

Comment thread Item/DamageBooster.cs Outdated
Comment on lines +20 to +22
/// Uses the Damage booster on the player.

/// <param name="player">The player to use the Talisman on.</param>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

started using .xml commenting here, could have been throughout the whole doc

Comment thread Item/Item.cs Outdated
Comment on lines +10 to +16
protected Item(string name, string description, bool useable)
{
Name = name;
Description = description;
Useable = useable;
Id = nextId++;
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very robust way of creating items through object instantiation

Comment thread Room/RoomT.cs
Comment on lines +9 to +16
public enum RoomType
{
Safe,
Normal,
Boss,
Shop,
Event
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very nice touch using enums

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants