Ajout des derniers développement #1

Merged
kazhnuz merged 68 commits from chronicles-cbs into master 2020-08-02 11:14:18 +02:00
8 changed files with 104 additions and 2 deletions
Showing only changes of commit b95ad72dcb - Show all commits

View file

@ -14,6 +14,8 @@ return {
choregraphy = { -- the main attack choregraphy
{"setAnimation", "none", "walk", false},
{'goTo', "none", "target", -1, 0, 0.3, true},
{"addQTE", "none", {"simplePrompt", "A", 0.2}, "target", false},
{'playSFX', "none", 'hit'},
{'setAnimation', "none", 'hit1start', true},
{'sendDamage', "none", 33, 100, false, false},
@ -21,6 +23,7 @@ return {
{'playSFX', "sentDamage", 'hitconnect'},
{'setAnimation', "none", 'hit1end', true},
{"addQTE", "none", {"simplePrompt", "A", 0.2}, "target", false},
{'playSFX', "none", 'hit'},
{'setAnimation', "none", 'hit2start', true},
{'sendDamage', "none", 33, 100, false, false},
@ -28,6 +31,7 @@ return {
{'playSFX', "sentDamage", 'hitconnect'},
{'setAnimation', "none", 'hit2end', true},
{"addQTE", "none", {"simplePrompt", "A", 0.2}, "target", false},
{'playSFX', "none", 'hit'},
{'setAnimation', "none", 'hit3start', true},
{'sendDamage', "none", 33, 100, false, false},

View file

@ -9,6 +9,7 @@ return {
["jumpTo"] = {"origin", "x", "y", "duration", "blockProcess"},
["jumpBack"] = {"duration", "blockProcess"},
["waitActorFinished"] = {"waitFor"},
["addQTE"] = {"qteData", "origin", "blockProcess"}
--[name] = {args},
}

View file

@ -1,5 +1,7 @@
ChoregraphyUtils = {}
-- steps utils
function ChoregraphyUtils.getStepStructure(stepName)
local stepTypeList = require "game.utils.choregraphy.arguments"
return stepTypeList[stepName]
@ -9,7 +11,7 @@ function ChoregraphyUtils.stepExists(stepName)
return (ChoregraphyUtils.getStepStructure(stepName) ~= nil)
end
function ChoregraphyUtils.validate(stepBaseDatas)
function ChoregraphyUtils.validateStep(stepBaseDatas)
local structure = ChoregraphyUtils.getStepStructure(stepBaseDatas[1])
if (structure == nil) then
return false
@ -23,7 +25,7 @@ function ChoregraphyUtils.getStepDatas(stepBaseDatas)
local stepData = {}
stepData.name = stepBaseDatas[1]
if (ChoregraphyUtils.validate(stepBaseDatas)) then
if (ChoregraphyUtils.validateStep(stepBaseDatas)) then
stepData.condition = stepBaseDatas[2]
local structure = ChoregraphyUtils.getStepStructure(stepData.name)
@ -42,4 +44,46 @@ function ChoregraphyUtils.getStepDatas(stepBaseDatas)
end
-- QTE utils
function ChoregraphyUtils.getQteStructure(qteName)
local stepTypeList = require "game.utils.choregraphy.qte"
return stepTypeList[qteName]
end
function ChoregraphyUtils.qteExists(qteName)
return (ChoregraphyUtils.getQteStructure(qteName) ~= nil)
end
function ChoregraphyUtils.validateQte(qteBaseDatas)
local structure = ChoregraphyUtils.getQteStructure(qteBaseDatas[1])
if (structure == nil) then
return false
else
return ((#structure + 1) == #qteBaseDatas)
end
end
function ChoregraphyUtils.getQteDatas(qteBaseDatas)
local qteData = {}
qteData.name = qteBaseDatas[1]
if (ChoregraphyUtils.validateQte(qteBaseDatas)) then
local structure = ChoregraphyUtils.getQteStructure(qteData.name)
qteData.arguments = {}
for i, argumentName in ipairs(structure) do
local argumentContent = qteBaseDatas[i + 1]
qteData.arguments[argumentName] = argumentContent
end
return qteData
else
error("Le QTE " .. qteData.name .. " à un nbr d'argument incorrect")
end
end
return ChoregraphyUtils

View file

@ -0,0 +1,3 @@
return {
["simplePrompt"] = {"key", "duration"}
}

View file

@ -2,6 +2,7 @@ local ChoregraphySystem = Object:extend()
local choregraphyUtils = require "game.utils.choregraphy"
local stepObjectList = require "scenes.battlesystem.controllers.fighters.systems.choregraphy.step"
local qteObjectList = require "scenes.battlesystem.controllers.fighters.systems.choregraphy.qte"
function ChoregraphySystem:new(action, choregraphy)
self.action = action
@ -14,9 +15,17 @@ function ChoregraphySystem:new(action, choregraphy)
self.currentStepId = 0
self.currentStep = nil
self.stepList = choregraphy
self.qte = {}
self.qte.current = nil
self.qte.wasSuccess = false
end
function ChoregraphySystem:update(dt)
if (self.qte.current ~= nil) then
self.qte.current:update(dt)
end
if (self.currentStep ~= nil) then
self.currentStep:updateStep(dt)
else
@ -37,6 +46,15 @@ function ChoregraphySystem:switchStep()
end
end
function ChoregraphySystem:addQTE(action, origin, qteBaseData, blockProcess)
local qteData = choregraphyUtils.getQteDatas(qteBaseData)
if (qteObjectList[qteData.name] ~= nil) then
self.qte.current = qteObjectList[qteData.name](self, qteData.arguments, action)
self.qte.current:blockAction(action, blockProcess)
self.qte.current:setOrigin(origin)
end
end
function ChoregraphySystem:sendDamage(power, accuracy, isSpecial, isAerial)
if (self.target ~= nil) then
if (self.fighter.isAlive) then

View file

@ -0,0 +1,5 @@
local qtes = {}
local baseURI = "scenes.battlesystem.controllers.fighters.systems.choregraphy.qte."
return qtes

View file

@ -0,0 +1,26 @@
local StepParent = require "scenes.battlesystem.controllers.fighters.systems.choregraphy.step.parent"
local StepQTE = StepParent:extend()
function StepQTE:new(controller, args)
StepQTE.super.new(self, controller, args)
end
function StepQTE:start()
self.choregraphy:addQTE(self, self.arguments.origin, self.arguments.qteData, self.arguments.blockProcess)
if (not self.arguments.blockProcess) then
self:finish()
end
end
function StepQTE:update(dt)
end
function StepQTE:getSignal(signal)
if (signal == "gfxEnded") then
self:finish()
end
end
return StepQTE

View file

@ -3,6 +3,7 @@ local actions = {}
local baseURI = "scenes.battlesystem.controllers.fighters.systems.choregraphy.step."
actions["addGFX"] = require(baseURI .. "addGFX")
actions["addQTE"] = require(baseURI .. "addQTE")
actions["goTo"] = require(baseURI .. "goTo")
actions["jumpBack"] = require(baseURI .. "jumpBack")
actions["playSFX"] = require(baseURI .. "playSFX")