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
|
|
|
-----------------------------------
|
2024-08-24 21:26:29 -04:00
|
|
|
---@type TEffect
|
2022-10-06 17:22:04 +03:00
|
|
|
local effectObject = {}
|
2016-01-16 01:26:33 -05:00
|
|
|
|
2022-12-03 09:20:16 -05:00
|
|
|
local statsBits =
|
2018-08-07 19:19:03 -04:00
|
|
|
{
|
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
|
2018-08-07 19:19:03 -04:00
|
|
|
}
|
2016-01-16 01:26:33 -05:00
|
|
|
|
2022-10-06 17:22:04 +03:00
|
|
|
effectObject.onEffectGain = function(target, effect)
|
2018-08-07 19:36:44 -04:00
|
|
|
local power = effect:getPower()
|
2022-12-03 09:20:16 -05:00
|
|
|
for statbit, mod in ipairs(statsBits) do
|
2016-03-06 01:08:07 -07:00
|
|
|
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
|
2016-03-06 01:08:07 -07:00
|
|
|
target:addMod(mod, -40)
|
|
|
|
|
else
|
|
|
|
|
target:addMod(mod, -30)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
2022-11-22 14:42:58 -05:00
|
|
|
|
2016-03-06 01:08:07 -07:00
|
|
|
target:setStatDebilitation(power)
|
2018-08-07 19:36:44 -04:00
|
|
|
end
|
2016-01-16 01:26:33 -05:00
|
|
|
|
2022-10-06 17:22:04 +03:00
|
|
|
effectObject.onEffectTick = function(target, effect)
|
2018-08-07 19:36:44 -04:00
|
|
|
end
|
2016-01-16 01:26:33 -05:00
|
|
|
|
2022-10-06 17:22:04 +03:00
|
|
|
effectObject.onEffectLose = function(target, effect)
|
2018-08-07 19:36:44 -04:00
|
|
|
local power = effect:getPower()
|
2022-12-03 09:20:16 -05:00
|
|
|
for statbit, mod in ipairs(statsBits) do
|
2016-03-06 01:08:07 -07:00
|
|
|
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
|
2016-03-06 01:08:07 -07:00
|
|
|
target:delMod(mod, -40)
|
|
|
|
|
else
|
|
|
|
|
target:delMod(mod, -30)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
2022-11-22 14:42:58 -05:00
|
|
|
|
2016-03-06 01:08:07 -07:00
|
|
|
target:setStatDebilitation(0)
|
2018-08-07 19:36:44 -04:00
|
|
|
end
|
2021-01-07 03:22:42 -05:00
|
|
|
|
2022-10-06 17:22:04 +03:00
|
|
|
return effectObject
|