CardGame
Rogue-like card videogame
Loading...
Searching...
No Matches
deckPlayer.h
Go to the documentation of this file.
1#ifndef DECKPLAYER_H
2#define DECKPLAYER_H
3
4#include "deckEntry.h"
5
6#include <iostream>
7#include <memory>
8#include <string>
9#include <string_view>
10#include <utility>
11#include <vector>
12
23{
24 public:
33 DeckPlayer(std::vector<DeckEntry> startingCardList, int maxCardNumbers = 20);
34
36 friend std::ostream& operator<<(std::ostream& out, const DeckPlayer& deck);
37
39 int getCurrentCardNumber() const;
46 bool isCardPresent(std::string_view cardId) const;
47
56 bool addCard(std::string_view cardId);
65 bool removeCard(std::string_view cardId);
66
68 const std::vector<DeckEntry>& getCardList() const { return m_cardsList; }
69
70 private:
71 int m_maxCardNumber{};
72 int m_minCardNumber{5};
73 std::vector<DeckEntry> m_cardsList{};
74};
75
76#endif // DECKPLAYER_H
Represents the player's persistent deck outside of combat.
Definition: deckPlayer.h:23
friend std::ostream & operator<<(std::ostream &out, const DeckPlayer &deck)
Outputs the deck contents to an output stream.
Definition: deckPlayer.cpp:11
bool isCardPresent(std::string_view cardId) const
Checks if a card ID is present in the deck.
Definition: deckPlayer.cpp:34
const std::vector< DeckEntry > & getCardList() const
Returns the full list of card entries.
Definition: deckPlayer.h:68
int getCurrentCardNumber() const
Returns the total number of cards (sum of all counts).
Definition: deckPlayer.cpp:23
DeckPlayer()
Constructs an empty deck.
Definition: deckPlayer.h:26
bool removeCard(std::string_view cardId)
Removes one copy of a card, if above minimum size.
Definition: deckPlayer.cpp:64
bool addCard(std::string_view cardId)
Adds a card to the deck, if below max size.
Definition: deckPlayer.cpp:42