From c59486dbcb6fc3e2fd7b4d258240020d194a8d5c Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Sun, 25 Aug 2019 15:53:56 +0200 Subject: [PATCH] feat(skillmanager): add an named argument system --- .../datas/gamedata/skills/init.lua | 15 ++++++++++++++ sonic-radiance.love/game/skills.lua | 20 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 sonic-radiance.love/datas/gamedata/skills/init.lua diff --git a/sonic-radiance.love/datas/gamedata/skills/init.lua b/sonic-radiance.love/datas/gamedata/skills/init.lua new file mode 100644 index 0000000..cd3e25b --- /dev/null +++ b/sonic-radiance.love/datas/gamedata/skills/init.lua @@ -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}}, + } +} diff --git a/sonic-radiance.love/game/skills.lua b/sonic-radiance.love/game/skills.lua index bdbc345..39383ee 100644 --- a/sonic-radiance.love/game/skills.lua +++ b/sonic-radiance.love/game/skills.lua @@ -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