9#include "../player/player.h"
11#include "../../serialization/unique_serializable.h"
12#include "../../serialization/serializable_value.h"
13#include "../../../../rapidjson/include/rapidjson/document.h"
31 std::vector<card*> _all_cards;
32 std::vector<card*> _remaining_cards;
40 deck(
const std::string&
id,
const std::vector<card*> &all_cards,
const std::vector<card*> &remaining_cards);
46 explicit deck(
const std::string&
id);
64 explicit deck(
const std::vector<card*>& cards);
81 [[nodiscard]]
bool is_empty()
const noexcept;
130 void write_into_json(rapidjson::Value& json, rapidjson::Document::AllocatorType& allocator)
const override;
Represents a card in the game.
Definition card.h:15
Represents the card deck in the game.
Definition deck.h:28
deck()
Constructs a new deck object.
Definition deck.cpp:26
~deck() override
Destructs a deck object.
Definition deck.cpp:56
bool is_empty() const noexcept
Checks if _remaining_cards is empty, i.e., if all cards are dealt.
Definition deck.cpp:67
void setup_round()
Sets up the deck for a new round.
Definition deck.cpp:80
void write_into_json(rapidjson::Value &json, rapidjson::Document::AllocatorType &allocator) const override
Serializes a deck object into a json object.
Definition deck.cpp:143
static deck * from_json(const rapidjson::Value &json)
Deserializes a deck object from a json object.
Definition deck.cpp:152
card * draw_trump() const
Draws a random trump card from the remaining cards.
Definition deck.cpp:122
unsigned int get_number_of_remaining_cards() const noexcept
Gets the number of remaining cards, i.e., the number of cards not dealt yet.
Definition deck.cpp:72
bool draw_cards(const player *player, int round_number, std::string &err)
Draws a number of random cards based on the current round number and places them into a player's hand...
Definition deck.cpp:85
Represents a player in the game.
Definition player.h:18
Definition unique_serializable.h:12