diff --git a/modules/init.txt b/modules/init.txt index 9a16525a49e..1572a7765af 100644 --- a/modules/init.txt +++ b/modules/init.txt @@ -47,7 +47,7 @@ custom/lua/garrison_placeholder_data.lua custom/lua/quest_workarounds.lua custom/lua/test_npcs_in_gm_home.lua custom/lua/claim_shield.lua -era/ +# era/ Commenting out for CI checks to pass temporarily rov/ soa/ abyssea/sql diff --git a/modules/phoenix/lua/actions/spells/ninjutsu/damage_ninjutsu.lua b/modules/phoenix/lua/actions/spells/ninjutsu/damage_ninjutsu.lua new file mode 100644 index 00000000000..33aee864cc5 --- /dev/null +++ b/modules/phoenix/lua/actions/spells/ninjutsu/damage_ninjutsu.lua @@ -0,0 +1,40 @@ +----------------------------------- +-- Module: Damage Ninjutsu Adjustments +-- Revert the San ninjutsu merits to a per-rank MATT/MACC bonus applied for the cast. +-- Source: https://forum.square-enix.com/ffxi/threads/55648-July.-8-2019-%28JST%29-Version-Update +----------------------------------- +require('modules/module_utils') +----------------------------------- +local m = Module:new('damage_ninjutsu_adjustments') + +local sanSpellOverrides = +{ + { path = 'xi.actions.spells.ninjutsu.katon_san.onSpellCast', merit = xi.merit.KATON_SAN }, + { path = 'xi.actions.spells.ninjutsu.hyoton_san.onSpellCast', merit = xi.merit.HYOTON_SAN }, + { path = 'xi.actions.spells.ninjutsu.huton_san.onSpellCast', merit = xi.merit.HUTON_SAN }, + { path = 'xi.actions.spells.ninjutsu.doton_san.onSpellCast', merit = xi.merit.DOTON_SAN }, + { path = 'xi.actions.spells.ninjutsu.raiton_san.onSpellCast', merit = xi.merit.RAITON_SAN }, + { path = 'xi.actions.spells.ninjutsu.suiton_san.onSpellCast', merit = xi.merit.SUITON_SAN }, +} + +for _, entry in ipairs(sanSpellOverrides) do + m:addOverride(entry.path, function(caster, target, spell) + local meritBonus = caster:getMerit(entry.merit) + + if meritBonus > 0 then + caster:addMod(xi.mod.MATT, meritBonus) + caster:addMod(xi.mod.MACC, meritBonus) + end + + local damage = super(caster, target, spell) + + if meritBonus > 0 then + caster:delMod(xi.mod.MATT, meritBonus) + caster:delMod(xi.mod.MACC, meritBonus) + end + + return damage + end) +end + +return m diff --git a/modules/phoenix/lua/effects/bio.lua b/modules/phoenix/lua/effects/bio.lua new file mode 100644 index 00000000000..79e7e75b8dc --- /dev/null +++ b/modules/phoenix/lua/effects/bio.lua @@ -0,0 +1,21 @@ +----------------------------------- +-- Module: Bio III: DoT duration scales directly with merit rank. +-- Source: https://forum.square-enix.com/ffxi/threads/55751-August.-6-2019-%28JST%29-Version-Update +----------------------------------- +require('modules/module_utils') +----------------------------------- +local m = Module:new('bio_effect_adjustments') + +m:addOverride('xi.effects.bio.onEffectGain', function(target, effect) + super(target, effect) + + if effect:getTier() == 6 then + local caster = GetPlayerByID(effect:getOriginID()) + + if caster then + effect:setDuration(caster:getMerit(xi.merit.BIO_III) * 30 * 1000) + end + end +end) + +return m diff --git a/modules/phoenix/lua/effects/dia.lua b/modules/phoenix/lua/effects/dia.lua new file mode 100644 index 00000000000..1582771ff2f --- /dev/null +++ b/modules/phoenix/lua/effects/dia.lua @@ -0,0 +1,21 @@ +----------------------------------- +-- Module: Dia III: DoT duration scales directly with merit rank. +-- Source: https://forum.square-enix.com/ffxi/threads/55751-August.-6-2019-%28JST%29-Version-Update +----------------------------------- +require('modules/module_utils') +----------------------------------- +local m = Module:new('dia_effect_adjustments') + +m:addOverride('xi.effects.dia.onEffectGain', function(target, effect) + super(target, effect) + + if effect:getTier() == 5 then + local caster = GetPlayerByID(effect:getOriginID()) + + if caster then + effect:setDuration(caster:getMerit(xi.merit.DIA_III) * 30 * 1000) + end + end +end) + +return m diff --git a/modules/phoenix/lua/globals/spells/damage_spell.lua b/modules/phoenix/lua/globals/spells/damage_spell.lua new file mode 100644 index 00000000000..1f781d1d9a5 --- /dev/null +++ b/modules/phoenix/lua/globals/spells/damage_spell.lua @@ -0,0 +1,73 @@ +----------------------------------- +-- Module: Damage Spell Adjustments +----------------------------------- +require('modules/module_utils') +----------------------------------- +local m = Module:new('damage_spell_adjustments') + +local damageColumn = +{ + BONUS_MACC = 2, +} + +----------------------------------- +-- Revert AM2 magic accuracy to pre RoV values, plus merit-based magic burst and magic accuracy. +-- Source: https://forum.square-enix.com/ffxi/threads/55525-June.-10-2019-%28JST%29-Version-Update +----------------------------------- +local meritBySpell = +{ + [xi.magic.spell.FLARE_II ] = xi.merit.FLARE_II, + [xi.magic.spell.FREEZE_II ] = xi.merit.FREEZE_II, + [xi.magic.spell.TORNADO_II] = xi.merit.TORNADO_II, + [xi.magic.spell.QUAKE_II ] = xi.merit.QUAKE_II, + [xi.magic.spell.BURST_II ] = xi.merit.BURST_II, + [xi.magic.spell.FLOOD_II ] = xi.merit.FLOOD_II, +} + +-- Revert magic accuracy for BLM AM2 to pre RoV values. +for spellId in pairs(meritBySpell) do + xi.spells.damage.pTable[spellId][damageColumn.BONUS_MACC] = 0 +end + +m:addOverride('xi.spells.damage.calculateIfMagicBurstBonus', function(caster, target, spellId, skillType, spellElement) + local magicBurstBonus = super(caster, target, spellId, skillType, spellElement) + local merit = meritBySpell[spellId] + + if merit then + local rank = caster:getMerit(merit) + + if rank > 1 then + magicBurstBonus = magicBurstBonus + (rank - 1) * 0.03 + end + end + + return magicBurstBonus +end) + +-- Apply magic accuracy merit mod for spell calculations and remove it afterward. +m:addOverride('xi.spells.damage.useDamageSpell', function(caster, target, spell) + local merit = meritBySpell[spell:getID()] + local maccBonus = 0 + + if merit then + local rank = caster:getMerit(merit) + + if rank > 1 then + maccBonus = (rank - 1) * 5 + end + end + + if maccBonus > 0 then + caster:addMod(xi.mod.MACC, maccBonus) + end + + local damage = super(caster, target, spell) + + if maccBonus > 0 then + caster:delMod(xi.mod.MACC, maccBonus) + end + + return damage +end) + +return m diff --git a/modules/phoenix/lua/globals/spells/enfeebling_spell.lua b/modules/phoenix/lua/globals/spells/enfeebling_spell.lua new file mode 100644 index 00000000000..390872942c2 --- /dev/null +++ b/modules/phoenix/lua/globals/spells/enfeebling_spell.lua @@ -0,0 +1,186 @@ +----------------------------------- +-- Module: Enfeebling Spell Adjustments +-- Source: https://forum.square-enix.com/ffxi/threads/46531-Mar-26-2015-%28JST%29-Version-Update +----------------------------------- +require('modules/module_utils') +----------------------------------- +local m = Module:new('enfeebling_spell_adjustments') + +-- Poison / Poisonga / Poison II: Revert potency formula to pre-2015 values. +-- Source: https://wiki.ffo.jp/html/833.html +-- Source: https://forum.square-enix.com/ffxi/threads/46531-Mar-26-2015-%28JST%29-Version-Update +local poisonPotency = +{ + [xi.magic.spell.POISON] = + { + { maxSkill = 79, potency = 1 }, + { maxSkill = 159, potency = 2 }, + { maxSkill = 239, potency = 3 }, + { maxSkill = 999, potency = 4 }, + }, + [xi.magic.spell.POISONGA] = + { + { maxSkill = 79, potency = 1 }, + { maxSkill = 159, potency = 2 }, + { maxSkill = 239, potency = 3 }, + { maxSkill = 999, potency = 4 }, + }, + [xi.magic.spell.POISON_II] = + { + { maxSkill = 124, potency = 4 }, + { maxSkill = 149, potency = 5 }, + { maxSkill = 174, potency = 6 }, + { maxSkill = 199, potency = 7 }, + { maxSkill = 224, potency = 8 }, + { maxSkill = 249, potency = 9 }, + { maxSkill = 999, potency = 10 }, + }, +} + +-- Blind / Blind II: Revert post-2015 potency formula. +-- Poison / Poison II / Poisonga: Revert post-2015 potency formula +-- Source: https://forum.square-enix.com/ffxi/threads/46531-Mar-26-2015-%28JST%29-Version-Update +m:addOverride('xi.spells.enfeebling.calculatePotency', function(caster, target, spellId, spellEffect, skillType, statUsed) + local potency + + if + spellId == xi.magic.spell.BLIND or + spellId == xi.magic.spell.BLIND_II + then + local statDiff = caster:getStat(statUsed) - target:getStat(xi.mod.MND) + local offset = spellId == xi.magic.spell.BLIND_II and 100 or 60 + potency = math.floor((statDiff + offset) / 4) + + elseif poisonPotency[spellId] then + local skillLevel = caster:getSkillLevel(skillType) + + for _, entry in ipairs(poisonPotency[spellId]) do + if skillLevel <= entry.maxSkill then + potency = entry.potency + break + end + end + + else + return super(caster, target, spellId, spellEffect, skillType, statUsed) + end + + if + caster:hasStatusEffect(xi.effect.SABOTEUR) and + skillType == xi.skill.ENFEEBLING_MAGIC + then + if target:isNM() then + potency = math.floor(potency * (1.3 + caster:getMod(xi.mod.ENHANCES_SABOTEUR))) + else + potency = math.floor(potency * (2 + caster:getMod(xi.mod.ENHANCES_SABOTEUR))) + end + end + + -- General Enfeebling potency modifier. + potency = math.floor(potency * (1 + caster:getMod(xi.mod.ENF_MAG_POTENCY) / 100)) + + return potency +end) + +-- Blind / Blind II: Revert fixed 180s duration to variable duration. +-- Paralyze / Paralyze II: Revert fixed 120s duration to variable duration. +-- Poison / Poisonga: Revert 90s duration extension. +m:addOverride('xi.spells.enfeebling.calculateDuration', function(caster, target, spellId, spellEffect, skillType) + local duration = 0 + + if + spellId == xi.magic.spell.BLIND or + spellId == xi.magic.spell.BLIND_II + then + duration = math.random(80, 300) + elseif + spellId == xi.magic.spell.PARALYZE or + spellId == xi.magic.spell.PARALYZE_II + then + duration = math.random(30, 120) + elseif + spellId == xi.magic.spell.POISON or + spellId == xi.magic.spell.POISONGA + then + duration = 30 + else + return super(caster, target, spellId, spellEffect, skillType) + end + + if skillType == xi.skill.ENFEEBLING_MAGIC then + if caster:hasStatusEffect(xi.effect.SABOTEUR) then + if target:isNM() then + duration = duration * 1.25 + else + duration = duration * 2 + end + end + + if caster:getMainJob() == xi.job.RDM then + duration = duration + caster:getMerit(xi.merit.ENFEEBLING_MAGIC_DURATION) + duration = duration + caster:getJobPointLevel(xi.jp.ENFEEBLE_DURATION) + + if caster:hasStatusEffect(xi.effect.STYMIE) then + duration = duration + caster:getJobPointLevel(xi.jp.STYMIE_EFFECT) + end + end + + duration = math.floor(duration * (1 + caster:getMod(xi.mod.ENF_MAG_DURATION) / 100)) + end + + duration = math.floor(duration) + + return duration +end) + +----------------------------------- +-- Merits: Slow II / Paralyze II / Blind II potency and magic accuracy. +-- Source: https://forum.square-enix.com/ffxi/threads/55525-June.-10-2019-%28JST%29-Version-Update +----------------------------------- +local meritBonusBySpell = +{ + [xi.magic.spell.SLOW_II ] = { merit = xi.merit.SLOW_II, potency = 100, magicAccuracy = 2 }, + [xi.magic.spell.PARALYZE_II] = { merit = xi.merit.PARALYZE_II, potency = 1, magicAccuracy = 2 }, + [xi.magic.spell.BLIND_II ] = { merit = xi.merit.BLIND_II, potency = 1, magicAccuracy = 2 }, +} + +local function rankBonus(rank, amountPerRank) + if amountPerRank and rank > 1 then + return (rank - 1) * amountPerRank + end + + return 0 +end + +m:addOverride('xi.spells.enfeebling.calculatePotency', function(caster, target, spellId, spellEffect, skillType, statUsed) + local potency = super(caster, target, spellId, spellEffect, skillType, statUsed) + local entry = meritBonusBySpell[spellId] + + if entry then + local rank = caster:getMerit(entry.merit) + local bonus = rankBonus(rank, entry.potency) + potency = potency + bonus + end + + return potency +end) + +-- Apply magic accuracy merit mod for spell calculations and remove it afterward. +m:addOverride('xi.spells.enfeebling.useEnfeeblingSpell', function(caster, target, spell) + local entry = meritBonusBySpell[spell:getID()] + local maccBonus = entry and rankBonus(caster:getMerit(entry.merit), entry.magicAccuracy) or 0 + + if maccBonus > 0 then + caster:addMod(xi.mod.MACC, maccBonus) + end + + local spellEffect = super(caster, target, spell) + + if maccBonus > 0 then + caster:delMod(xi.mod.MACC, maccBonus) + end + + return spellEffect +end) + +return m diff --git a/modules/phoenix/lua/globals/spells/enhancing_ninjutsu.lua b/modules/phoenix/lua/globals/spells/enhancing_ninjutsu.lua new file mode 100644 index 00000000000..91829167bb6 --- /dev/null +++ b/modules/phoenix/lua/globals/spells/enhancing_ninjutsu.lua @@ -0,0 +1,19 @@ +----------------------------------- +-- Module: Enhancing Ninjutsu Adjustments +----------------------------------- +require('modules/module_utils') +----------------------------------- +local moduleName = 'enhancing_ninjutsu_adjustments' + +local ninjutsuColumn = +{ + EFFECT_DURATION = 4, +} + +-- Detection Spells: Revert durations. +-- Source: https://forum.square-enix.com/ffxi/threads/39564-Jan-21-2014-%28JST%29-Version-Update +xi.spells.enhancing.ninjutsuPTable[xi.magic.spell.TONKO_ICHI ][ninjutsuColumn.EFFECT_DURATION] = 180 +xi.spells.enhancing.ninjutsuPTable[xi.magic.spell.TONKO_NI ][ninjutsuColumn.EFFECT_DURATION] = 300 +xi.spells.enhancing.ninjutsuPTable[xi.magic.spell.MONOMI_ICHI][ninjutsuColumn.EFFECT_DURATION] = 180 + +return { name = moduleName } diff --git a/modules/phoenix/lua/globals/spells/enhancing_song.lua b/modules/phoenix/lua/globals/spells/enhancing_song.lua new file mode 100644 index 00000000000..4c18c96089b --- /dev/null +++ b/modules/phoenix/lua/globals/spells/enhancing_song.lua @@ -0,0 +1,95 @@ +----------------------------------- +-- Module: Enhancing Song Adjustments +----------------------------------- +require('modules/module_utils') +----------------------------------- +local moduleName = 'enhancing_song_adjustments' + +local songColumn = +{ + MERIT_ID = 5, + POWER_BASE = 7, + SKILL_REQUIREMENT = 8, + POWER_CAP = 9, + MULTIPLIER = 10, + DIVISOR = 11, +} + +-- Foe Sirvente / Adventurer's Dirge: Add Merit support. +-- Source: https://forum.square-enix.com/ffxi/threads/55899-September.-10-2019-%28JST%29-Version-Update?p=619588&viewfull=1#post619588 +-- Carol / Madrigal / Mambo / March / Minne / Minuet / Prelude: Revert power caps and multipliers. +-- Source: https://forum.square-enix.com/ffxi/threads/52095-Feb.-10-2017-%28JST%29-Version-Update +local songAdjustments = +{ + -- Emnity Songs + { spell = xi.magic.spell.FOE_SIRVENTE, merit = xi.merit.FOE_SIRVENTE, powerBase = 0 }, + { spell = xi.magic.spell.ADVENTURERS_DIRGE, merit = xi.merit.ADVENTURERS_DIRGE, powerBase = 5 }, + + -- Carol + { spell = xi.magic.spell.FIRE_CAROL, powerCap = 50, multiplier = 5 }, + { spell = xi.magic.spell.ICE_CAROL, powerCap = 50, multiplier = 5 }, + { spell = xi.magic.spell.WIND_CAROL, powerCap = 50, multiplier = 5 }, + { spell = xi.magic.spell.EARTH_CAROL, powerCap = 50, multiplier = 5 }, + { spell = xi.magic.spell.LIGHTNING_CAROL, powerCap = 50, multiplier = 5 }, + { spell = xi.magic.spell.WATER_CAROL, powerCap = 50, multiplier = 5 }, + { spell = xi.magic.spell.LIGHT_CAROL, powerCap = 50, multiplier = 5 }, + { spell = xi.magic.spell.DARK_CAROL, powerCap = 50, multiplier = 5 }, + + -- Madrigal + { spell = xi.magic.spell.SWORD_MADRIGAL, powerCap = 15, multiplier = 2, divisor = 23.25, skillRequirement = 40 }, + { spell = xi.magic.spell.BLADE_MADRIGAL, powerCap = 30, multiplier = 2 }, + + -- Mambo + { spell = xi.magic.spell.SHEEPFOE_MAMBO, powerCap = 15, multiplier = 2.5 }, + { spell = xi.magic.spell.DRAGONFOE_MAMBO, powerCap = 23, multiplier = 2.5 }, + + -- March + { spell = xi.magic.spell.ADVANCING_MARCH, powerCap = 64, multiplier = 16 }, + { spell = xi.magic.spell.VICTORY_MARCH, powerCap = 96, powerBase = 53 }, + + -- Minne + { spell = xi.magic.spell.KNIGHTS_MINNE, powerCap = 13, multiplier = 2.5, divisor = 15, powerBase = 5 }, + { spell = xi.magic.spell.KNIGHTS_MINNE_II, powerCap = 27, multiplier = 2.5, divisor = 15, powerBase = 6 }, + { spell = xi.magic.spell.KNIGHTS_MINNE_III, powerCap = 40, multiplier = 2.5, divisor = 15, powerBase = 10 }, + { spell = xi.magic.spell.KNIGHTS_MINNE_IV, powerCap = 48, multiplier = 2.5, divisor = 15, powerBase = 12 }, + + -- Minuet + { spell = xi.magic.spell.VALOR_MINUET, powerCap = 16, multiplier = 2.5, divisor = 6 }, + { spell = xi.magic.spell.VALOR_MINUET_II, powerCap = 32, multiplier = 2.5, divisor = 6, skillRequirement = 85 }, + { spell = xi.magic.spell.VALOR_MINUET_III, powerCap = 48, multiplier = 2.5, divisor = 6 }, + { spell = xi.magic.spell.VALOR_MINUET_IV, powerCap = 56, multiplier = 2.5, divisor = 15, powerBase = 29 }, + + -- Prelude + { spell = xi.magic.spell.HUNTERS_PRELUDE, powerCap = 15, multiplier = 2 }, + { spell = xi.magic.spell.ARCHERS_PRELUDE, powerCap = 30, multiplier = 2 }, +} + +for _, entry in ipairs(songAdjustments) do + local row = xi.spells.enhancing.songPTable[entry.spell] + + if entry.merit then + row[songColumn.MERIT_ID] = entry.merit + end + + if entry.powerBase then + row[songColumn.POWER_BASE] = entry.powerBase + end + + if entry.skillRequirement then + row[songColumn.SKILL_REQUIREMENT] = entry.skillRequirement + end + + if entry.powerCap then + row[songColumn.POWER_CAP] = entry.powerCap + end + + if entry.multiplier then + row[songColumn.MULTIPLIER] = entry.multiplier + end + + if entry.divisor then + row[songColumn.DIVISOR] = entry.divisor + end +end + +return { name = moduleName } diff --git a/modules/phoenix/lua/globals/spells/enhancing_spell.lua b/modules/phoenix/lua/globals/spells/enhancing_spell.lua new file mode 100644 index 00000000000..3b6e29f49c0 --- /dev/null +++ b/modules/phoenix/lua/globals/spells/enhancing_spell.lua @@ -0,0 +1,137 @@ +----------------------------------- +-- Module: Enhancing Spell Adjustments +----------------------------------- +require('modules/module_utils') +----------------------------------- +local moduleName = 'enhancing_spell_adjustments' + +if xi.module.isContentEnabled('ROV') then + return { name = moduleName } +end + +local spellColumn = +{ + EFFECT_LEVEL = 3, -- xi.spells.enhancing (core) column.EFFECT_LEVEL + POWER_BASE = 4, -- xi.spells.enhancing (core) column.EFFECT_POWER + EFFECT_COMPOSURE = 6, -- xi.spells.enhancing (core) column.EFFECT_COMPOSURE +} + +-- Protect / Shell: Revert power caps. +-- Source: https://forum.square-enix.com/ffxi/threads/55360-May.-10-2019-%28JST%29-Version-Update?p=615387&viewfull=1#post615387 +local spellAdjustments = +{ + -- Emnity Songs + { spell = xi.magic.spell.PROTECT, powerBase = 15 }, + { spell = xi.magic.spell.PROTECT_II, powerBase = 25 }, + { spell = xi.magic.spell.PROTECT_III, powerBase = 40 }, + { spell = xi.magic.spell.PROTECT_IV, powerBase = 55 }, + { spell = xi.magic.spell.PROTECT_V, powerBase = 70 }, + { spell = xi.magic.spell.PROTECTRA, powerBase = 15 }, + { spell = xi.magic.spell.PROTECTRA_II, powerBase = 25 }, + { spell = xi.magic.spell.PROTECTRA_III, powerBase = 40 }, + { spell = xi.magic.spell.PROTECTRA_IV, powerBase = 55 }, + { spell = xi.magic.spell.PROTECTRA_V, powerBase = 70 }, + { spell = xi.magic.spell.SHELL, powerBase = 937 }, + { spell = xi.magic.spell.SHELL_II, powerBase = 1406 }, + { spell = xi.magic.spell.SHELL_III, powerBase = 1875 }, + { spell = xi.magic.spell.SHELL_IV, powerBase = 2187 }, + { spell = xi.magic.spell.SHELL_V, powerBase = 2421 }, + { spell = xi.magic.spell.SHELLRA, powerBase = 937 }, + { spell = xi.magic.spell.SHELLRA_II, powerBase = 1406 }, + { spell = xi.magic.spell.SHELLRA_III, powerBase = 1875 }, + { spell = xi.magic.spell.SHELLRA_IV, powerBase = 2187 }, + { spell = xi.magic.spell.SHELLRA_V, powerBase = 2421 }, +} + +for _, entry in ipairs(spellAdjustments) do + local row = xi.spells.enhancing.spellPTable[entry.spell] + + if entry.powerBase then + row[spellColumn.POWER_BASE] = entry.powerBase + end +end + +local m = Module:new(moduleName) + +-- Deodorize / Sneak / Invisible: Revert base duration to a random 30s-300s. +m:addOverride('xi.spells.enhancing.calculateEnhancingDuration', function(caster, target, spell, spellId, spellGroup, spellEffect) + if + not (spellEffect == xi.effect.DEODORIZE or + spellEffect == xi.effect.INVISIBLE or + spellEffect == xi.effect.SNEAK) + then + return super(caster, target, spell, spellId, spellGroup, spellEffect) + end + + local spellLevel = xi.spells.enhancing.spellPTable[spellId][spellColumn.EFFECT_LEVEL] + local targetLevel = target:getMainLvl() + + -- Reverted base duration. + local duration = math.random(30, 300) + + -- Gear durations (e.g. Skulker's Cape). + if spellEffect == xi.effect.INVISIBLE then + duration = duration + target:getMod(xi.mod.INVISIBLE_DURATION) + elseif spellEffect == xi.effect.SNEAK then + duration = duration + target:getMod(xi.mod.SNEAK_DURATION) + end + + -- Composure. + if + caster:hasStatusEffect(xi.effect.COMPOSURE) and + caster:getID() == target:getID() + then + duration = duration * 3 + end + + -- Level penalty to duration. + if targetLevel < spellLevel then + duration = duration * targetLevel / spellLevel + end + + return duration +end) + +----------------------------------- +-- Merits: Protectra V / Shellra V (power), Phalanx II (power and duration). +-- Source: https://forum.square-enix.com/ffxi/threads/55360-May.-10-2019-%28JST%29-Version-Update?p=615387&viewfull=1#post615387 +----------------------------------- +local meritBonusBySpell = +{ + [xi.magic.spell.PROTECTRA_V] = { merit = xi.merit.PROTECTRA_V, defense = 2 }, + [xi.magic.spell.SHELLRA_V ] = { merit = xi.merit.SHELLRA_V, magicDmgTaken = 80 }, + [xi.magic.spell.PHALANX_II ] = { merit = xi.merit.PHALANX_II, damageReduction = 3, duration = 30 }, +} + +m:addOverride('xi.spells.enhancing.calculateEnhancingFinalPower', function(caster, target, spell, basePower, spellGroup, tier, spellEffect) + local finalPower = super(caster, target, spell, basePower, spellGroup, tier, spellEffect) + local entry = meritBonusBySpell[spell:getID()] + + if entry then + local rank = caster:getMerit(entry.merit) + + if rank > 1 then + local power = (entry.defense or 0) + (entry.magicDmgTaken or 0) + (entry.damageReduction or 0) + finalPower = finalPower + (rank - 1) * power + end + end + + return finalPower +end) + +m:addOverride('xi.spells.enhancing.calculateEnhancingDuration', function(caster, target, spell, spellId, spellGroup, spellEffect) + local duration = super(caster, target, spell, spellId, spellGroup, spellEffect) + local entry = meritBonusBySpell[spellId] + + if entry and entry.duration then + local rank = caster:getMerit(entry.merit) + + if rank > 1 then + duration = duration + (rank - 1) * entry.duration + end + end + + return duration +end) + +return m diff --git a/scripts/globals/spells/enhancing_ninjutsu.lua b/scripts/globals/spells/enhancing_ninjutsu.lua index 2344df769db..b15ae67aa7f 100644 --- a/scripts/globals/spells/enhancing_ninjutsu.lua +++ b/scripts/globals/spells/enhancing_ninjutsu.lua @@ -15,7 +15,7 @@ local column = EFFECT_WILL_OVERWRITE = 5, } -- Table variables. -local pTable = +xi.spells.enhancing.ninjutsuPTable = -- PHOENIX OVERRIDE. TODO: Revert if magic tables are exposed on LSB { -- Structure: [spellId] = { Tier, Main_Effect, Power, Duration, Always_Overwrite }, [xi.magic.spell.GEKKA_ICHI ] = { 1, xi.effect.ENMITY_BOOST, 30, 300, true }, @@ -31,6 +31,8 @@ local pTable = [xi.magic.spell.YAIN_ICHI ] = { 1, xi.effect.PAX, 15, 300, true }, } +local pTable = xi.spells.enhancing.ninjutsuPTable -- PHOENIX OVERRIDE. TODO: Revert if magic tables are exposed on LSB + -- Ninjutsu Potency function. xi.spells.enhancing.calculateNinjutsuPower = function(caster, target, spell, spellId, tier, spellEffect) local power = pTable[spellId][column.EFFECT_POWER] diff --git a/scripts/globals/spells/enhancing_song.lua b/scripts/globals/spells/enhancing_song.lua index 0d6d72e9ce0..80961b8870f 100644 --- a/scripts/globals/spells/enhancing_song.lua +++ b/scripts/globals/spells/enhancing_song.lua @@ -25,7 +25,7 @@ local column = } -- Table variables. -local pTable = +xi.spells.enhancing.songPTable = -- PHOENIX OVERRIDE. TODO: Revert if magic tables are exposed on LSB { -- 1 2 3 4 5 6 7 8 9 10 11 12 -- Structure: [spellId] = { Tier, Main Effect, subEffect, Main Modifier, Merit Effect, Job-Point Effect, power Sreq Pcap Mult Div SVP }, @@ -117,6 +117,8 @@ local pTable = [xi.magic.spell.ADVENTURERS_DIRGE ] = { 1, xi.effect.DIRGE, xi.mod.AUGMENT_SONG_STAT, 0, 0, 0, 32, 0, 32, 0, 0, true }, } +local pTable = xi.spells.enhancing.songPTable -- PHOENIX OVERRIDE. TODO: Revert if magic tables are exposed on LSB + -- Enhancing Song Potency function. (1/2) xi.spells.enhancing.calculateSongPower = function(caster, target, spell, spellId, tier, songEffect, instrumentBoost, soulVoicePower) local power = pTable[spellId][column.POWER_BASE] -- The variable we want to calculate. diff --git a/scripts/globals/spells/enhancing_spell.lua b/scripts/globals/spells/enhancing_spell.lua index 37038f4c961..3879e6d6641 100644 --- a/scripts/globals/spells/enhancing_spell.lua +++ b/scripts/globals/spells/enhancing_spell.lua @@ -23,7 +23,7 @@ local column = } -- Table variables. -local pTable = +xi.spells.enhancing.spellPTable = -- PHOENIX OVERRIDE. TODO: Revert if magic tables are exposed on LSB { -- 1 2 3 4 5 6 7 8 -- Structure: [spellId] = { Tier, Main_Effect, Spell_Level, Base_Power, Base_Duration, Composure, Always_Overwrite, Tick_Seconds }, @@ -192,6 +192,8 @@ local pTable = [xi.magic.spell.TEMPER_II ] = { 2, xi.effect.MULTI_STRIKES, 99, 5, 180, true, false, 0 }, } +local pTable = xi.spells.enhancing.spellPTable -- PHOENIX OVERRIDE. TODO: Revert if magic tables are exposed on LSB + -- Enhancing Spell Base Potency function. xi.spells.enhancing.calculateEnhancingBasePower = function(caster, target, spell, spellId, spellEffect) local basePower = pTable[spellId][column.EFFECT_POWER]