From b7a0ec7c7b064db91cc1180a7a4cd882d839f1f7 Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Fri, 12 Mar 2021 21:50:27 +0100 Subject: [PATCH] feat: add revival support --- .../scenes/battlesystem/actors/hero.lua | 7 +++++++ .../battlesystem/controllers/fighters/parent.lua | 13 +++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/sonic-radiance.love/scenes/battlesystem/actors/hero.lua b/sonic-radiance.love/scenes/battlesystem/actors/hero.lua index 40c00d8..b0c90e0 100644 --- a/sonic-radiance.love/scenes/battlesystem/actors/hero.lua +++ b/sonic-radiance.love/scenes/battlesystem/actors/hero.lua @@ -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 diff --git a/sonic-radiance.love/scenes/battlesystem/controllers/fighters/parent.lua b/sonic-radiance.love/scenes/battlesystem/controllers/fighters/parent.lua index ff23350..20c1bf4 100644 --- a/sonic-radiance.love/scenes/battlesystem/controllers/fighters/parent.lua +++ b/sonic-radiance.love/scenes/battlesystem/controllers/fighters/parent.lua @@ -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()