fix: changed gold/exp mecanic

This commit is contained in:
2021-11-05 18:12:57 +01:00
parent afcfce1328
commit 18a090df06
6 changed files with 44 additions and 16 deletions

View File

@@ -13,13 +13,17 @@ private:
game::TeamColor m_TeamColor;
std::uint32_t m_Gold;
std::uint32_t m_EXP;
std::uint32_t m_Exp;
std::string m_Name;
std::uint8_t m_ID;
std::uint8_t m_GoldPerSecond;
bool m_GoldChanged;
bool m_ExpChanged;
public:
Player(std::uint8_t id = 0) : m_TeamColor(game::TeamColor::None), m_Gold(0), m_EXP(0), m_ID(id), m_GoldPerSecond(5) {}
Player(std::uint8_t id = 0) : m_TeamColor(game::TeamColor::None), m_Gold(0), m_Exp(0), m_ID(id), m_GoldPerSecond(5),
m_GoldChanged(false), m_ExpChanged(false) {}
const std::string& getName() const { return m_Name; }
void setName(const std::string& name) { m_Name = name; }
@@ -30,15 +34,21 @@ public:
std::uint8_t getGoldPerSecond() const { return m_GoldPerSecond; }
void setGoldPerSecond(std::uint8_t goldPerSecond) { m_GoldPerSecond = goldPerSecond; }
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 getGold() const { return m_Gold;}
void setGold(std::uint32_t gold) { m_GoldChanged = true; m_Gold = gold; }
void addGold(std::uint32_t gold) { m_GoldChanged = true; m_Gold += gold; }
void removeGold(std::uint32_t gold) { m_GoldChanged = true; 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; }
std::uint32_t getExp() const { return m_Exp; }
void setExp(std::uint32_t exp) { m_ExpChanged = true; m_Exp = exp; }
void addExp(std::uint32_t exp) { m_ExpChanged = true; m_Exp += exp; }
void removeExp(std::uint32_t exp) { m_ExpChanged = true; m_Exp -= exp; }
bool hasGoldChanged() const { return m_GoldChanged; }
bool hasExpChanged() const { return m_ExpChanged; }
void updateGold() { m_GoldChanged = false; }
void updateExp() { m_ExpChanged = false; }
std::uint8_t getID() const { return m_ID; }
};