diff --git a/sonic-radiance.love/datas/gamedata/skills/useitem.lua b/sonic-radiance.love/datas/gamedata/skills/useitem.lua new file mode 100644 index 0000000..6106f71 --- /dev/null +++ b/sonic-radiance.love/datas/gamedata/skills/useitem.lua @@ -0,0 +1,30 @@ +-- A basic file describing the basic attack, in order to make it customizable one +-- day ? + +-- Also serve as a tutoriel for how to create a file attack and choregraphy + +return { + name = "item", -- unused for this attack, but still usefull sometimes + cost = 00, -- the pp cost of the attack. Will be ignored if it's set + -- as character default attack + + needTarget = true, + targetNumber = 1, -- 0 for targeting all ennemies + + choregraphy = { -- the main attack choregraphy + {"setAnimation", "none", "walk", false}, + {'goTo', "none", "start", 2, 0, 0.5, true}, + + {'setAnimation', "none", 'idle', false}, + {'wait', "none", 0.4}, + {'useItemEffect', "none"}, + + {"setAnimation", "none", "walk", false}, + {'goTo', "none", "start", 0, 0, 0.5, true}, + {'setAnimation', "none", 'idle', false}, + }, + + onContact = { -- if the attack move and touch multiple ennemies, you can add + -- specific effect when you touch the ennemy. + }, +} diff --git a/sonic-radiance.love/game/utils/choregraphy/arguments.lua b/sonic-radiance.love/game/utils/choregraphy/arguments.lua index a400c51..2b47e9d 100644 --- a/sonic-radiance.love/game/utils/choregraphy/arguments.lua +++ b/sonic-radiance.love/game/utils/choregraphy/arguments.lua @@ -9,7 +9,8 @@ return { ["jumpTo"] = {"origin", "x", "y", "duration", "blockProcess"}, ["jumpBack"] = {"duration", "blockProcess"}, ["waitActorFinished"] = {"waitFor"}, - ["addQTE"] = {"qteData", "origin", "blockProcess"} + ["addQTE"] = {"qteData", "origin", "blockProcess"}, + ["useItemEffect"] = {}, --[name] = {args}, } diff --git a/sonic-radiance.love/scenes/battlesystem/controllers/fighters/character.lua b/sonic-radiance.love/scenes/battlesystem/controllers/fighters/character.lua index 15d77fc..ed1d374 100644 --- a/sonic-radiance.love/scenes/battlesystem/controllers/fighters/character.lua +++ b/sonic-radiance.love/scenes/battlesystem/controllers/fighters/character.lua @@ -63,8 +63,8 @@ function HeroFighter:doBasicAction(action) self:verifyTargets() end -function HeroFighter:useItem(item) - self.action = actionList["item"](self, item) +function HeroFighter:useItem(category, item) + self.action = actionList["item"](self, category, item) self:verifyTargets() end 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 index bd6f7dc..fcffdee 100644 --- a/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/actions/item.lua +++ b/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/actions/item.lua @@ -1,17 +1,20 @@ local ActionParent = require "scenes.battlesystem.controllers.fighters.systems.actions.parent" local ItemAction = ActionParent:extend() -function ItemAction:new(fighter, item) +function ItemAction:new(fighter, category, item) ItemAction.super.new(self, fighter) + print(item) + self.category = category + self.itemdata = game.loot:getItemData(category, item) end function ItemAction:needTarget() - return false, false + return (not self.itemdata.affectEverybody), (self.category == "wisps") end function ItemAction:startAction() - core.debug:print("cbs/action", "Starting flee action") - self:finishAction() + core.debug:print("cbs/action", "Starting item action") + self:loadChoregraphy("useitem") end return ItemAction diff --git a/sonic-radiance.love/scenes/battlesystem/menus/widgets.lua b/sonic-radiance.love/scenes/battlesystem/menus/widgets.lua index 186ef3a..cf69b9d 100644 --- a/sonic-radiance.love/scenes/battlesystem/menus/widgets.lua +++ b/sonic-radiance.love/scenes/battlesystem/menus/widgets.lua @@ -124,6 +124,7 @@ end -- A widget to handle items function widgets.ItemWidget:new(character, menu_name, item) + self.category = menu_name self.itemname = item local label2 = "00" @@ -136,8 +137,8 @@ function widgets.ItemWidget:new(character, menu_name, item) end function widgets.ItemWidget:sendCharacterData() - self.character:doNothing() - self.assets.sfx["mError"]:play() + self.character:useItem(self.category, self.itemname) + self.assets.sfx["mBeep"]:play() end