RpgGame
Console Based RPG game in C#
Loading...
Searching...
No Matches
RpgGame.Character.Player Class Reference

Represents the player-controlled character in the game. More...

Inheritance diagram for RpgGame.Character.Player:
Collaboration diagram for RpgGame.Character.Player:

Public Member Functions

void RestoreHealth (int amount)
 Restores the player's health by the specified amount, capped at 100.
 
void TakeDamage (int amount)
 Reduces the player's health by the specified amount.
 
void AddCoins (int amount)
 Adds the specified amount of coins to the player.
 
void AddGold (int amount)
 
bool EquipLeft (IEquippable item)
 Attempts to equip an item into the left hand.
 
bool EquipRight (IEquippable item)
 Attempts to equip an item into the right hand.
 
void DropLeft (Level level)
 Drops the currently equipped left-hand item onto the level.
 
void DropRight (Level level)
 Drops the currently equipped right-hand item onto the level.
 
 Player (Position startPosition)
 Initializes a new instance of the Player class.
 
- Public Member Functions inherited from RpgGame.Character.Character
void Move (Position newPos)
 Moves the character to a new position.
 

Properties

override char Symbol [get]
 Character used to represent the player on the map.
 
int Strength [get]
 Gets the player's Strength attribute.
 
int Dexterity [get]
 Gets the player's Dexterity attribute.
 
int Health [get]
 Gets the player's current Health value.
 
int Luck [get]
 Gets the player's Luck attribute.
 
int Aggression [get]
 Gets the player's Aggression attribute.
 
int Wisdom [get]
 Gets the player's Wisdom attribute.
 
IEquippableLeftHand [get]
 Gets the item currently equipped in the left hand.
 
IEquippableRightHand [get]
 Gets the item currently equipped in the right hand.
 
int Coins [get]
 Gets the total number of coins collected.
 
int Gold [get]
 
- Properties inherited from RpgGame.Character.Character
char Symbol [get]
 Gets the character symbol used to render this character on the map.
 
Position Pos [get]
 Gets or sets the current position of the character in the level.
 

Additional Inherited Members

- Protected Member Functions inherited from RpgGame.Character.Character
 Character (Position startPosition)
 Initializes a new instance of the Character class.
 

Detailed Description

Represents the player-controlled character in the game.

The Player class manages character attributes, inventory, equipment handling, and currency. Equipment rules are enforced through polymorphic behavior defined in IEquippable.

Constructor & Destructor Documentation

◆ Player()

RpgGame.Character.Player.Player ( Position  startPosition)
inline

Initializes a new instance of the Player class.

Parameters
startPositionThe initial spawn position of the player.

Member Function Documentation

◆ AddCoins()

void RpgGame.Character.Player.AddCoins ( int  amount)

Adds the specified amount of coins to the player.

Parameters
amountThe number of coins to add.
Here is the caller graph for this function:

◆ DropLeft()

void RpgGame.Character.Player.DropLeft ( Level  level)
inline

Drops the currently equipped left-hand item onto the level.

Parameters
levelThe current level.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ DropRight()

void RpgGame.Character.Player.DropRight ( Level  level)
inline

Drops the currently equipped right-hand item onto the level.

Parameters
levelThe current level.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ EquipLeft()

bool RpgGame.Character.Player.EquipLeft ( IEquippable  item)
inline

Attempts to equip an item into the left hand.

Parameters
itemThe equippable item.
Returns
True if the item was successfully equipped; otherwise false.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ EquipRight()

bool RpgGame.Character.Player.EquipRight ( IEquippable  item)
inline

Attempts to equip an item into the right hand.

Parameters
itemThe equippable item.
Returns
True if the item was successfully equipped; otherwise false.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ RestoreHealth()

void RpgGame.Character.Player.RestoreHealth ( int  amount)
inline

Restores the player's health by the specified amount, capped at 100.

Parameters
amountThe amount of health to restore.
Here is the caller graph for this function:

◆ TakeDamage()

void RpgGame.Character.Player.TakeDamage ( int  amount)
inline

Reduces the player's health by the specified amount.

Parameters
amountThe amount of damage to take.
Here is the caller graph for this function:

The documentation for this class was generated from the following file: