sonic-radiance/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/actions/item.lua
2021-03-12 21:14:17 +01:00

29 lines
894 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)
print(item)
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