|
CardGame
Rogue-like card videogame
|
Represents the player's persistent deck outside of combat. More...
#include <deckPlayer.h>
Public Member Functions | |
| DeckPlayer () | |
| Constructs an empty deck. | |
| DeckPlayer (std::vector< DeckEntry > startingCardList, int maxCardNumbers=20) | |
| Constructs a deck from an initial list of entries. | |
| int | getCurrentCardNumber () const |
| Returns the total number of cards (sum of all counts). | |
| bool | isCardPresent (std::string_view cardId) const |
| Checks if a card ID is present in the deck. | |
| bool | addCard (std::string_view cardId) |
| Adds a card to the deck, if below max size. | |
| bool | removeCard (std::string_view cardId) |
| Removes one copy of a card, if above minimum size. | |
| const std::vector< DeckEntry > & | getCardList () const |
| Returns the full list of card entries. | |
Friends | |
| std::ostream & | operator<< (std::ostream &out, const DeckPlayer &deck) |
| Outputs the deck contents to an output stream. | |
Represents the player's persistent deck outside of combat.
DeckPlayer stores card ownership data between matches. It does not contain CardInstances — only card IDs and counts.
Modifiable by rewards, progression, or deck editing. Serialized separately from combat systems.
|
inline |
Constructs an empty deck.
| DeckPlayer::DeckPlayer | ( | std::vector< DeckEntry > | startingCardList, |
| int | maxCardNumbers = 20 |
||
| ) |
Constructs a deck from an initial list of entries.
| startingCardList | Initial list of card IDs and quantities. |
| maxCardNumbers | Maximum total card count allowed. |
| bool DeckPlayer::addCard | ( | std::string_view | cardId | ) |
Adds a card to the deck, if below max size.
If the card already exists, increments its count.
| cardId | ID of the card to add. |
|
inline |
Returns the full list of card entries.
| int DeckPlayer::getCurrentCardNumber | ( | ) | const |
Returns the total number of cards (sum of all counts).
| bool DeckPlayer::isCardPresent | ( | std::string_view | cardId | ) | const |
Checks if a card ID is present in the deck.
| cardId | ID to search for. |
| bool DeckPlayer::removeCard | ( | std::string_view | cardId | ) |
Removes one copy of a card, if above minimum size.
If the last copy is removed, the entry is erased entirely.
| cardId | ID of the card to remove. |
|
friend |
Outputs the deck contents to an output stream.