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
