sonic-radiance/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/actions/item.lua

29 lines
880 B
Lua
Raw Normal View History

2020-07-20 12:24:26 +02:00
local ActionParent = require "scenes.battlesystem.controllers.fighters.systems.actions.parent"
local ItemAction = ActionParent:extend()
local EffectManager = require "game.loot.effectManager"
2020-07-20 12:24:26 +02:00
2020-08-22 23:10:22 +02:00
function ItemAction:new(fighter, category, item)
2020-07-20 12:24:26 +02:00
ItemAction.super.new(self, fighter)
2020-08-22 23:10:22 +02:00
self.category = category
self.item = item
2020-08-22 23:10:22 +02:00
self.itemdata = game.loot:getItemData(category, item)
self.effectManager = EffectManager()
self.effectManager:getItemData(category, item)
2020-07-20 12:24:26 +02:00
end
function ItemAction:needTarget()
2020-08-22 23:10:22 +02:00
return (not self.itemdata.affectEverybody), (self.category == "wisps")
2020-07-20 12:24:26 +02:00
end
function ItemAction:useItemEffect()
self.effectManager:applyEffectsBattle(self.target)
end
2020-07-20 12:24:26 +02:00
function ItemAction:startAction()
2020-08-22 23:10:22 +02:00
core.debug:print("cbs/action", "Starting item action")
self:loadChoregraphy("useitem")
game.loot:removeItem(self.category, self.item, 1)
2020-07-20 12:24:26 +02:00
end
return ItemAction