landsandboat/scripts/effects/debilitation.lua

54 lines
1.2 KiB
Lua
Raw Permalink Normal View History

2016-01-16 01:26:33 -05:00
-----------------------------------
2021-04-01 15:10:15 -04:00
-- xi.effect.DEBILITATION
2016-01-16 01:26:33 -05:00
-----------------------------------
---@type TEffect
local effectObject = {}
2016-01-16 01:26:33 -05:00
local statsBits =
{
2021-04-01 15:10:15 -04:00
xi.mod.STR,
xi.mod.DEX,
xi.mod.VIT,
xi.mod.AGI,
xi.mod.INT,
xi.mod.MND,
xi.mod.CHR,
xi.mod.HPP,
xi.mod.MPP
}
2016-01-16 01:26:33 -05:00
effectObject.onEffectGain = function(target, effect)
local power = effect:getPower()
for statbit, mod in ipairs(statsBits) do
if bit.band(bit.lshift(1, statbit - 1), power) > 0 then
2021-04-01 15:10:15 -04:00
if mod == xi.mod.HPP or mod == xi.mod.MPP then
target:addMod(mod, -40)
else
target:addMod(mod, -30)
end
end
end
target:setStatDebilitation(power)
end
2016-01-16 01:26:33 -05:00
effectObject.onEffectTick = function(target, effect)
end
2016-01-16 01:26:33 -05:00
effectObject.onEffectLose = function(target, effect)
local power = effect:getPower()
for statbit, mod in ipairs(statsBits) do
if bit.band(bit.lshift(1, statbit - 1), power) > 0 then
2021-04-01 15:10:15 -04:00
if mod == xi.mod.HPP or mod == xi.mod.MPP then
target:delMod(mod, -40)
else
target:delMod(mod, -30)
end
end
end
target:setStatDebilitation(0)
end
return effectObject