diff --git a/sonic-radiance.love/datas/gamedata/skills/attack.lua b/sonic-radiance.love/datas/gamedata/skills/attack.lua index 021eee9..439cec8 100644 --- a/sonic-radiance.love/datas/gamedata/skills/attack.lua +++ b/sonic-radiance.love/datas/gamedata/skills/attack.lua @@ -8,10 +8,8 @@ return { cost = 00, -- the pp cost of the attack. Will be ignored if it's set -- as character default attack - target = nil, -- which area can be selected as a target with the cursor. - -- if not nil : {ox, oy, shape, size, affectedByDirection} - - targetNumber = 1, -- how many ennemy you can target with the attack. + needTarget = true, + targetNumber = 1, -- 0 for targeting all ennemies effectArea = {1, 0, "point", 1, true}, -- which area is affected by the attack -- if not nil : {ox, oy, shape, size, affectedByDirection} diff --git a/sonic-radiance.love/datas/gamedata/skills/spinattack.lua b/sonic-radiance.love/datas/gamedata/skills/spinattack.lua index f70ae50..441500d 100644 --- a/sonic-radiance.love/datas/gamedata/skills/spinattack.lua +++ b/sonic-radiance.love/datas/gamedata/skills/spinattack.lua @@ -1,8 +1,8 @@ return { name = "spinattack", cost = 05, - target = nil, -- No targeting capacity - effectArea = {0, 0, "line", 5, true}, -- which area is affected by the attack + targetNumber = 1, -- 0 for targeting all ennemies + targetEnnemies = true, choregraphy = { {"setAnimation", "none", "spindash", false}, {'playSFX', "none", 'spincharge'}, diff --git a/sonic-radiance.love/datas/gamedata/skills/spinjump.lua b/sonic-radiance.love/datas/gamedata/skills/spinjump.lua index e0518cd..2389708 100644 --- a/sonic-radiance.love/datas/gamedata/skills/spinjump.lua +++ b/sonic-radiance.love/datas/gamedata/skills/spinjump.lua @@ -4,17 +4,11 @@ -- Also serve as a tutoriel for how to create a file attack and choregraphy return { - name = "spinjump", -- unused for this attack, but still usefull sometimes - cost = 03, -- the pp cost of the attack. Will be ignored if it's set - -- as character default attack + name = "spinjump", + cost = 03, - target = {2, -1, "square", 3, true}, -- which area can be selected as a target with the cursor. - -- if not nil : {ox, oy, shape, size, affectedByDirection} - - targetNumber = 1, -- how many ennemy you can target with the attack. - - effectArea = {1, 0, "point", 1, true}, -- which area is affected by the attack - -- if not nil : {ox, oy, shape, size, affectedByDirection} + targetNumber = 1, -- 0 for targeting all ennemies + targetEnnemies = true, choregraphy = { -- the main attack choregraphy {"setAnimation", "none", "spinjump", false}, diff --git a/sonic-radiance.love/scenes/battlesystem/controllers/fighters/character.lua b/sonic-radiance.love/scenes/battlesystem/controllers/fighters/character.lua index dc8d964..ce7616b 100644 --- a/sonic-radiance.love/scenes/battlesystem/controllers/fighters/character.lua +++ b/sonic-radiance.love/scenes/battlesystem/controllers/fighters/character.lua @@ -64,6 +64,16 @@ function HeroFighter:doBasicAction(action) self:verifyTargets() end +function HeroFighter:useItem(item) + self.action = actionList["item"](self, item) + self:verifyTargets() +end + +function HeroFighter:useSkill(skill) + self.action = actionList["skill"](self, skill) + self:verifyTargets() +end + function HeroFighter:verifyTargets() local needTarget, targetEnnemies = self.action:needTarget() diff --git a/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/actions/init.lua b/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/actions/init.lua index daa2ac7..1bc71ec 100644 --- a/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/actions/init.lua +++ b/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/actions/init.lua @@ -1,8 +1,8 @@ local actions = {} actions.attack = require "scenes.battlesystem.controllers.fighters.systems.actions.attack" ---actions.skill = require "scenes.battlesystem.controllers.fighters.systems.actions.skill" ---actions.item = require "scenes.battlesystem.controllers.fighters.systems.actions.item" +actions.skill = require "scenes.battlesystem.controllers.fighters.systems.actions.skill" +actions.item = require "scenes.battlesystem.controllers.fighters.systems.actions.item" actions.defend = require "scenes.battlesystem.controllers.fighters.systems.actions.defend" actions.flee = require "scenes.battlesystem.controllers.fighters.systems.actions.flee" diff --git a/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/actions/item.lua b/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/actions/item.lua new file mode 100644 index 0000000..bd6f7dc --- /dev/null +++ b/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/actions/item.lua @@ -0,0 +1,17 @@ +local ActionParent = require "scenes.battlesystem.controllers.fighters.systems.actions.parent" +local ItemAction = ActionParent:extend() + +function ItemAction:new(fighter, item) + ItemAction.super.new(self, fighter) +end + +function ItemAction:needTarget() + return false, false +end + +function ItemAction:startAction() + core.debug:print("cbs/action", "Starting flee action") + self:finishAction() +end + +return ItemAction 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 new file mode 100644 index 0000000..5cbfce8 --- /dev/null +++ b/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/actions/skill.lua @@ -0,0 +1,18 @@ +local ActionParent = require "scenes.battlesystem.controllers.fighters.systems.actions.parent" +local SkillAction = ActionParent:extend() + +function SkillAction:new(fighter, skill) + self.data = game.skills:getSkillData(skill) + SkillAction.super.new(self, fighter) +end + +function SkillAction:needTarget() + return (self.data.targetNumber == 1), self.data.targetEnnemies +end + +function SkillAction:startAction() + core.debug:print("cbs/action", "Starting flee action") + self:finishAction() +end + +return SkillAction diff --git a/sonic-radiance.love/scenes/battlesystem/menu.lua b/sonic-radiance.love/scenes/battlesystem/menu.lua index 44ebe20..21b0996 100644 --- a/sonic-radiance.love/scenes/battlesystem/menu.lua +++ b/sonic-radiance.love/scenes/battlesystem/menu.lua @@ -276,8 +276,7 @@ function SkillWidget:sendCharacterData() if self.skilldata ~= nil then self.assets.sfx["mSelect"]:play() - self.character:doNothing() - --self.character:useSkill(self.skillname, self.character.x, self.character.y) + self.character:useSkill(self.skillname) else core.debug:warning("cbs/menu", "skill " .. self.skillname .. " doesn't exist") self.character:doNothing()