chore: kill game.skills

This commit is contained in:
Kazhnuz 2021-05-16 08:48:05 +02:00
parent e9c9cbb8e3
commit 534517f0f3
8 changed files with 10 additions and 59 deletions

View file

@ -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)

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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