2020-09-19 11:10:20 +02:00
|
|
|
local ParentEffect = require "game.loot.effects.parent"
|
|
|
|
local StatusEffect = ParentEffect:extend()
|
|
|
|
|
2021-03-12 21:51:10 +01:00
|
|
|
function StatusEffect:new(effect, character, duration)
|
2020-09-19 11:10:20 +02:00
|
|
|
self.effect = effect
|
|
|
|
self.character = character
|
2021-03-12 21:51:10 +01:00
|
|
|
self.duration = duration or -1
|
2020-09-19 11:10:20 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
function StatusEffect:applyEffect()
|
2021-03-12 21:51:10 +01:00
|
|
|
if (self.effect.set) then
|
|
|
|
self:addStatut()
|
|
|
|
else
|
|
|
|
self:removeStatut()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function StatusEffect:addStatut()
|
|
|
|
self.character:addStatut(self.effect.status, self.duration)
|
|
|
|
end
|
2020-09-19 11:10:20 +02:00
|
|
|
|
2021-03-12 21:51:10 +01:00
|
|
|
function StatusEffect:removeStatut()
|
|
|
|
self.character:removeStatut(self.effect.status)
|
2020-09-19 11:10:20 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
function StatusEffect:getText()
|
|
|
|
local returnString = ""
|
|
|
|
if (self.effect.set) then
|
|
|
|
returnString = returnString .. "Give "
|
|
|
|
else
|
|
|
|
returnString = returnString .. "Remove "
|
|
|
|
end
|
|
|
|
|
|
|
|
if (self.effect.status == "allNegative") then
|
|
|
|
returnString = returnString .. "all negative effects"
|
|
|
|
else
|
|
|
|
returnString = returnString .. self.effect.status .. " " .. "effect"
|
|
|
|
end
|
|
|
|
|
|
|
|
return returnString
|
|
|
|
end
|
|
|
|
|
|
|
|
return StatusEffect
|