landsandboat/scripts/actions/abilities/drain_samba.lua
2026-02-20 18:42:33 -07:00

38 lines
1.3 KiB
Lua

-----------------------------------
-- Ability: Drain Samba
-- Inflicts the next target you strike with Drain daze, allowing all those engaged in battle with it to drain its HP.
-- Obtained: Dancer Level 5
-- TP Required: 10%
-- Recast Time: 1:00
-- Duration: 2:00
-----------------------------------
---@type TAbility
local abilityObject = {}
abilityObject.onAbilityCheck = function(player, target, ability)
if player:hasStatusEffect(xi.effect.FAN_DANCE) then
return xi.msg.basic.UNABLE_TO_USE_JA2, 0
elseif player:getTP() < 100 then
return xi.msg.basic.NOT_ENOUGH_TP, 0
end
return 0, 0
end
abilityObject.onUseAbility = function(player, target, ability)
-- Only remove TP if the player doesn't have Trance.
if not player:hasStatusEffect(xi.effect.TRANCE) then
player:delTP(100)
end
local duration = 120 + player:getMod(xi.mod.SAMBA_DURATION) + (player:getJobPointLevel(xi.jp.SAMBA_DURATION) * 2)
duration = duration * (100 + player:getMod(xi.mod.SAMBA_PDURATION)) / 100
player:delStatusEffect(xi.effect.HASTE_SAMBA)
player:delStatusEffect(xi.effect.ASPIR_SAMBA)
player:addStatusEffect(xi.effect.DRAIN_SAMBA, { power = 1, duration = duration, origin = player })
return xi.effect.DRAIN_SAMBA
end
return abilityObject