From 692d68c7fd6bb649df1c9bcf44793f7c727b7194 Mon Sep 17 00:00:00 2001 From: Persson-dev Date: Tue, 9 Nov 2021 19:35:11 +0100 Subject: [PATCH] fix: removed negative life for mobs --- include/game/Mobs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/game/Mobs.h b/include/game/Mobs.h index 722fa2d..27f33ad 100644 --- a/include/game/Mobs.h +++ b/include/game/Mobs.h @@ -109,7 +109,7 @@ public: bool isAlive() const { return m_Health > 0; } 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); } float getX() const { return m_X; }