2020-07-19 22:38:59 +02:00
|
|
|
local ActionParent = Object:extend()
|
|
|
|
|
2021-08-15 16:34:36 +02:00
|
|
|
local ChoregraphySystem = require "scenes.battlesystem.choregraphy"
|
2020-07-24 19:20:48 +02:00
|
|
|
|
2020-07-19 22:38:59 +02:00
|
|
|
function ActionParent:new(fighter)
|
|
|
|
self.fighter = fighter
|
|
|
|
self.target = nil
|
|
|
|
self.choregraphy = nil
|
|
|
|
|
|
|
|
self.isStarted = false
|
|
|
|
end
|
|
|
|
|
|
|
|
function ActionParent:update(dt)
|
|
|
|
if (self.choregraphy ~= nil) then
|
|
|
|
self.choregraphy:update(dt)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-07-24 19:20:48 +02:00
|
|
|
function ActionParent:loadChoregraphy(skillname)
|
2021-05-16 08:48:05 +02:00
|
|
|
local skill = core.datas:get("skills", skillname)
|
2021-08-08 14:52:41 +02:00
|
|
|
self:loadChoregraphyFromSkill(skill)
|
2020-07-24 19:20:48 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
function ActionParent:loadChoregraphyFromSkill(skill)
|
2021-08-08 13:11:36 +02:00
|
|
|
self.choregraphy = ChoregraphySystem(self, skill.choregraphy, skill.subChoregraphy)
|
2020-07-24 19:20:48 +02:00
|
|
|
end
|
|
|
|
|
2020-07-19 22:38:59 +02:00
|
|
|
function ActionParent:needTarget()
|
|
|
|
-- needTarget, targetEnnemies
|
|
|
|
return false, false
|
|
|
|
end
|
|
|
|
|
|
|
|
function ActionParent:setTarget(target)
|
|
|
|
self.target = target
|
|
|
|
end
|
|
|
|
|
|
|
|
function ActionParent:start()
|
|
|
|
self.isStarted = true
|
|
|
|
self:startAction()
|
|
|
|
end
|
|
|
|
|
2020-07-24 19:20:48 +02:00
|
|
|
function ActionParent:choregraphyEnded()
|
2020-07-25 11:38:59 +02:00
|
|
|
self.choregraphy = nil
|
2020-07-24 19:20:48 +02:00
|
|
|
self:finishAction()
|
|
|
|
end
|
|
|
|
|
2020-07-19 22:38:59 +02:00
|
|
|
function ActionParent:startAction()
|
|
|
|
|
|
|
|
self:finishAction()
|
|
|
|
end
|
|
|
|
|
|
|
|
function ActionParent:finishAction()
|
|
|
|
self.fighter:finishAction()
|
|
|
|
end
|
|
|
|
|
2021-04-25 12:21:17 +02:00
|
|
|
function ActionParent:draw()
|
|
|
|
if (self.choregraphy ~= nil) then
|
|
|
|
self.choregraphy:draw()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-07-19 22:38:59 +02:00
|
|
|
return ActionParent
|