From 534517f0f339994324508dcaa8b613cb33575d20 Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Sun, 16 May 2021 08:48:05 +0200 Subject: [PATCH] chore: kill game.skills --- sonic-radiance.love/game/init.lua | 2 - sonic-radiance.love/game/skills.lua | 47 ------------------- .../fighters/systems/actions/parent.lua | 2 +- .../fighters/systems/actions/skill.lua | 2 +- .../fighters/systems/ennemyaction.lua | 2 +- .../scenes/battlesystem/menus/widgets.lua | 2 +- .../scenes/debug/viewers/choregraphy/init.lua | 10 ++-- .../screens/mainmenu/character/skillpage.lua | 2 +- 8 files changed, 10 insertions(+), 59 deletions(-) delete mode 100644 sonic-radiance.love/game/skills.lua diff --git a/sonic-radiance.love/game/init.lua b/sonic-radiance.love/game/init.lua index 3c62c6a..a4fae2a 100644 --- a/sonic-radiance.love/game/init.lua +++ b/sonic-radiance.love/game/init.lua @@ -28,7 +28,6 @@ local Serializer = require "birb.classes.serializable.serializer" local Game = Serializer:extend() local Characters = require "game.characters" local Ennemies = require "game.ennemies" -local Skills = require "game.skills" local Loot = require "game.loot" local CBSCore = require "game.battle" local Difficulty = require "game.difficulty" @@ -92,7 +91,6 @@ function Game:reset() self.characters = Characters(self) self.ennemies = Ennemies(self) - self.skills = Skills(self) self.loot = Loot(self) self.cbs = CBSCore(self) self.difficulty = Difficulty(self) diff --git a/sonic-radiance.love/game/skills.lua b/sonic-radiance.love/game/skills.lua deleted file mode 100644 index 4af25ca..0000000 --- a/sonic-radiance.love/game/skills.lua +++ /dev/null @@ -1,47 +0,0 @@ -local SkillManager = Object:extend() - -function SkillManager:new(controller) - self.controller = controller -end - -function SkillManager:getSkillData(skillname) - if core.datas:exists("skills", skillname) then - return core.datas:get("skills", skillname) - end -end - -function SkillManager:skillDataExists(skillname) - return core.datas:exists("skills", skillname) -end - -function SkillManager:getEnnemySkillData(skillname) - if core.datas:exists("badskills", skillname) then - return core.datas:get("badskills", skillname) - end -end - -function SkillManager:ennemySkillDataExists(skillname) - return core.datas:exists("badskills", skillname) -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 diff --git a/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/actions/parent.lua b/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/actions/parent.lua index 467b7ac..3371346 100644 --- a/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/actions/parent.lua +++ b/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/actions/parent.lua @@ -17,7 +17,7 @@ function ActionParent:update(dt) end function ActionParent:loadChoregraphy(skillname) - local skill = game.skills:getSkillData(skillname) + local skill = core.datas:get("skills", skillname) self.choregraphy = ChoregraphySystem(self, skill.choregraphy) end diff --git a/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/actions/skill.lua b/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/actions/skill.lua index e7a4a08..b0dfcff 100644 --- a/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/actions/skill.lua +++ b/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/actions/skill.lua @@ -2,7 +2,7 @@ local ActionParent = require "scenes.battlesystem.controllers.fighters.systems.a local SkillAction = ActionParent:extend() function SkillAction:new(fighter, skill) - self.data = game.skills:getSkillData(skill) + self.data = core.datas:get("skills", skill) SkillAction.super.new(self, fighter) end diff --git a/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/ennemyaction.lua b/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/ennemyaction.lua index 72e343d..e06fb8c 100644 --- a/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/ennemyaction.lua +++ b/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/ennemyaction.lua @@ -2,7 +2,7 @@ local ActionParent = require "scenes.battlesystem.controllers.fighters.systems.a local EnnemyAction = ActionParent:extend() function EnnemyAction:new(fighter, skill) - self.data = game.skills:getEnnemySkillData(skill) + self.data = core.datas:get("badskills", skill) EnnemyAction.super.new(self, fighter) end diff --git a/sonic-radiance.love/scenes/battlesystem/menus/widgets.lua b/sonic-radiance.love/scenes/battlesystem/menus/widgets.lua index c39975a..4ec7d51 100644 --- a/sonic-radiance.love/scenes/battlesystem/menus/widgets.lua +++ b/sonic-radiance.love/scenes/battlesystem/menus/widgets.lua @@ -96,7 +96,7 @@ function widgets.SkillWidget:new(character, menu_name, skill) self.skillname = skill local label2 = "00" - self.skilldata = game.skills:getSkillData(skill) + self.skilldata = core.datas:get("skills", skill) if self.skilldata ~= nil then label2 = self.skilldata.cost or 0 diff --git a/sonic-radiance.love/scenes/debug/viewers/choregraphy/init.lua b/sonic-radiance.love/scenes/debug/viewers/choregraphy/init.lua index 133afe7..39262a5 100644 --- a/sonic-radiance.love/scenes/debug/viewers/choregraphy/init.lua +++ b/sonic-radiance.love/scenes/debug/viewers/choregraphy/init.lua @@ -35,7 +35,7 @@ function ChoregraphyViewer:buildCharacterMenu() self:addSubMenu("characters", "MainMenu", "Rivals") for k, character in pairs(game.characters.list) do self:addSubMenu(k, "characters", character.fullname) - menu.HeroChoregraphyWidget(self, k, game.skills:getSkillData("attack")) + menu.HeroChoregraphyWidget(self, k, core.datas:get("skills", "attack")) self:buildSkillMenu(k) end end @@ -51,8 +51,8 @@ function ChoregraphyViewer:buildEnnemySkillMenu(category, ennemy) self:addSubMenu(ennemy, category, ennemy) local data = core.datas:get("ennemies", ennemy) for j,skillName in ipairs(data.skills) do - if (game.skills:ennemySkillDataExists(skillName)) then - menu.EnnemyChoregraphyWidget(self, category, ennemy, game.skills:getEnnemySkillData(skillName)) + if (core.datas:exists("badskills", skillName)) then + menu.EnnemyChoregraphyWidget(self, category, ennemy, core.datas:get("badskills", skillName)) end end end @@ -64,8 +64,8 @@ function ChoregraphyViewer:buildSkillMenu(charName) local skillName = skill[1] if (skillTreated[skillName] ~= true) then skillTreated[skillName] = true - if (game.skills:skillDataExists(skillName)) then - menu.HeroChoregraphyWidget(self, charName, game.skills:getSkillData(skillName)) + if (core.datas:exists("skills", skillName)) then + menu.HeroChoregraphyWidget(self, charName, core.datas:get("skills", skillName)) end end end diff --git a/sonic-radiance.love/scenes/overworld/screens/mainmenu/character/skillpage.lua b/sonic-radiance.love/scenes/overworld/screens/mainmenu/character/skillpage.lua index 17220ec..db4681c 100644 --- a/sonic-radiance.love/scenes/overworld/screens/mainmenu/character/skillpage.lua +++ b/sonic-radiance.love/scenes/overworld/screens/mainmenu/character/skillpage.lua @@ -60,7 +60,7 @@ end function SkillWidget:new(page, skill) self.page = page - self.skillData = game.skills:getSkillData(skill) + self.skillData = core.datas:get("skills", skill) SkillWidget.super.new(self, self.page.view.scene, "equip", self.skillData.fullname, utils.math.numberToString(self.skillData.cost, 2)) end