From 4bf4fdb5411e597f24fe85255df823118a237089 Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Fri, 12 Mar 2021 20:05:54 +0100 Subject: [PATCH] improvement: better handling of statusbar callback --- .../battlesystem/controllers/fighters/character.lua | 10 ++++------ .../battlesystem/controllers/fighters/parent.lua | 10 ++++++++++ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/sonic-radiance.love/scenes/battlesystem/controllers/fighters/character.lua b/sonic-radiance.love/scenes/battlesystem/controllers/fighters/character.lua index c7776ed..11b33b2 100644 --- a/sonic-radiance.love/scenes/battlesystem/controllers/fighters/character.lua +++ b/sonic-radiance.love/scenes/battlesystem/controllers/fighters/character.lua @@ -110,14 +110,12 @@ function HeroFighter:goBackToMenu() end -- LIFE functions -function HeroFighter:setHP(value, relative) - HeroFighter.super.setHP(self, value, relative) - self.statusbar:updateHP() +function HeroFighter:updatePP() + self.statusbar:updatePP() end -function HeroFighter:setPP(value, relative) - HeroFighter.super.setPP(self, value, relative) - self.statusbar:updatePP() +function HeroFighter:updateHP() + self.statusbar:updateHP() end -- VOICE SYSTEM diff --git a/sonic-radiance.love/scenes/battlesystem/controllers/fighters/parent.lua b/sonic-radiance.love/scenes/battlesystem/controllers/fighters/parent.lua index 6298e5c..ff23350 100644 --- a/sonic-radiance.love/scenes/battlesystem/controllers/fighters/parent.lua +++ b/sonic-radiance.love/scenes/battlesystem/controllers/fighters/parent.lua @@ -31,10 +31,12 @@ function FighterParent:setHP(value, relative) end self.abstract:setHP(value, relative) self.actor:setDamageNumber(relativeNumber) + self:updateHP() end function FighterParent:setPP(value, relative) self.abstract:setPP(value, relative) + self:updatePP() end function FighterParent:applyDeath() @@ -48,6 +50,14 @@ function FighterParent:die() self.actor:die() end +function FighterParent:updatePP() + -- Fonction vide +end + +function FighterParent:updateHP() + -- Fonction vide +end + function FighterParent:sendDamage(target, value, accuracy, isSpecial, isAerial) local stats = self:getStats() local value = value / 10