44 lines
1.6 KiB
Lua
44 lines
1.6 KiB
Lua
-----------------------------------
|
|
-- Ability: Modus Veritas
|
|
-- 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)
|
|
local helix = target:getStatusEffect(xi.effect.HELIX)
|
|
if not helix then
|
|
ability:setMsg(xi.msg.basic.JA_NO_EFFECT_2) -- No effect
|
|
return 0
|
|
end
|
|
|
|
local mvPower = helix:getSubPower()
|
|
local params = { skillType = xi.skill.ELEMENTAL_MAGIC }
|
|
local resist = xi.combat.magicHitRate.calculateResistRate(player, target, params)
|
|
|
|
-- 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
|
|
ability:setMsg(xi.msg.basic.JA_MISS) --Miss
|
|
return 0
|
|
end
|
|
|
|
-- Double power and halve remaining time
|
|
local durationMultiplier = 0.5 + 0.05 * player:getMerit(xi.merit.MODUS_VERITAS_DURATION)
|
|
local helixPower = 2 * helix:getPower() + 3 * player:getJobPointLevel(xi.jp.MODUS_VERITAS_EFFECT)
|
|
local duration = helix:getDuration()
|
|
local remaining = math.floor(helix:getTimeRemaining() / 1000) -- from milliseconds
|
|
|
|
duration = duration - remaining + math.floor(remaining * durationMultiplier)
|
|
helix:setSubPower(mvPower + 1)
|
|
helix:setPower(helixPower)
|
|
helix:setDuration(duration * 1000) -- back to milliseconds
|
|
end
|
|
|
|
return abilityObject
|