sonic-radiance/sonic-radiance.love/game/skills.lua

40 lines
1 KiB
Lua
Raw Permalink Normal View History

local SkillManager = Object:extend()
function SkillManager:new(controller)
self.controller = controller
end
function SkillManager:getSkillData(skillname)
if self:skillDataExists(skillname) then
return require("datas.gamedata.skills." .. skillname )
end
end
function SkillManager:skillDataExists(skillname)
local dir = "datas/gamedata/skills/" .. skillname .. ".lua"
local fileinfo = love.filesystem.getInfo(dir)
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