fix: limit hp/pp to their max value
This commit is contained in:
parent
4c46e510d0
commit
109ed7c9b2
1 changed files with 2 additions and 0 deletions
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue