Class that represents a Player.
More...
#include <player.h>
Class that represents a Player.
◆ Player()
| Player::Player |
( |
int |
hitPoints, |
|
|
int |
maxHitPoints, |
|
|
size_t |
handSize, |
|
|
const std::vector< PlayingCard > & |
deck |
|
) |
| |
Construct a new Player object.
- Parameters
-
| hitPoints | the current hit points of the player |
| maxHitPoints | the maximum hit points of the player |
| hand | the hand (list of cards) of the player |
◆ addCard()
Adds the given card to the player's hand.
- Parameters
-
| card | the card to add to the player's hand. |
◆ damage()
| void Player::damage |
( |
int |
amount | ) |
|
Applies damage equal to amount to the player.
- Parameters
-
| amount | the amount to damage the player. |
◆ getCard()
Returns the PlayingCard object that corresponds to the index given.
- Parameters
-
| index | the index of the card to get |
- Returns
- PlayingCard the object that corresponds to the given index.
◆ getDeck()
Get the Deck of the player.
- Returns
- std::vector<PlayingCard>
◆ getHand()
Returns the player's hand.
- Returns
- std::vector<PlayingCard> the player's hand
◆ getHandSize()
| size_t Player::getHandSize |
( |
| ) |
|
Returns the hand size of the player.
- Returns
- int the hand size
◆ getHitPoints()
| int Player::getHitPoints |
( |
| ) |
|
Returns the current hit points of the player.
- Returns
- int the current hit points of the player
◆ getMaxHitPoints()
| int Player::getMaxHitPoints |
( |
| ) |
|
Returns the max hit points of the player.
- Returns
- int the max hit points of the player.
◆ heal()
| void Player::heal |
( |
int |
amount | ) |
|
Heals the player a given amount.
- Parameters
-
| amount | the amount to heal the player. |
◆ removeCard()
Removes the given card from the player's hand.
- Parameters
-
| card | the card to remove from the player's hand. |
◆ setDeck()
| void Player::setDeck |
( |
const std::vector< PlayingCard > & |
deck | ) |
|
Set the Deck of the player.
- Parameters
-
| deck | The deck of cards for the player |
◆ setHand()
| void Player::setHand |
( |
const std::vector< PlayingCard > & |
hand | ) |
|
Set the player's hand.
Set the player's hand to the given vector of playing cards. Note, this function should not be used to add or remove a card for the player's hand. To add a card to the player's hand, use addCard(). To remove a card from the player's hand, use removeCard().
- Parameters
-
| hand | the vector of playing cards to set as the player's hand |
◆ setHandSize()
| void Player::setHandSize |
( |
size_t |
handSize | ) |
|
Sets the hand size of the player.
- Parameters
-
| handSize | the hand size to set too |
◆ setHitPoints()
| void Player::setHitPoints |
( |
int |
value | ) |
|
Sets the current hit points of the player.
Sets the current hit points of the player to the value given, as long as the value is less than the maximum hit points and more than -1. Note that this function should not be used to damage or heal the player. To damage the player, use the damage() function. To heal the player, use the heal() function.
- Parameters
-
| value | the value for the hit points to be set to. |
◆ setMaxHitPoints()
| void Player::setMaxHitPoints |
( |
int |
value | ) |
|
Sets the maximum hit points of the player.
- Parameters
-
| value | the value to set the player's maximum hit points. |
◆ toString()
| std::string Player::toString |
( |
| ) |
|
Converts the player object to a string.
- Returns
- std::string the string version of the player.
The documentation for this class was generated from the following files:
- /home/runner/work/StudyDungeon/StudyDungeon/src/player.h
- /home/runner/work/StudyDungeon/StudyDungeon/src/player.cpp