landsandboat/scripts/effects/mounted.lua
2026-07-22 10:18:49 +02:00

52 lines
1.3 KiB
Lua

-----------------------------------
-- xi.effect.MOUNTED
-----------------------------------
---@type TEffect
local effectObject = {}
local attohwaChasmGlobal = require('scripts/zones/Attohwa_Chasm/globals')
effectObject.onEffectGain = function(target, effect)
local mountId = effect:getPower()
-- Retail sends a music change packet (packet ID 0x5F) in both cases.
local animation = xi.animation.NONE
if
mountId == xi.mount.CHOCOBO or
mountId == xi.mount.NOBLE_CHOCOBO
then
target:changeMusic(4, 212)
animation = xi.animation.CHOCOBO
else
target:changeMusic(4, 84)
animation = xi.animation.MOUNT
end
if not target:isInEvent() then
target:setAnimation(animation)
end
-- Chocobo and mounts uncharm current pet
local pet = target:getPet()
if pet ~= nil and pet:isCharmed() then
target:despawnPet()
end
attohwaChasmGlobal.removeMimeoKIs(target)
end
effectObject.onEffectTick = function(target, effect)
end
effectObject.onEffectLose = function(target, effect)
if not target:isInEvent() then -- Paranoia safety check
target:setAnimation(xi.animation.NONE)
end
-- Remove CharVars from player participating in chocobo riding game
if target:isPC() then
xi.chocoboGame.dismountChoco(target)
end
end
return effectObject