Ajout des derniers développement #1
11 changed files with 0 additions and 357 deletions
|
@ -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
|
|
@ -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;
|
|
@ -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
|
|
@ -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
|
|
@ -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;
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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;
|
|
@ -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;
|
|
@ -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
|
Loading…
Reference in a new issue