landsandboat/scripts/effects/weakness.lua

38 lines
1.1 KiB
Lua
Raw Permalink Normal View History

2021-01-18 12:48:07 -05:00
-----------------------------------
2021-04-01 15:10:15 -04:00
-- xi.effect.WEAKNESS
2021-01-18 12:48:07 -05:00
-----------------------------------
---@type TEffect
local effectObject = {}
effectObject.onEffectGain = function(target, effect)
2016-01-16 01:26:33 -05:00
--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)
2016-01-16 01:26:33 -05:00
-- 100% Slow -- FIXME: Weakness should probably be its own source of slow
2021-04-01 15:10:15 -04:00
target:addMod(xi.mod.HASTE_MAGIC, -10000)
2016-01-16 01:26:33 -05:00
if effect:getPower() > 1 then
2016-01-16 01:26:33 -05:00
-- handle double weakness
2021-04-01 15:10:15 -04:00
target:addMod(xi.mod.RACC, -999)
target:addMod(xi.mod.MATT, -999)
2016-01-16 01:26:33 -05:00
end
2018-08-10 23:55:10 -06:00
end
2016-01-16 01:26:33 -05:00
effectObject.onEffectTick = function(target, effect)
2018-08-10 23:55:10 -06:00
end
2016-01-16 01:26:33 -05:00
effectObject.onEffectLose = function(target, effect)
2016-01-16 01:26:33 -05:00
--restore HP and MP to its former state. Remove 100% slow
target:delMod(xi.mod.WEAKNESS_PCT, -75)
2021-04-01 15:10:15 -04:00
target:delMod(xi.mod.HASTE_MAGIC, -10000)
2016-01-16 01:26:33 -05:00
if effect:getPower() > 1 then
2016-01-16 01:26:33 -05:00
-- handle double weakness
2021-04-01 15:10:15 -04:00
target:delMod(xi.mod.RACC, -999)
target:delMod(xi.mod.MATT, -999)
2016-01-16 01:26:33 -05:00
end
2018-08-10 23:55:10 -06:00
end
return effectObject