landsandboat/scripts/actions/abilities/modus_veritas.lua

46 lines
1.8 KiB
Lua
Raw Permalink Normal View History

-----------------------------------
-- Ability: Modus Veritas
2015-04-24 16:13:06 +08:00
-- Increases damage done by helix spells while lowering spell duration by 50%.
-- Obtained: Scholar Level 65
-- Recast Time: 3:00
-- Duration: Instant
-----------------------------------
---@type TAbility
local abilityObject = {}
abilityObject.onAbilityCheck = function(player, target, ability)
return 0, 0
end
abilityObject.onUseAbility = function(player, target, ability)
2021-04-01 15:10:15 -04:00
local helix = target:getStatusEffect(xi.effect.HELIX)
2022-11-27 18:16:51 +01:00
if helix ~= nil then
local mvPower = helix:getSubPower()
local resist = xi.combat.magicHitRate.calculateResistRate(player, target, 0, xi.skill.ELEMENTAL_MAGIC, 0, xi.element.NONE, 0, 0, 0)
2014-06-08 16:52:16 -06:00
-- Doesn't work against NMs apparently
if mvPower > 0 or resist < 0.25 or target:isNM() then -- Don't let Modus Veritas stack to prevent abuse
2021-04-01 15:10:15 -04:00
ability:setMsg(xi.msg.basic.JA_MISS) --Miss
return 0
else
-- Double power and halve remaining time
2022-11-27 18:16:51 +01:00
local mvMerits = player:getMerit(xi.merit.MODUS_VERITAS_DURATION)
local durationMultiplier = 0.5 + (0.05 * mvMerits)
mvPower = mvPower + 1
2022-11-27 18:16:51 +01:00
local helixPower = helix:getPower() * 2 + (3 * player:getJobPointLevel(xi.jp.MODUS_VERITAS_EFFECT))
2022-11-27 18:16:51 +01:00
local duration = helix:getDuration()
local remaining = math.floor(helix:getTimeRemaining() / 1000) -- from milliseconds
duration = (duration-remaining) + math.floor(remaining * durationMultiplier)
helix:setSubPower(mvPower)
helix:setPower(helixPower)
helix:setDuration(duration * 1000) -- back to milliseconds
end
else
2021-04-01 15:10:15 -04:00
ability:setMsg(xi.msg.basic.JA_NO_EFFECT_2) -- No effect
end
end
2021-01-17 10:31:48 -05:00
return abilityObject