From 4f024dbb395c6f43b1a7ecde71a1bc0c72b0058d Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Sat, 25 Jul 2020 08:43:15 +0200 Subject: [PATCH] chore: remove old choregraphy system from heroes' actors --- .../scenes/battlesystem/actors/hero.lua | 118 ++---------------- 1 file changed, 13 insertions(+), 105 deletions(-) diff --git a/sonic-radiance.love/scenes/battlesystem/actors/hero.lua b/sonic-radiance.love/scenes/battlesystem/actors/hero.lua index cd3b173..82b8859 100644 --- a/sonic-radiance.love/scenes/battlesystem/actors/hero.lua +++ b/sonic-radiance.love/scenes/battlesystem/actors/hero.lua @@ -14,7 +14,6 @@ function Hero:new(world, x, y, owner, charnumber) self:initMovementSystem() self:initSprite() - self:initChoregraphySystem() self.side = "heroes" end @@ -27,8 +26,6 @@ function Hero:update(dt) -- Calculate speed to calculate animation speed self:updateSpeed(dt) - self:updateChoregraphy(dt) - self.xprevious = self.x self.yprevious = self.y self.zprevious = self.z @@ -152,114 +149,25 @@ function Hero:applyMotion(dt) end end --- SIGNAL FUNCTIONS --- All functions related to signal receiving - -function Hero:receiveSignal(action_type, id) - if id == nil then - core.debug:print("battler/hero", "action selected : " .. action_type) - else - core.debug:print("battler/hero", "action selected : " .. action_type .. " (" .. id .. ")") - end - if (action_type == "defend") then - self.turnAction = "defend" - self:switchActiveBattler( ) - elseif (action_type == "attack") then - --self:changeAnimation("hit1") - self:attack() - elseif (action_type == "skill") then - self.world.cursor:unset( ) - self:useSkill(id, self.world.cursor.x, self.world.cursor.y) - elseif (action_type == "cursorMove") then - if (self.x ~= self.world.cursor.x) or (self.y ~= self.world.cursor.y) then - self:changeAnimation("walk", true) - self:goTo(self.world.cursor.x, self.world.cursor.y, 'cursorMove', 1) - self.assets.sfx["woosh"]:play() - else - self.world:resetActiveGrid() - self.scene.menu:set( self ) - end - self.world.cursor:unset( ) - else - self:switchActiveBattler( ) - end -end - -function Hero:positionSelected(x, y) - self:changeAnimation("walk", true) - self:goTo(self.world.cursor.x, self.world.cursor.y, 'cursorMove', 1) - self.assets.sfx["woosh"]:play() -end - -function Hero:receiveBackSignal() - self.world.cursor:set(self.x, self.y, "cursorMove") - if (self.x ~= self.startx) or (self.y ~= self.starty) then - self.world.cursor:set(self.x, self.y, "cursorMove") - self.assets.sfx["woosh"]:play() - self:changeAnimation("walk") - end -end - -function Hero:timerResponse(timer) - if timer == "switchActiveBattler" then - self.scene.turns:nextAction() - elseif timer == "wait" then - self.choregraphy.changeAction = true - elseif timer == "cursorMove" then - self:changeAnimation("idle") - self.world:resetActiveGrid() - self.scene.menu:set( self ) - elseif timer == 'backMove' then - self:changeAnimation("idle") - self.direction = self.directionPrevious - elseif timer == 'action_jumpBack' then - self.unlockDirection = true - self:unblockChoregraphy() - elseif timer == self.choregraphy.blockedBy then - self:unblockChoregraphy() - end -end - --- ACTION FUNCTIONS --- All functions related to actions - -function Hero:switchActiveBattler() - print("Switching Active Battler") - self.tweens:newTimer(0.15, "switchActiveBattler") -end - -- CHOREGRAPHY FUNCTIONS -- All functions related to the choregraphy system -function Hero:initChoregraphySystem() - self.choregraphy = ChoregraphySystem(self) - self.blockingChoregraphy = nil -end - -function Hero:attack(id, dx, dy) - local skill = game.skills:getSkillData("attack") - self.choregraphy:start(skill, dx, dy) -end - -function Hero:useSkill(id, dx, dy) - local skill = game.skills:getSkillData(id) - self:setPP(skill.cost * -1, true) - self.choregraphy:start(skill, dx, dy) -end - -function Hero:updateChoregraphy(dt) - self.choregraphy:update(dt) -end - -function Hero:blockChoregraphy(isBlocked, blockedBy) - if (isBlocked) then - self.blockingChoregraphy = blockedBy +function Hero:blockChoregraphy(isBlocking, currentlyBlocking, blockedBy) + if (isBlocking) then + self.currentlyBlocking = currentlyBlocking + self.blockedBy = blockedBy end end function Hero:unblockChoregraphy() - self.choregraphy:endAction() - self.blockingChoregraphy = "" + self.currentlyBlocking:finish() + self.currentlyBlocking = nil +end + +function Hero:receiveSignal(signal) + if (self.currentlyBlocking ~= nil) then + self:unblockChoregraphy() + end end -- ASSETS FUNCTIONS @@ -274,7 +182,7 @@ function Hero:initSprite() end function Hero:animationEnded(animation) - if (animation == self.blockingChoregraphy) then + if (self.currentlyBlocking ~= nil and self.blockedBy=="animation") then self:unblockChoregraphy() end end