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

87 lines
3.5 KiB
Lua

-----------------------------------
-- Ability: Fire Shot
-- Consumes a Fire Card to enhance fire-based debuffs. Deals fire-based magic damage
-- Burn effect: Enhanced DoT and INT-
-----------------------------------
---@type TAbility
local abilityObject = {}
abilityObject.onAbilityCheck = function(player, target, ability)
--ranged weapon/ammo: You do not have an appropriate ranged weapon equipped.
--no card: <name> cannot perform that action.
if
player:getWeaponSkillType(xi.slot.RANGED) ~= xi.skill.MARKSMANSHIP or
player:getWeaponSkillType(xi.slot.AMMO) ~= xi.skill.MARKSMANSHIP
then
return 216, 0
end
if
player:hasItem(xi.item.FIRE_CARD, 0) or
player:hasItem(xi.item.TRUMP_CARD, 0)
then
return 0, 0
else
return 71, 0
end
end
abilityObject.onUseAbility = function(player, target, ability, action)
action:setRecast(math.max(0, action:getRecast() - player:getMod(xi.mod.QUICK_DRAW_RECAST)))
local params = {}
params.includemab = true
local dmg = (2 * (player:getRangedDmg() + player:getAmmoDmg()) + player:getMod(xi.mod.QUICK_DRAW_DMG)) * (1 + player:getMod(xi.mod.QUICK_DRAW_DMG_PERCENT) / 100)
dmg = dmg + 2 * player:getJobPointLevel(xi.jp.QUICK_DRAW_EFFECT)
dmg = addBonusesAbility(player, xi.element.FIRE, target, dmg, params)
local bonusAcc = player:getStat(xi.mod.AGI) / 2 + player:getMerit(xi.merit.QUICK_DRAW_ACCURACY) + player:getMod(xi.mod.QUICK_DRAW_MACC)
dmg = math.floor(dmg * xi.combat.magicHitRate.calculateResistRate(player, target, 0, 0, 0, xi.element.FIRE, 0, 0, bonusAcc))
dmg = math.floor(dmg * xi.spells.damage.calculateAbsorption(target, xi.element.FIRE, false))
dmg = math.floor(dmg * xi.spells.damage.calculateNullification(target, xi.element.FIRE, false, false))
params.targetTPMult = 0 -- Quick Draw does not feed TP
dmg = xi.ability.takeDamage(target, player, params, true, dmg, xi.attackType.MAGICAL, xi.damageType.FIRE, xi.slot.RANGED, 1, 0, 0, 0, action, nil)
if dmg > 0 then
local effects = {}
local burn = target:getStatusEffect(xi.effect.BURN)
if burn ~= nil then
table.insert(effects, burn)
end
local threnody = target:getStatusEffect(xi.effect.THRENODY)
if threnody ~= nil and threnody:getSubPower() == xi.mod.ICE_MEVA then
table.insert(effects, threnody)
end
if #effects > 0 then
local effect = effects[math.random(1, #effects)]
local duration = effect:getDuration()
local startTime = effect:getStartTime()
local tick = effect:getTick()
local power = effect:getPower()
local subpower = effect:getSubPower()
local tier = effect:getTier()
local effectId = effect:getEffectType()
local subId = effect:getSubType()
power = power * 1.2
target:delStatusEffectSilent(effectId)
target:addStatusEffect(effectId, { power = power, duration = duration, origin = player, tick = tick, subType = subId, subPower = subpower, tier = tier })
local newEffect = target:getStatusEffect(effectId)
if newEffect then
newEffect:setStartTime(startTime)
end
end
end
local _ = player:delItem(xi.item.FIRE_CARD, 1) or player:delItem(xi.item.TRUMP_CARD, 1)
target:updateClaim(player)
return dmg
end
return abilityObject