sonic-radiance/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/actions/item.lua
2021-04-11 15:18:47 +02:00

28 lines
880 B
Lua

local ActionParent = require "scenes.battlesystem.controllers.fighters.systems.actions.parent"
local ItemAction = ActionParent:extend()
local EffectManager = require "game.loot.effectManager"
function ItemAction:new(fighter, category, item)
ItemAction.super.new(self, fighter)
self.category = category
self.item = item
self.itemdata = game.loot:getItemData(category, item)
self.effectManager = EffectManager()
self.effectManager:getItemData(category, item)
end
function ItemAction:needTarget()
return (not self.itemdata.affectEverybody), (self.category == "wisps")
end
function ItemAction:useItemEffect()
self.effectManager:applyEffectsBattle(self.target)
end
function ItemAction:startAction()
core.debug:print("cbs/action", "Starting item action")
self:loadChoregraphy("useitem")
game.loot:removeItem(self.category, self.item, 1)
end
return ItemAction