feat(skillmanager): add an named argument system
This commit is contained in:
parent
7f99e01afd
commit
c59486dbcb
2 changed files with 35 additions and 0 deletions
15
sonic-radiance.love/datas/gamedata/skills/init.lua
Normal file
15
sonic-radiance.love/datas/gamedata/skills/init.lua
Normal 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}},
|
||||
}
|
||||
}
|
|
@ -16,4 +16,24 @@ function SkillManager:skillDataExists(skillname)
|
|||
return (fileinfo ~= nil)
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue