feat: add revival support
This commit is contained in:
parent
c6b04006da
commit
b7a0ec7c7b
2 changed files with 18 additions and 2 deletions
|
@ -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
|
||||||
|
|
|
@ -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()
|
||||||
|
|
Loading…
Reference in a new issue