landsandboat/scripts/effects/level_sync.lua
claywar 7bba1bdc3a
[type] Add type annotations to Effect scripts
Fix delStatusEffect in atma.lua
2024-08-24 21:26:29 -04:00

37 lines
1 KiB
Lua

-----------------------------------
-- xi.effect.LEVEL_SYNC
-----------------------------------
---@type TEffect
local effectObject = {}
effectObject.onEffectGain = function(target, effect)
target:levelRestriction(effect:getPower())
if target:getObjType() == xi.objType.PC then
target:clearTrusts()
if xi.settings.map.DESPAWN_JUGPETS_BELOW_MINIMUM_LEVEL then
local pet = target:getPet()
local masterLevel = target:getMainLvl()
if
pet and
pet:getObjType() == xi.objType.PET and
target:hasJugPet() and -- hasJugPet checks m_PBaseEntity->PPet's check type, not the target's pet type.
masterLevel < pet:getMinimumPetLevel()
then
target:despawnPet()
end
end
end
end
effectObject.onEffectTick = function(target, effect)
end
effectObject.onEffectLose = function(target, effect)
target:levelRestriction(0)
target:disableLevelSync()
end
return effectObject