chore: port to parser system
This commit is contained in:
parent
aa9140406f
commit
c10d58e604
13 changed files with 57 additions and 257 deletions
|
@ -1,4 +1,6 @@
|
||||||
return {
|
return {
|
||||||
|
headings = {"name", "condition"},
|
||||||
|
argumentLists = {
|
||||||
["wait"] = {"duration"},
|
["wait"] = {"duration"},
|
||||||
["addGFX"] = {'sprite', "origin", "x", "y", "affectedByDirection", 'blockProcess'},
|
["addGFX"] = {'sprite', "origin", "x", "y", "affectedByDirection", 'blockProcess'},
|
||||||
["playSFX"] = {"sfx"},
|
["playSFX"] = {"sfx"},
|
||||||
|
@ -12,6 +14,8 @@ return {
|
||||||
["addQTE"] = {"qteData", "origin", "blockProcess"},
|
["addQTE"] = {"qteData", "origin", "blockProcess"},
|
||||||
["useItemEffect"] = {},
|
["useItemEffect"] = {},
|
||||||
--[name] = {args},
|
--[name] = {args},
|
||||||
|
},
|
||||||
|
argumentWrapper = "arguments",
|
||||||
}
|
}
|
||||||
|
|
||||||
-- The "origin" argument can have the different values
|
-- The "origin" argument can have the different values
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
return {
|
return {
|
||||||
|
headings = {"type"},
|
||||||
|
argumentLists = {
|
||||||
["normal"] = {"category", "name", "number"},
|
["normal"] = {"category", "name", "number"},
|
||||||
["boss"] = {"category", "name", "pvFactor", "statFactor", "cheapEffect"},
|
["boss"] = {"category", "name", "pvFactor", "statFactor", "cheapEffect"},
|
||||||
["rival"] = {"character", "level", "pvFactor"}
|
["rival"] = {"character", "level", "pvFactor"}
|
||||||
|
},
|
||||||
|
argumentWrapper = "",
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
return {
|
return {
|
||||||
|
headings = {"name", "condition"},
|
||||||
|
argumentLists = {
|
||||||
["wait"] = {"duration"},
|
["wait"] = {"duration"},
|
||||||
["simpleMessage"] = {"message"},
|
["simpleMessage"] = {"message"},
|
||||||
["dialogBox"] = {"message", "title", "avatar"},
|
["dialogBox"] = {"message", "title", "avatar"},
|
||||||
|
@ -9,6 +11,8 @@ return {
|
||||||
["teleport"] = {"area", "x", "y", "charDir"},
|
["teleport"] = {"area", "x", "y", "charDir"},
|
||||||
["showGFX"] = {"x", "y", "spritename"}
|
["showGFX"] = {"x", "y", "spritename"}
|
||||||
--[name] = {args...},
|
--[name] = {args...},
|
||||||
|
},
|
||||||
|
argumentWrapper = "arguments",
|
||||||
}
|
}
|
||||||
|
|
||||||
-- The "origin" argument can have the different values
|
-- The "origin" argument can have the different values
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
return {
|
return {
|
||||||
|
headings = {"type"},
|
||||||
|
argumentLists = {
|
||||||
["heal"] = {"healType", "computationMode", "value"},
|
["heal"] = {"healType", "computationMode", "value"},
|
||||||
["setStatus"] = {"status", "set"},
|
["setStatus"] = {"status", "set"},
|
||||||
["protectElement"] = {"element"},
|
["protectElement"] = {"element"},
|
||||||
["blockStatus"] = {"blockWhat"},
|
["blockStatus"] = {"blockWhat"},
|
||||||
|
},
|
||||||
|
argumentWrapper = "",
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
return {
|
return {
|
||||||
|
headings = {"name"},
|
||||||
|
argumentLists = {
|
||||||
["simplePrompt"] = {"key", "duration"}
|
["simplePrompt"] = {"key", "duration"}
|
||||||
|
},
|
||||||
|
argumentWrapper = "arguments",
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
local EventManager = Object:extend()
|
local EventManager = Object:extend()
|
||||||
|
|
||||||
local stepObjectList = require "game.events.event"
|
local stepObjectList = require "game.events.event"
|
||||||
local eventUtils = require "game.events.utils"
|
|
||||||
local Conditions = require "game.events.conditions"
|
local Conditions = require "game.events.conditions"
|
||||||
|
|
||||||
|
|
||||||
|
@ -73,7 +72,7 @@ end
|
||||||
function EventManager:switchStep()
|
function EventManager:switchStep()
|
||||||
if self:haveNextStep() then
|
if self:haveNextStep() then
|
||||||
self.currentStepId = self.currentStepId + 1
|
self.currentStepId = self.currentStepId + 1
|
||||||
local stepData = eventUtils.getStepDatas(self.stepList[self.currentStepId])
|
local stepData = core.datas:parse("eventstep", self.stepList[self.currentStepId])
|
||||||
core.debug:print("event", "Starting step " .. stepData.name)
|
core.debug:print("event", "Starting step " .. stepData.name)
|
||||||
if (not self:testCondition(stepData.condition)) then
|
if (not self:testCondition(stepData.condition)) then
|
||||||
self:switchStep()
|
self:switchStep()
|
||||||
|
|
|
@ -1,45 +0,0 @@
|
||||||
local EventUtils = {}
|
|
||||||
|
|
||||||
-- steps utils
|
|
||||||
|
|
||||||
function EventUtils.getStepStructure(stepName)
|
|
||||||
local stepTypeList = require "datas.parsers.eventstep"
|
|
||||||
return stepTypeList[stepName]
|
|
||||||
end
|
|
||||||
|
|
||||||
function EventUtils.stepExists(stepName)
|
|
||||||
return (EventUtils.getStepStructure(stepName) ~= nil)
|
|
||||||
end
|
|
||||||
|
|
||||||
function EventUtils.validateStep(stepBaseDatas)
|
|
||||||
local structure = EventUtils.getStepStructure(stepBaseDatas[1])
|
|
||||||
if (structure == nil) then
|
|
||||||
return false
|
|
||||||
else
|
|
||||||
return ((#structure + 2) == #stepBaseDatas)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function EventUtils.getStepDatas(stepBaseDatas)
|
|
||||||
local stepData = {}
|
|
||||||
stepData.name = stepBaseDatas[1]
|
|
||||||
|
|
||||||
if (EventUtils.validateStep(stepBaseDatas)) then
|
|
||||||
stepData.condition = stepBaseDatas[2]
|
|
||||||
|
|
||||||
local structure = EventUtils.getStepStructure(stepData.name)
|
|
||||||
|
|
||||||
stepData.arguments = {}
|
|
||||||
|
|
||||||
for i, argumentName in ipairs(structure) do
|
|
||||||
local argumentContent = stepBaseDatas[i + 2]
|
|
||||||
stepData.arguments[argumentName] = argumentContent
|
|
||||||
end
|
|
||||||
|
|
||||||
return stepData
|
|
||||||
else
|
|
||||||
error("L'étape " .. stepData.name .. " à un nbr d'argument incorrect")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return EventUtils
|
|
|
@ -1,6 +1,5 @@
|
||||||
local EffectManager = Object:extend()
|
local EffectManager = Object:extend()
|
||||||
|
|
||||||
local itemutils = require "game.utils.items"
|
|
||||||
local effectList = require "game.loot.effects"
|
local effectList = require "game.loot.effects"
|
||||||
|
|
||||||
function EffectManager:new()
|
function EffectManager:new()
|
||||||
|
@ -45,7 +44,7 @@ function EffectManager:getEffectStrings(character)
|
||||||
end
|
end
|
||||||
|
|
||||||
function EffectManager:getEffectObject(rawEffectData, character, duration)
|
function EffectManager:getEffectObject(rawEffectData, character, duration)
|
||||||
local effect = itemutils.getItemEffectData(rawEffectData)
|
local effect = core.datas:parse("itemeffects", rawEffectData)
|
||||||
if (effectList[effect.type] ~= nil) then
|
if (effectList[effect.type] ~= nil) then
|
||||||
return effectList[effect.type](effect, character, duration)
|
return effectList[effect.type](effect, character, duration)
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,43 +1,3 @@
|
||||||
local BattleUtils = {}
|
local BattleUtils = {}
|
||||||
|
|
||||||
-- ENNEMY FUNCTIONS
|
|
||||||
|
|
||||||
function BattleUtils.getEnnemyTypeStructure(type)
|
|
||||||
local typeList = require "datas.parsers.ennemytype"
|
|
||||||
return typeList[type]
|
|
||||||
end
|
|
||||||
|
|
||||||
function BattleUtils.ennemyTypeExists(type)
|
|
||||||
return (BattleUtils.getEnnemyTypeStructure(type) ~= nil)
|
|
||||||
end
|
|
||||||
|
|
||||||
function BattleUtils.validateEnnemyType(ennemyBaseData)
|
|
||||||
local structure = BattleUtils.getEnnemyTypeStructure(ennemyBaseData[1])
|
|
||||||
if (structure == nil) then
|
|
||||||
return false
|
|
||||||
else
|
|
||||||
return ((#structure + 1) == #ennemyBaseData)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function BattleUtils.getEnnemyData(ennemyBaseData)
|
|
||||||
local ennemyData = {}
|
|
||||||
ennemyData.type = ennemyBaseData[1]
|
|
||||||
|
|
||||||
if (BattleUtils.validateEnnemyType(ennemyBaseData)) then
|
|
||||||
local structure = BattleUtils.getEnnemyTypeStructure(ennemyData.type)
|
|
||||||
|
|
||||||
for i, argumentName in ipairs(structure) do
|
|
||||||
local argumentContent = ennemyBaseData[i + 1]
|
|
||||||
ennemyData[argumentName] = argumentContent
|
|
||||||
end
|
|
||||||
|
|
||||||
return ennemyData
|
|
||||||
else
|
|
||||||
error("Le type d'ennemy " .. ennemyData.type .. " à un nbr d'argument incorrect")
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
return BattleUtils
|
return BattleUtils
|
||||||
|
|
|
@ -1,89 +0,0 @@
|
||||||
local ChoregraphyUtils = {}
|
|
||||||
|
|
||||||
-- steps utils
|
|
||||||
|
|
||||||
function ChoregraphyUtils.getStepStructure(stepName)
|
|
||||||
local stepTypeList = require "datas.parsers.choregraphystep"
|
|
||||||
return stepTypeList[stepName]
|
|
||||||
end
|
|
||||||
|
|
||||||
function ChoregraphyUtils.stepExists(stepName)
|
|
||||||
return (ChoregraphyUtils.getStepStructure(stepName) ~= nil)
|
|
||||||
end
|
|
||||||
|
|
||||||
function ChoregraphyUtils.validateStep(stepBaseDatas)
|
|
||||||
local structure = ChoregraphyUtils.getStepStructure(stepBaseDatas[1])
|
|
||||||
if (structure == nil) then
|
|
||||||
return false
|
|
||||||
else
|
|
||||||
return ((#structure + 2) == #stepBaseDatas)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function ChoregraphyUtils.getStepDatas(stepBaseDatas)
|
|
||||||
|
|
||||||
local stepData = {}
|
|
||||||
stepData.name = stepBaseDatas[1]
|
|
||||||
|
|
||||||
if (ChoregraphyUtils.validateStep(stepBaseDatas)) then
|
|
||||||
stepData.condition = stepBaseDatas[2]
|
|
||||||
|
|
||||||
local structure = ChoregraphyUtils.getStepStructure(stepData.name)
|
|
||||||
|
|
||||||
stepData.arguments = {}
|
|
||||||
|
|
||||||
for i, argumentName in ipairs(structure) do
|
|
||||||
local argumentContent = stepBaseDatas[i + 2]
|
|
||||||
stepData.arguments[argumentName] = argumentContent
|
|
||||||
end
|
|
||||||
|
|
||||||
return stepData
|
|
||||||
else
|
|
||||||
error("L'étape " .. stepData.name .. " à un nbr d'argument incorrect")
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
-- QTE utils
|
|
||||||
|
|
||||||
function ChoregraphyUtils.getQteStructure(qteName)
|
|
||||||
local stepTypeList = require "datas.parsers.qtesteps"
|
|
||||||
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
|
|
|
@ -1,41 +0,0 @@
|
||||||
local ItemUtils = {}
|
|
||||||
|
|
||||||
-- VALIDATION FUNCTIONS
|
|
||||||
|
|
||||||
function ItemUtils.getItemEffectStructure(type)
|
|
||||||
local typeList = require "datas.parsers.itemeffects"
|
|
||||||
return typeList[type]
|
|
||||||
end
|
|
||||||
|
|
||||||
function ItemUtils.itemEffectExists(type)
|
|
||||||
return (ItemUtils.getItemEffectStructure(type) ~= nil)
|
|
||||||
end
|
|
||||||
|
|
||||||
function ItemUtils.validateItemEffect(effectBaseData)
|
|
||||||
local structure = ItemUtils.getItemEffectStructure(effectBaseData[1])
|
|
||||||
if (structure == nil) then
|
|
||||||
return false
|
|
||||||
else
|
|
||||||
return ((#structure + 1) == #effectBaseData)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function ItemUtils.getItemEffectData(effectBaseData)
|
|
||||||
local effectData = {}
|
|
||||||
effectData.type = effectBaseData[1]
|
|
||||||
|
|
||||||
if (ItemUtils.validateItemEffect(effectBaseData)) then
|
|
||||||
local structure = ItemUtils.getItemEffectStructure(effectData.type)
|
|
||||||
|
|
||||||
for i, argumentName in ipairs(structure) do
|
|
||||||
local argumentContent = effectBaseData[i + 1]
|
|
||||||
effectData[argumentName] = argumentContent
|
|
||||||
end
|
|
||||||
|
|
||||||
return effectData
|
|
||||||
else
|
|
||||||
error("Le type d'effet d'objet " .. effectData.type .. " à un nbr d'argument incorrect")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return ItemUtils
|
|
|
@ -3,8 +3,6 @@ local EnnemyController = FighterControllerParent:extend()
|
||||||
|
|
||||||
local Villain = require "scenes.battlesystem.controllers.fighters.villain"
|
local Villain = require "scenes.battlesystem.controllers.fighters.villain"
|
||||||
|
|
||||||
local battleutils = require "game.utils.battle"
|
|
||||||
|
|
||||||
function EnnemyController:new(owner, battleData)
|
function EnnemyController:new(owner, battleData)
|
||||||
self.super.new(self, owner)
|
self.super.new(self, owner)
|
||||||
self:initVillains(battleData)
|
self:initVillains(battleData)
|
||||||
|
@ -12,7 +10,7 @@ end
|
||||||
|
|
||||||
function EnnemyController:initVillains(battleData)
|
function EnnemyController:initVillains(battleData)
|
||||||
for i,ennemyBaseData in ipairs(battleData.ennemies) do
|
for i,ennemyBaseData in ipairs(battleData.ennemies) do
|
||||||
local ennData = battleutils.getEnnemyData(ennemyBaseData)
|
local ennData = core.datas:parse("ennemytype", ennemyBaseData)
|
||||||
if (ennData.type == "normal") then
|
if (ennData.type == "normal") then
|
||||||
self:addVillain(ennData)
|
self:addVillain(ennData)
|
||||||
elseif (ennData.type == "boss") then
|
elseif (ennData.type == "boss") then
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
local ChoregraphySystem = Object:extend()
|
local ChoregraphySystem = Object:extend()
|
||||||
|
|
||||||
local choregraphyUtils = require "game.utils.choregraphy"
|
|
||||||
local stepObjectList = require "scenes.battlesystem.controllers.fighters.systems.choregraphy.step"
|
local stepObjectList = require "scenes.battlesystem.controllers.fighters.systems.choregraphy.step"
|
||||||
local qteObjectList = require "scenes.battlesystem.controllers.fighters.systems.choregraphy.qte"
|
local qteObjectList = require "scenes.battlesystem.controllers.fighters.systems.choregraphy.qte"
|
||||||
|
|
||||||
|
@ -38,7 +37,7 @@ end
|
||||||
function ChoregraphySystem:switchStep()
|
function ChoregraphySystem:switchStep()
|
||||||
if self:haveNextStep() then
|
if self:haveNextStep() then
|
||||||
self.currentStepId = self.currentStepId + 1
|
self.currentStepId = self.currentStepId + 1
|
||||||
local stepData = choregraphyUtils.getStepDatas(self.stepList[self.currentStepId])
|
local stepData = core.datas:parse("choregraphystep", self.stepList[self.currentStepId])
|
||||||
core.debug:print("cbs/choregraphy", "Starting step " .. stepData.name)
|
core.debug:print("cbs/choregraphy", "Starting step " .. stepData.name)
|
||||||
if (stepObjectList[stepData.name] ~= nil and self:checkCondition(stepData.condition)) then
|
if (stepObjectList[stepData.name] ~= nil and self:checkCondition(stepData.condition)) then
|
||||||
self.currentStep = stepObjectList[stepData.name](self, stepData.arguments)
|
self.currentStep = stepObjectList[stepData.name](self, stepData.arguments)
|
||||||
|
@ -58,7 +57,7 @@ function ChoregraphySystem:checkCondition(condition)
|
||||||
end
|
end
|
||||||
|
|
||||||
function ChoregraphySystem:addQTE(action, origin, qteBaseData, blockProcess)
|
function ChoregraphySystem:addQTE(action, origin, qteBaseData, blockProcess)
|
||||||
local qteData = choregraphyUtils.getQteDatas(qteBaseData)
|
local qteData = core.datas:parse("qtesteps", qteBaseData)
|
||||||
if (qteObjectList[qteData.name] ~= nil) then
|
if (qteObjectList[qteData.name] ~= nil) then
|
||||||
core.debug:print("cbs/choregraphy", "Starting qte " .. qteData.name)
|
core.debug:print("cbs/choregraphy", "Starting qte " .. qteData.name)
|
||||||
self.qte.current = qteObjectList[qteData.name](self, qteData.arguments, 0, 0)
|
self.qte.current = qteObjectList[qteData.name](self, qteData.arguments, 0, 0)
|
||||||
|
|
Loading…
Reference in a new issue