Entity.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_ENTITY_HPP
8 #define ROSETTASTONE_ENTITY_HPP
9 
10 #include <Rosetta/Cards/Card.hpp>
11 
12 #include <map>
13 
14 namespace RosettaStone
15 {
16 class Card;
17 class Game;
18 class GameTag;
19 class Player;
20 
28 class Entity
29 {
30  public:
32  Entity() = default;
33 
37  Entity(Player& _owner, Card& _card);
38 
40  virtual ~Entity();
41 
43  Entity(const Entity& ent);
44 
46  Entity(Entity&& ent) noexcept;
47 
49  Entity& operator=(const Entity& ent);
50 
52  Entity& operator=(Entity&& ent) noexcept;
53 
56  Player& GetOwner() const;
57 
60  void SetOwner(Player& owner);
61 
65  int GetGameTag(GameTag tag) const;
66 
70  virtual void SetGameTag(GameTag tag, int value);
71 
73  virtual void Destroy();
74 
79  static Entity* GetFromCard(Player& player, Card&& card);
80 
82 
83  std::size_t id = 0;
84 
85  bool isDestroyed = false;
86 
87  protected:
88  Player* m_owner = nullptr;
89 
90  std::map<GameTag, int> m_gameTags;
91 
92  private:
94  void FreeMemory();
95 };
96 } // namespace RosettaStone
97 
98 #endif // ROSETTASTONE_ENTITY_HPP
virtual void Destroy()
Destroys character.
Player * m_owner
Definition: Entity.hpp:88
bool isDestroyed
Definition: Entity.hpp:85
Player & GetOwner() const
Entity()=default
Default constructor.
Card class.
Definition: Card.hpp:27
std::map< GameTag, int > m_gameTags
Definition: Entity.hpp:90
Entity & operator=(const Entity &ent)
Copy assignment operator.
Abstract entity structure that stores card data.
Definition: Entity.hpp:28
Card card
Definition: Entity.hpp:81
virtual void SetGameTag(GameTag tag, int value)
virtual ~Entity()
Destructor.
Player class.
Definition: Player.hpp:33
Definition: AccountInfo.hpp:14
int GetGameTag(GameTag tag) const
void SetOwner(Player &owner)
static Entity * GetFromCard(Player &player, Card &&card)