landsandboat/scripts/effects/dex_boost.lua

28 lines
793 B
Lua
Raw Permalink Normal View History

2016-01-16 01:26:33 -05:00
-----------------------------------
2021-04-01 15:10:15 -04:00
-- xi.effect.DEX_BOOST
2016-01-16 01:26:33 -05:00
-----------------------------------
---@type TEffect
local effectObject = {}
2016-01-16 01:26:33 -05:00
effectObject.onEffectGain = function(target, effect)
2021-04-01 15:10:15 -04:00
target:addMod(xi.mod.DEX, effect:getPower())
end
2016-01-16 01:26:33 -05:00
effectObject.onEffectTick = function(target, effect)
2016-01-16 01:26:33 -05:00
-- the effect loses dexterity of 1 every 3 ticks depending on the source of the boost
local boostDEXEffectSize = effect:getPower()
if boostDEXEffectSize > 0 then
effect:setPower(boostDEXEffectSize - 1)
2021-04-01 15:10:15 -04:00
target:delMod(xi.mod.DEX, 1)
2016-01-16 01:26:33 -05:00
end
end
2016-01-16 01:26:33 -05:00
effectObject.onEffectLose = function(target, effect)
local boostDEXEffectSize = effect:getPower()
if boostDEXEffectSize > 0 then
target:delMod(xi.mod.DEX, boostDEXEffectSize)
2016-01-16 01:26:33 -05:00
end
end
return effectObject