landsandboat/scripts/effects/weakness.lua
WinterSolstice8 dd12553960 Audit HP/MP calculations (incl curse, weakness, hp%, food)
Add new mods for weakness/curse as they are not additive to hpp/mpp
Move everything to correct places based on retail testing
Move HP/MP traits to "base" HP/MP via new mods
2024-11-26 15:11:37 -08:00

37 lines
1.1 KiB
Lua

-----------------------------------
-- xi.effect.WEAKNESS
-----------------------------------
---@type TEffect
local effectObject = {}
effectObject.onEffectGain = function(target, effect)
--reduce HP and MP by the power amount. Add 100% slow
--NOTE: The power amount dictates the amount to REDUCE MAX VALUES BY. E.g. Power=75 means 'reduce max hp/mp by 75%'
target:addMod(xi.mod.WEAKNESS_PCT, -75)
-- 100% Slow -- FIXME: Weakness should probably be its own source of slow
target:addMod(xi.mod.HASTE_MAGIC, -10000)
if effect:getPower() > 1 then
-- handle double weakness
target:addMod(xi.mod.RACC, -999)
target:addMod(xi.mod.MATT, -999)
end
end
effectObject.onEffectTick = function(target, effect)
end
effectObject.onEffectLose = function(target, effect)
--restore HP and MP to its former state. Remove 100% slow
target:delMod(xi.mod.WEAKNESS_PCT, -75)
target:delMod(xi.mod.HASTE_MAGIC, -10000)
if effect:getPower() > 1 then
-- handle double weakness
target:delMod(xi.mod.RACC, -999)
target:delMod(xi.mod.MATT, -999)
end
end
return effectObject