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
end end
function Hero:revive()
if (self.isKo) then
self:changeAnimation("idle")
self.isKo = false
end
end
function Hero:setAsKo() function Hero:setAsKo()
self:changeAnimation("ko") self:changeAnimation("ko")
self.isKo = true self.isKo = true

View file

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