feat(skillmanager): add an named argument system

This commit is contained in:
Kazhnuz 2019-08-25 15:53:56 +02:00
parent 7f99e01afd
commit c59486dbcb
2 changed files with 35 additions and 0 deletions

View file

@ -0,0 +1,15 @@
return {
actions = {
["wait"] = {"wait", {"duration"}},
["addGFX"] = {"addGFX", {'sprite', "dx", "dy", "affectedByDirection", 'blockProcess'}},
["playSFX"] = {"playSFX", {"sfx"}},
["sendDamage"] = {"sendDamage", {"power", "accuracy", "isSpecial", "isAerial"}},
["sendDamageFromPos"] = {"sendDamageToPoint", {"dx", "dy", "power", "accuracy", "isSpecial", "isAerial", "affectedByDirection"}},
["sendDamageFromCursor"] = {"sendDamageToPoint", {"dx", "dy", "power", "accuracy", "isSpecial", "isAerial", "affectedByDirection"}},
["dashForward"] = {"dashForward", {"speed", "blockProcess"}},
["setAnimation"] = {"setAnimation", {"animation", "blockProcess"}},
["jumpBack"] = {"jump", {"blockProcess"}},
["jumpToCursor"] = {"jump", {"blockProcess"}},
--[name] = {type, {args}},
}
}

View file

@ -16,4 +16,24 @@ function SkillManager:skillDataExists(skillname)
return (fileinfo ~= nil) return (fileinfo ~= nil)
end end
function SkillManager:getActionArguments(choregraphyAction)
local choregraphyData = require "datas.gamedata.skills"
local args = {}
args.name = choregraphyAction[1]
args.condition = choregraphyAction[2]
local actionData = choregraphyData.actions[args.name]
if actionData ~= nil then
args.type = actionData[1]
local argumentList = actionData[2]
for i, argData in ipairs(choregraphyAction) do
if i > 2 then
local argName = argumentList[i-2] or ""
args[argName] = argData
end
end
end
return args
end
return SkillManager return SkillManager