landsandboat/scripts/effects/chr_boost.lua
claywar 7bba1bdc3a
[type] Add type annotations to Effect scripts
Fix delStatusEffect in atma.lua
2024-08-24 21:26:29 -04:00

27 lines
791 B
Lua

-----------------------------------
-- xi.effect.CHR_BOOST
-----------------------------------
---@type TEffect
local effectObject = {}
effectObject.onEffectGain = function(target, effect)
target:addMod(xi.mod.CHR, effect:getPower())
end
effectObject.onEffectTick = function(target, effect)
-- the effect loses Charism of 1 every 3 ticks depending on the source of the boost
local boostCHREffectSize = effect:getPower()
if boostCHREffectSize > 0 then
effect:setPower(boostCHREffectSize - 1)
target:delMod(xi.mod.CHR, 1)
end
end
effectObject.onEffectLose = function(target, effect)
local boostCHREffectSize = effect:getPower()
if boostCHREffectSize > 0 then
target:delMod(xi.mod.CHR, boostCHREffectSize)
end
end
return effectObject