Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/init.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
40 changes: 40 additions & 0 deletions modules/phoenix/lua/actions/spells/ninjutsu/damage_ninjutsu.lua
Original file line number Diff line number Diff line change
@@ -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
21 changes: 21 additions & 0 deletions modules/phoenix/lua/effects/bio.lua
Original file line number Diff line number Diff line change
@@ -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
21 changes: 21 additions & 0 deletions modules/phoenix/lua/effects/dia.lua
Original file line number Diff line number Diff line change
@@ -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
73 changes: 73 additions & 0 deletions modules/phoenix/lua/globals/spells/damage_spell.lua
Original file line number Diff line number Diff line change
@@ -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
186 changes: 186 additions & 0 deletions modules/phoenix/lua/globals/spells/enfeebling_spell.lua
Original file line number Diff line number Diff line change
@@ -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
19 changes: 19 additions & 0 deletions modules/phoenix/lua/globals/spells/enhancing_ninjutsu.lua
Original file line number Diff line number Diff line change
@@ -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 }
Loading
Loading