From 808108c3f335ab39c71019d7f31bbf4471b50948 Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Sat, 25 Jul 2020 11:18:00 +0200 Subject: [PATCH] chore: remove the old choregraphy system --- .../actors/systems/actions/addGFX.lua | 36 ------- .../actors/systems/actions/dashForward.lua | 19 ---- .../actors/systems/actions/init.lua | 14 --- .../actors/systems/actions/jump.lua | 40 -------- .../actors/systems/actions/parent.lua | 29 ------ .../actors/systems/actions/playSFX.lua | 14 --- .../actors/systems/actions/sendDamage.lua | 38 -------- .../systems/actions/sendDamageToPoint.lua | 29 ------ .../actors/systems/actions/setAnimation.lua | 24 ----- .../actors/systems/actions/wait.lua | 19 ---- .../actors/systems/choregraphy.lua | 95 ------------------- 11 files changed, 357 deletions(-) delete mode 100644 sonic-radiance.love/scenes/battlesystem/actors/systems/actions/addGFX.lua delete mode 100644 sonic-radiance.love/scenes/battlesystem/actors/systems/actions/dashForward.lua delete mode 100644 sonic-radiance.love/scenes/battlesystem/actors/systems/actions/init.lua delete mode 100644 sonic-radiance.love/scenes/battlesystem/actors/systems/actions/jump.lua delete mode 100644 sonic-radiance.love/scenes/battlesystem/actors/systems/actions/parent.lua delete mode 100644 sonic-radiance.love/scenes/battlesystem/actors/systems/actions/playSFX.lua delete mode 100644 sonic-radiance.love/scenes/battlesystem/actors/systems/actions/sendDamage.lua delete mode 100644 sonic-radiance.love/scenes/battlesystem/actors/systems/actions/sendDamageToPoint.lua delete mode 100644 sonic-radiance.love/scenes/battlesystem/actors/systems/actions/setAnimation.lua delete mode 100644 sonic-radiance.love/scenes/battlesystem/actors/systems/actions/wait.lua delete mode 100644 sonic-radiance.love/scenes/battlesystem/actors/systems/choregraphy.lua diff --git a/sonic-radiance.love/scenes/battlesystem/actors/systems/actions/addGFX.lua b/sonic-radiance.love/scenes/battlesystem/actors/systems/actions/addGFX.lua deleted file mode 100644 index 08f88c9..0000000 --- a/sonic-radiance.love/scenes/battlesystem/actors/systems/actions/addGFX.lua +++ /dev/null @@ -1,36 +0,0 @@ -local ChoregraphyActionParent = require "scenes.battlesystem.actors.systems.actions.parent" -local GFXAction = ChoregraphyActionParent:extend() - -function GFXAction:new(controller, args, effectArea) - GFXAction.super.new(self, controller, args, effectArea) -end - -function GFXAction:start() - local dx = self.args.dx - - if (self.args.affectedByDirection) then - dx = dx * self.actor.direction - end - - local x = self.actor.x - local y = self.actor.y - local z = 0 - - self.actor.world.obj.GFX(self.actor.world, x + dx, y + self.args.dy, z, self.args.sprite, self, self.args.blockProcess) - if (not self.args.blockProcess) then - self:finish() - end -end - -function GFXAction:update(dt) - -end - -function GFXAction:getSignal(signal) - if (signal == "gfxEnded") then - self:finish() - end -end - - -return GFXAction diff --git a/sonic-radiance.love/scenes/battlesystem/actors/systems/actions/dashForward.lua b/sonic-radiance.love/scenes/battlesystem/actors/systems/actions/dashForward.lua deleted file mode 100644 index 02e3918..0000000 --- a/sonic-radiance.love/scenes/battlesystem/actors/systems/actions/dashForward.lua +++ /dev/null @@ -1,19 +0,0 @@ -local ChoregraphyActionParent = require "scenes.battlesystem.actors.systems.actions.parent" -local DashAction = ChoregraphyActionParent:extend() - -function DashAction:new(system, args, effectArea) - DashAction.super.new(self, system, args, effectArea) -end - -function DashAction:start() - self.actor:setMotionX(self.actor.direction, self.args.speed) - self.actor:blockChoregraphy(self.args.blockProcess, "action_dashForward") -end - -function DashAction:getSignal(signal) - if (signal == "actorHaveFinished") then - self:finish() - end -end - -return DashAction; diff --git a/sonic-radiance.love/scenes/battlesystem/actors/systems/actions/init.lua b/sonic-radiance.love/scenes/battlesystem/actors/systems/actions/init.lua deleted file mode 100644 index 4c819f9..0000000 --- a/sonic-radiance.love/scenes/battlesystem/actors/systems/actions/init.lua +++ /dev/null @@ -1,14 +0,0 @@ -local actions = {} - -local baseURI = "scenes.battlesystem.actors.systems.actions." - -actions["addGFX"] = require(baseURI .. "addGFX") -actions["dashForward"] = require(baseURI .. "dashForward") -actions["jump"] = require(baseURI .. "jump") -actions["playSFX"] = require(baseURI .. "playSFX") -actions["sendDamage"] = require(baseURI .. "sendDamage") -actions["sendDamageToPoint"] = require(baseURI .. "sendDamageToPoint") -actions["setAnimation"] = require(baseURI .. "setAnimation") -actions["wait"] = require(baseURI .. "wait") - -return actions diff --git a/sonic-radiance.love/scenes/battlesystem/actors/systems/actions/jump.lua b/sonic-radiance.love/scenes/battlesystem/actors/systems/actions/jump.lua deleted file mode 100644 index ba8507c..0000000 --- a/sonic-radiance.love/scenes/battlesystem/actors/systems/actions/jump.lua +++ /dev/null @@ -1,40 +0,0 @@ -local ChoregraphyActionParent = require "scenes.battlesystem.actors.systems.actions.parent" -local JumpAction = ChoregraphyActionParent:extend() - -function JumpAction:new(system, args, effectArea) - JumpAction.super.new(self, system, args, effectArea) -end - -function JumpAction:start() - local xx, yy - local spinjump = true - local factor = 1 - local easing = 'inOutQuad' - if self.args.name == "jumpBack" then - xx, yy = self.controller.startx, self.controller.starty - self.actor.directionLocked = true - spinjump = false - factor = 2 - easing = 'outQuad' - elseif self.args.name == "jumpToCursor" then - xx, yy = self.controller.dx, self.controller.dy - end - - local dist = utils.math.pointDistance(self.actor.x, self.actor.y, xx, yy) - local jumpHeight = dist * 16 / factor - - self.actor:jumpTo(xx, yy, jumpHeight, "action_jumpBack", spinjump, 1, easing) - self.actor:blockChoregraphy(self.args.blockProcess, "action_jumpBack") - if (not self.args.blockProcess) then - self:finish() - end -end - -function JumpAction:getSignal(signal) - if (signal == "actorHaveFinished") then - self:finish() - end -end - - -return JumpAction diff --git a/sonic-radiance.love/scenes/battlesystem/actors/systems/actions/parent.lua b/sonic-radiance.love/scenes/battlesystem/actors/systems/actions/parent.lua deleted file mode 100644 index 38ec360..0000000 --- a/sonic-radiance.love/scenes/battlesystem/actors/systems/actions/parent.lua +++ /dev/null @@ -1,29 +0,0 @@ -local ChoregraphyAction = Object:extend() - -function ChoregraphyAction:new(controller, args, effectArea) - self.controller = controller - self.actor = controller.actor - - self.args = args; - self.effectArea = effectArea; - self:start() -end - -function ChoregraphyAction:start() - self:finish() -end - -function ChoregraphyAction:update(dt) - -end - -function ChoregraphyAction:getSignal(signal) - -end - -function ChoregraphyAction:finish() - print("action finished") - self.controller:endAction() -end - -return ChoregraphyAction; diff --git a/sonic-radiance.love/scenes/battlesystem/actors/systems/actions/playSFX.lua b/sonic-radiance.love/scenes/battlesystem/actors/systems/actions/playSFX.lua deleted file mode 100644 index 8f085b0..0000000 --- a/sonic-radiance.love/scenes/battlesystem/actors/systems/actions/playSFX.lua +++ /dev/null @@ -1,14 +0,0 @@ -local ChoregraphyActionParent = require "scenes.battlesystem.actors.systems.actions.parent" -local PlaySFX = ChoregraphyActionParent:extend() - -function PlaySFX:new(system, args, effectArea) - PlaySFX.super.new(self, system, args, effectArea) -end - -function PlaySFX:start() - self.actor.assets.sfx[self.args.sfx]:play() - self:finish() -end - - -return PlaySFX diff --git a/sonic-radiance.love/scenes/battlesystem/actors/systems/actions/sendDamage.lua b/sonic-radiance.love/scenes/battlesystem/actors/systems/actions/sendDamage.lua deleted file mode 100644 index 262fbf9..0000000 --- a/sonic-radiance.love/scenes/battlesystem/actors/systems/actions/sendDamage.lua +++ /dev/null @@ -1,38 +0,0 @@ -local ChoregraphyActionParent = require "scenes.battlesystem.actors.systems.actions.parent" -local SendDamage = ChoregraphyActionParent:extend() - -local maputils = require "scenes.battlesystem.utils" - -function SendDamage:new(system, args, effectArea) - SendDamage.super.new(self, system, args, effectArea) -end - -function SendDamage:start() - local power = self.args.power - local accuracy = self.args.accuracy - local isSpecial = self.args.isSpecial - local isAerial = self.args.isAerial - - local dx = self.effectArea[1] - if self.effectArea[5] then - dx = dx * self.controller.direction - end - local ox = self.controller.startx + dx - local oy = self.controller.starty + self.effectArea[2] - local grid = maputils.maskToMap(ox, oy, self.effectArea[3], self.effectArea[4], self.controller.direction) - - local test = false - - for i, line in ipairs(grid) do - for j, case in ipairs(line) do - if grid[i][j] == 1 then - test = self.actor:sendDamage(j, i, power, accuracy, isSpecial, isAerial) - end - end - end - - self.controller.haveSentDamage = test - self:finish() -end - -return SendDamage diff --git a/sonic-radiance.love/scenes/battlesystem/actors/systems/actions/sendDamageToPoint.lua b/sonic-radiance.love/scenes/battlesystem/actors/systems/actions/sendDamageToPoint.lua deleted file mode 100644 index c90cb49..0000000 --- a/sonic-radiance.love/scenes/battlesystem/actors/systems/actions/sendDamageToPoint.lua +++ /dev/null @@ -1,29 +0,0 @@ -local ChoregraphyActionParent = require "scenes.battlesystem.actors.systems.actions.parent" -local SendDamage = ChoregraphyActionParent:extend() - -function SendDamage:new(system, args, effectArea) - SendDamage.super.new(self, system, args, effectArea) -end - -function SendDamage:start() - local xx, yy - if self.args.name == "sendDamageFromCursor" then - xx = self.controller.dx - yy = self.controller.dy - elseif self.args.name == "sendDamageFromPos" then - xx = utils.math.round(self.actor.x) - yy = utils.math.round(self.actor.y) - end - - local dx = self.args.dx - if (self.args.affectedByDirection) then - dx = dx * self.controller.direction - end - xx = xx + dx - yy = yy + self.args.dy - self.controller.haveSentDamage = self.actor:sendDamage(xx, yy, self.args.power, self.args.accuracy, self.args.isSpecial, self.args.isAerial) - - self:finish() -end - -return SendDamage diff --git a/sonic-radiance.love/scenes/battlesystem/actors/systems/actions/setAnimation.lua b/sonic-radiance.love/scenes/battlesystem/actors/systems/actions/setAnimation.lua deleted file mode 100644 index ee26427..0000000 --- a/sonic-radiance.love/scenes/battlesystem/actors/systems/actions/setAnimation.lua +++ /dev/null @@ -1,24 +0,0 @@ -local ChoregraphyActionParent = require "scenes.battlesystem.actors.systems.actions.parent" -local AnimationSetterAction = ChoregraphyActionParent:extend() - -function AnimationSetterAction:new(controller, args, effectArea) - AnimationSetterAction.super.new(self, controller, args, effectArea) -end - -function AnimationSetterAction:start() - self.actor:changeAnimation(self.args.animation) - self.actor:blockChoregraphy(self.args.blockProcess, self.args.animation) - if (self.args.blockProcess == false) then - self:finish() - end -end - -function AnimationSetterAction:update(dt) - -end - -function AnimationSetterAction:getSignal(signal) - -end - -return AnimationSetterAction; diff --git a/sonic-radiance.love/scenes/battlesystem/actors/systems/actions/wait.lua b/sonic-radiance.love/scenes/battlesystem/actors/systems/actions/wait.lua deleted file mode 100644 index 53cf628..0000000 --- a/sonic-radiance.love/scenes/battlesystem/actors/systems/actions/wait.lua +++ /dev/null @@ -1,19 +0,0 @@ -local ChoregraphyActionParent = require "scenes.battlesystem.actors.systems.actions.parent" -local WaitAction = ChoregraphyActionParent:extend() - -function WaitAction:new(controller, args, effectArea) - WaitAction.super.new(self, controller, args, effectArea) -end - -function WaitAction:start() - self.timer = 0 -end - -function WaitAction:update(dt) - self.timer = self.timer + dt - if (self.timer > self.args.duration) then - self:finish() - end -end - -return WaitAction; diff --git a/sonic-radiance.love/scenes/battlesystem/actors/systems/choregraphy.lua b/sonic-radiance.love/scenes/battlesystem/actors/systems/choregraphy.lua deleted file mode 100644 index 4e0855d..0000000 --- a/sonic-radiance.love/scenes/battlesystem/actors/systems/choregraphy.lua +++ /dev/null @@ -1,95 +0,0 @@ -local ChoregraphySystem = Object:extend() - -local actionList = require "scenes.battlesystem.actors.systems.actions" - -function ChoregraphySystem:new(actor) - self.actor = actor - self:init({}, nil, self.actor.x, self.actor.y, false) -end - -function ChoregraphySystem:init(choregraphy, effectArea, dx, dy, isActive) - self.current = 0 - self.action = nil - self.isFinished = false - - self.data = choregraphy - self.effectArea = effectArea - - self.startx = self.actor.x - self.starty = self.actor.y - self.direction = self.actor.direction - - self.dx = dx or self.actor.x - self.dy = dy or self.actor.y - - self.haveSentDamage = false - - self.isActive = isActive - self.actionHaveEnded = false -end - -function ChoregraphySystem:start(skill, dx, dy) - local skill = skill - self:init(skill.choregraphy, skill.effectArea, dx, dy, true) -end - -function ChoregraphySystem:finish() - self.isActive = false - self.actor:switchActiveBattler() -end - -function ChoregraphySystem:update(dt) - if (self.actionHaveEnded) then - self.action = nil - self.actionHaveEnded = false - end - - if (self.isActive) then - if (self.action == nil) then - self:switchAction() - else - self.action:update(dt) - end - end -end - -function ChoregraphySystem:switchAction() - self.current = self.current + 1 - local nextAction = self.data[self.current] - - if (nextAction == nil) then - print("finished") - self:finish() - else - local args = game.skills:getActionArguments(nextAction) - local condition = args.condition - if (condition == "sentDamage") and (not self.haveSentDamage) then - core.debug:print("cbs/hero", "you didn't do damage, skipping " .. args.name) - self:switchAction() - else - self:doAction(nextAction) - end - - end -end - -function ChoregraphySystem:doAction(choregraphyAction) - local args = game.skills:getActionArguments(choregraphyAction) - local type = args.type or "unknown" - local effectArea = self.effectArea - - local action = actionList[type] - - if (action == nil) then - core.debug:warning("cbs/hero", "unknown action type " .. type .. ' (' .. args.name .. ')') - else - self.action = action(self, args, effectArea) - end -end - -function ChoregraphySystem:endAction() - self.action = nil - self.actionHaveEnded = true -end - -return ChoregraphySystem