landsandboat/scripts/effects/mounted.lua

50 lines
1.2 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.MOUNTED
2021-01-18 12:48:07 -05:00
-----------------------------------
---@type TEffect
local effectObject = {}
effectObject.onEffectGain = function(target, effect)
local mountId = effect:getPower()
-- Retail sends a music change packet (packet ID 0x5F) in both cases.
2018-03-14 18:07:45 -04:00
local animation = xi.animation.NONE
if
mountId == xi.mount.CHOCOBO or
mountId == xi.mount.NOBLE_CHOCOBO
then
target:changeMusic(4, 212)
animation = xi.anim.CHOCOBO
else
target:changeMusic(4, 84)
animation = xi.anim.MOUNT
end
if not target:isInEvent() then
target:setAnimation(animation)
end
2025-11-11 22:59:31 -07:00
-- Chocobo and mounts uncharm current pet
local pet = target:getPet()
if pet ~= nil and pet:isCharmed() then
target:despawnPet()
end
end
2016-01-16 01:26:33 -05:00
effectObject.onEffectTick = function(target, effect)
end
2016-01-16 01:26:33 -05:00
effectObject.onEffectLose = function(target, effect)
if not target:isInEvent() then -- Paranoia safety check
target:setAnimation(xi.anim.NONE)
end
2025-01-08 12:37:59 -07:00
-- Remove CharVars from player participating in chocobo riding game
if target:isPC() then
xi.chocoboGame.dismountChoco(target)
end
end
return effectObject