feat: add revival support

This commit is contained in:
Kazhnuz 2021-03-12 21:50:27 +01:00
parent c6b04006da
commit b7a0ec7c7b
2 changed files with 18 additions and 2 deletions

View file

@ -31,6 +31,13 @@ function Hero:die()
end
end
function Hero:revive()
if (self.isKo) then
self:changeAnimation("idle")
self.isKo = false
end
end
function Hero:setAsKo()
self:changeAnimation("ko")
self.isKo = true

View file

@ -40,11 +40,20 @@ function FighterParent:setPP(value, relative)
end
function FighterParent:applyDeath()
if ((not self.abstract:isAlive()) and self.isAlive) then
self:die()
if (self.abstract:isAlive() ~= self.isAlive ) then
if (self.abstract:isAlive()) then
self:revive()
else
self:die()
end
end
end
function FighterParent:revive()
self.isAlive = true
self.actor:revive()
end
function FighterParent:die()
self.isAlive = false
self.actor:die()