Player.hpp
Go to the documentation of this file.
1 // Copyright (c) 2019 Chris Ohk, Youngjoong Kim, SeungHyun Jeon
2 
3 // We are making my contributions/submissions to this project solely in our
4 // personal capacity and are not conveying any rights to any intellectual
5 // property of any third parties.
6 
7 #ifndef ROSETTASTONE_PLAYER_HPP
8 #define ROSETTASTONE_PLAYER_HPP
9 
13 #include <Rosetta/Models/Deck.hpp>
16 #include <Rosetta/Models/Hand.hpp>
17 #include <Rosetta/Models/Hero.hpp>
18 
19 #include <string>
20 
21 namespace RosettaStone
22 {
23 class Game;
24 class IPolicy;
25 
33 class Player
34 {
35  public:
36  static constexpr std::size_t USER_INVALID = 255;
37 
39  Player();
40 
42  ~Player();
43 
45  Player(const Player& p) = delete;
46 
48  Player(Player&& p) = delete;
49 
51  Player& operator=(const Player& p) = delete;
52 
54  Player& operator=(Player&& p) = delete;
55 
58  std::string GetNickname() const;
59 
62  void SetNickname(std::string nickname);
63 
66  PlayerType GetPlayerType() const;
67 
70  void SetPlayerType(PlayerType type);
71 
74  std::size_t GetID() const;
75 
78  void SetID(std::size_t id);
79 
82  Game* GetGame() const;
83 
86  void SetGame(Game* game);
87 
91 
94  Deck& GetDeck();
95 
99 
102  Hand& GetHand();
103 
106  Hero* GetHero() const;
107 
110  IPolicy& GetPolicy() const;
111 
114  void SetPolicy(IPolicy* policy);
115 
118  Player& GetOpponent() const;
119 
122  void SetOpponent(Player* player);
123 
127  void AddHeroAndPower(Card&& heroCard, Card&& powerCard);
128 
131  std::optional<Choice> choice = std::nullopt;
132 
133  std::size_t currentMana = 0;
134  std::size_t maximumMana = 0;
135 
136  private:
137  std::string m_nickname;
138  PlayerType m_playerType = PlayerType::PLAYER1;
139  std::size_t m_id = 0;
140 
141  Battlefield m_field;
142  Deck m_deck;
143  Graveyard m_graveyard;
144  Hand m_hand;
145 
146  Hero* m_hero = nullptr;
147 
148  Game* m_game = nullptr;
149  IPolicy* m_policy = nullptr;
150  Player* m_opponent = nullptr;
151 };
152 } // namespace RosettaStone
153 
154 #endif // ROSETTASTONE_PLAYER_HPP
void SetNickname(std::string nickname)
void SetPolicy(IPolicy *policy)
Hero * GetHero() const
std::size_t maximumMana
Definition: Player.hpp:134
Graveyard class.
Definition: Graveyard.hpp:22
IPolicy class.
Definition: Policy.hpp:22
void AddHeroAndPower(Card &&heroCard, Card &&powerCard)
Game class.
Definition: Game.hpp:21
std::size_t GetID() const
IPolicy & GetPolicy() const
Mulligan mulliganState
Definition: Player.hpp:130
Card class.
Definition: Card.hpp:27
void SetID(std::size_t id)
Hand class.
Definition: Hand.hpp:24
PlayState playState
Definition: Player.hpp:129
Deck class.
Definition: Deck.hpp:25
void SetOpponent(Player *player)
~Player()
Destructor.
Player & operator=(const Player &p)=delete
Copy assignment operator.
std::size_t currentMana
Definition: Player.hpp:133
Battlefield & GetField()
std::optional< Choice > choice
Definition: Player.hpp:131
PlayerType GetPlayerType() const
Hero class.
Definition: Hero.hpp:22
Battlefield class.
Definition: Battlefield.hpp:29
void SetPlayerType(PlayerType type)
Graveyard & GetGraveyard()
static constexpr std::size_t USER_INVALID
Definition: Player.hpp:36
Player class.
Definition: Player.hpp:33
Game * GetGame() const
Definition: AccountInfo.hpp:14
Player & GetOpponent() const
PlayerType
Enumeration that represents the player.
Definition: Constants.hpp:57
std::string GetNickname() const
void SetGame(Game *game)
Player()
Default constructor.