From 109ed7c9b271f939e7bd765fbcc3bc9890dd6c39 Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Sat, 3 Jul 2021 13:18:16 +0200 Subject: [PATCH] fix: limit hp/pp to their max value --- sonic-radiance.love/game/abstractmobs/parent.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sonic-radiance.love/game/abstractmobs/parent.lua b/sonic-radiance.love/game/abstractmobs/parent.lua index c948512..8a0e61c 100644 --- a/sonic-radiance.love/game/abstractmobs/parent.lua +++ b/sonic-radiance.love/game/abstractmobs/parent.lua @@ -51,6 +51,7 @@ function AbstractMobParent:setHP(newHP, relative) if (self.hp == 0) then self:die() end + self.hp = math.min(self.hp, self.stats:get(self.stats.HPMAX)) end function AbstractMobParent:setPP(newPP, relative) @@ -60,6 +61,7 @@ function AbstractMobParent:setPP(newPP, relative) self.pp = newPP end self.pp = math.floor(math.max(0, self.pp)) + self.pp = math.min(self.pp, self.stats:get(self.stats.PPMAX)) end function AbstractMobParent:getStats()