fix: game crash

This commit is contained in:
2021-11-06 16:20:12 +01:00
parent 672e4c2f03
commit eb8a43cd1a
4 changed files with 8 additions and 17 deletions

View File

@@ -80,7 +80,7 @@ private:
MobLevel m_Level;
Direction m_Direction;
std::vector<EffectDuration> m_Effects;
const Tower* m_KillTower; // the tower that killed the mob
const Tower* m_LastDamage; // the tower that damaged the mob
utils::Timer m_EffectFireTimer;
utils::Timer m_EffectPoisonTimer;
@@ -107,10 +107,9 @@ public:
float getHealth() const { return m_Health; }
bool isDead() const { return m_Health <= 0; }
bool isAlive() const { return m_Health > 0; }
const Tower* getKillTower() { return m_KillTower; }
void setKillTower(const Tower* killTower) { m_KillTower = killTower; }
const Tower* getLastDamageTower() { return m_LastDamage; }
void damage(float dmg) { m_Health -= dmg; }
void damage(float dmg, const Tower* damager) { m_Health -= dmg; m_LastDamage = damager; }
void heal(float heal) { m_Health = std::min((float)getStats()->getMaxLife(), m_Health + heal); }
float getX() const { return m_X; }