From 2e38b31deac88ddb2423dcfbfcdcc6e372d9b0cb Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Fri, 24 Jul 2020 19:20:48 +0200 Subject: [PATCH] feat: hook up the choregraphy system to the actions --- .../fighters/systems/actions/attack.lua | 2 +- .../fighters/systems/actions/parent.lua | 15 +++++++++++++++ .../fighters/systems/actions/skill.lua | 2 +- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/actions/attack.lua b/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/actions/attack.lua index 84e83aa..7697633 100644 --- a/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/actions/attack.lua +++ b/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/actions/attack.lua @@ -11,7 +11,7 @@ end function AttackAction:startAction() core.debug:print("cbs/action", "Starting attack action") - self:finishAction() + self:loadChoregraphy("attack") end return AttackAction diff --git a/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/actions/parent.lua b/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/actions/parent.lua index f802e25..b21080f 100644 --- a/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/actions/parent.lua +++ b/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/actions/parent.lua @@ -1,5 +1,7 @@ local ActionParent = Object:extend() +local ChoregraphySystem = require "scenes.battlesystem.controllers.fighters.systems.choregraphy" + function ActionParent:new(fighter) self.fighter = fighter self.target = nil @@ -14,6 +16,15 @@ function ActionParent:update(dt) end end +function ActionParent:loadChoregraphy(skillname) + local skill = game.skills:getSkillData(skillname) + self.choregraphy = ChoregraphySystem(self, skill.choregraphy) +end + +function ActionParent:loadChoregraphyFromSkill(skill) + self.choregraphy = ChoregraphySystem(self, skill.choregraphy) +end + function ActionParent:needTarget() -- needTarget, targetEnnemies return false, false @@ -28,6 +39,10 @@ function ActionParent:start() self:startAction() end +function ActionParent:choregraphyEnded() + self:finishAction() +end + function ActionParent:startAction() self:finishAction() diff --git a/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/actions/skill.lua b/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/actions/skill.lua index 5cbfce8..76a05c1 100644 --- a/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/actions/skill.lua +++ b/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/actions/skill.lua @@ -12,7 +12,7 @@ end function SkillAction:startAction() core.debug:print("cbs/action", "Starting flee action") - self:finishAction() + self:loadChoregraphyFromSkill(self.data) end return SkillAction