#pragma once #include #include "td/game/Team.h" #include "td/game/PlayerUpgrades.h" namespace td { namespace game { class Player { private: TeamColor m_TeamColor; PlayerUpgrades m_Upgrades; std::uint32_t m_Gold; std::uint32_t m_Exp; std::string m_Name; PlayerID m_ID; public: Player(std::uint8_t id = 0) : m_TeamColor(TeamColor::None), m_Gold(0), m_Exp(0), m_ID(id) {} const std::string& GetName() const { return m_Name; } void SetName(const std::string& name) { m_Name = name; } TeamColor GetTeamColor() const { return m_TeamColor; } void SetTeamColor(TeamColor teamColor) { m_TeamColor = teamColor; } std::uint32_t GetGold() const { return m_Gold; } void SetGold(std::uint32_t gold) { m_Gold = gold; } void AddGold(std::uint32_t gold) { m_Gold += gold; } void RemoveGold(std::uint32_t gold) { m_Gold -= gold; } std::uint32_t GetExp() const { return m_Exp; } void SetExp(std::uint32_t exp) { m_Exp = exp; } void AddExp(std::uint32_t exp) { m_Exp += exp; } void RemoveExp(std::uint32_t exp) { m_Exp -= exp; } const PlayerUpgrades& getUpgrades() const { return m_Upgrades; } PlayerUpgrades& getUpgrades() { return m_Upgrades; } bool HasEnoughGold(std::uint32_t gold) const { return m_Gold >= gold; } bool HasEnoughExp(std::uint32_t exp) const { return m_Exp >= exp; } PlayerID GetID() const { return m_ID; } }; } // namespace game } // namespace td