fix: removed negative life for mobs

This commit is contained in:
2021-11-09 19:35:11 +01:00
parent d56b92f898
commit 692d68c7fd

View File

@@ -109,7 +109,7 @@ public:
bool isAlive() const { return m_Health > 0; } bool isAlive() const { return m_Health > 0; }
const Tower* getLastDamageTower() { return m_LastDamage; } const Tower* getLastDamageTower() { return m_LastDamage; }
void damage(float dmg, const Tower* damager) { m_Health -= dmg; m_LastDamage = damager; } void damage(float dmg, const Tower* damager) { m_Health = std::max(0.0f, m_Health - dmg); m_LastDamage = damager; }
void heal(float heal) { m_Health = std::min((float)getStats()->getMaxLife(), m_Health + heal); } void heal(float heal) { m_Health = std::min((float)getStats()->getMaxLife(), m_Health + heal); }
float getX() const { return m_X; } float getX() const { return m_X; }