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
83 changes: 45 additions & 38 deletions src/Modules/CalcDefence.lua
Original file line number Diff line number Diff line change
Expand Up @@ -471,42 +471,11 @@ local function incomingDamageBreakdown(breakdownTable, poolsRemaining, output)
return breakdownTable
end

-- Performs all ingame and related defensive calculations
function calcs.defence(env, actor)
function calcs.resistances(actor)
local modDB = actor.modDB
local enemyDB = actor.enemy.modDB
local output = actor.output
local breakdown = actor.breakdown

local condList = modDB.conditions

-- Action Speed
output.ActionSpeedMod = calcs.actionSpeedMod(actor)

-- Armour defence types for conditionals
for _, slot in pairs({"Helmet","Gloves","Boots","Body Armour","Weapon 2","Weapon 3"}) do
local armourData = actor.itemList[slot] and actor.itemList[slot].armourData
if armourData then
wardBase = not modDB:Flag(nil, "GainNoWardFrom" .. slot) and armourData.Ward or 0
if wardBase > 0 then
output["WardOn"..slot] = wardBase
end
energyShieldBase = not modDB:Flag(nil, "GainNoEnergyShieldFrom" .. slot) and armourData.EnergyShield or 0
if energyShieldBase > 0 then
output["EnergyShieldOn"..slot] = energyShieldBase
end
armourBase = not modDB:Flag(nil, "GainNoArmourFrom" .. slot) and armourData.Armour or 0
if armourBase > 0 then
output["ArmourOn"..slot] = armourBase
end
evasionBase = not modDB:Flag(nil, "GainNoEvasionFrom" .. slot) and armourData.Evasion or 0
if evasionBase > 0 then
output["EvasionOn"..slot] = evasionBase
end
end
end

-- Resistances
-- Resistances
output["PhysicalResist"] = 0

-- Process Resistance conversion mods
Expand Down Expand Up @@ -605,9 +574,6 @@ function calcs.defence(env, actor)
local dotFinal = m_max(m_min(dotTotal, max), min)
local totemFinal = m_max(m_min(totemTotal, totemMax), min)

if env.minion and modDB:Sum("BASE", nil, "ResistanceAddedToMinions") > 0 then
env.minion.modDB:NewMod(elem.."Resist", "BASE", m_floor(final * modDB:Sum("BASE", nil, "ResistanceAddedToMinions") / 100), "Player")
end

output[elem.."Resist"] = final
output[elem.."ResistTotal"] = total
Expand All @@ -632,8 +598,49 @@ function calcs.defence(env, actor)
}
end
end
-- Formless Inferno, Foulborn Choir of the Storm
if actor == env.minion or actor == env.player then
end

-- Performs all ingame and related defensive calculations
function calcs.defence(env, actor)
local modDB = actor.modDB
local enemyDB = actor.enemy.modDB
local output = actor.output
local breakdown = actor.breakdown

local condList = modDB.conditions

-- Action Speed
output.ActionSpeedMod = calcs.actionSpeedMod(actor)

-- Armour defence types for conditionals
for _, slot in pairs({"Helmet","Gloves","Boots","Body Armour","Weapon 2","Weapon 3"}) do
local armourData = actor.itemList[slot] and actor.itemList[slot].armourData
if armourData then
wardBase = not modDB:Flag(nil, "GainNoWardFrom" .. slot) and armourData.Ward or 0
if wardBase > 0 then
output["WardOn"..slot] = wardBase
end
energyShieldBase = not modDB:Flag(nil, "GainNoEnergyShieldFrom" .. slot) and armourData.EnergyShield or 0
if energyShieldBase > 0 then
output["EnergyShieldOn"..slot] = energyShieldBase
end
armourBase = not modDB:Flag(nil, "GainNoArmourFrom" .. slot) and armourData.Armour or 0
if armourBase > 0 then
output["ArmourOn"..slot] = armourBase
end
evasionBase = not modDB:Flag(nil, "GainNoEvasionFrom" .. slot) and armourData.Evasion or 0
if evasionBase > 0 then
output["EvasionOn"..slot] = evasionBase
end
end
end

calcs.resistances(actor)
if env.minion and modDB:Sum("BASE", nil, "ResistanceAddedToMinions") > 0 then
env.minion.modDB:NewMod(elem.."Resist", "BASE", m_floor(final * modDB:Sum("BASE", nil, "ResistanceAddedToMinions") / 100), "Player")
end
-- Formless Inferno
if actor == env.minion then
doActorLifeMana(actor)
doActorLifeManaReservation(actor)
end
Expand Down
27 changes: 19 additions & 8 deletions src/Modules/CalcPerform.lua
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ end

-- Calculate life/mana reservation
---@param actor table
function doActorLifeManaReservation(actor)
function doActorLifeManaReservation(actor, addAura)
local modDB = actor.modDB
local output = actor.output
local condList = modDB.conditions
Expand All @@ -531,10 +531,12 @@ function doActorLifeManaReservation(actor)
else
reserved = 0
end
for _, value in ipairs(modDB:List(nil, "GrantReserved"..pool.."AsAura")) do
local auraMod = copyTable(value.mod)
auraMod.value = m_floor(auraMod.value * m_min(reserved, max))
modDB:NewMod("ExtraAura", "LIST", { mod = auraMod })
if addAura then
for _, value in ipairs(modDB:List(nil, "GrantReserved"..pool.."AsAura")) do
local auraMod = copyTable(value.mod)
auraMod.value = m_floor(auraMod.value * m_min(reserved, max))
modDB:NewMod("ExtraAura", "LIST", { mod = auraMod })
end
end
end
end
Expand Down Expand Up @@ -1869,10 +1871,10 @@ function calcs.perform(env, skipEHP)
end
end

-- Set the life/mana reservations
doActorLifeManaReservation(env.player)
-- Set the life/mana reservations (hold off on GrantReserved"..pool.."AsAura)
doActorLifeManaReservation(env.player, not modDB:Flag(nil, "ManaIncreasedByOvercappedLightningRes"))

-- Process attribute requirements
-- Process attribute requirements
do
local reqMult = calcLib.mod(modDB, nil, "GlobalAttributeRequirements")
local omniRequirements = modDB:Flag(nil, "OmniscienceRequirements") and calcLib.mod(modDB, nil, "OmniAttributeRequirements")
Expand Down Expand Up @@ -3150,6 +3152,15 @@ function calcs.perform(env, skipEHP)
enemyDB:ReplaceMod("Multiplier:ImpaleStacks", "BASE", maxImpaleStacks, "Config", { type = "Condition", var = "Combat" })
end

-- Foulborn Choir of the Storm, needs to be after main auras (incase purity of lightning/elements auras) but before extra auras (Radiant Faith)
if modDB:Flag(nil, "ManaIncreasedByOvercappedLightningRes") then
-- Calclate resistances for ManaIncreasedByOvercappedLightningRes
calcs.resistances(env.player)
-- Set the life/mana reservations again as we now have increased mana from overcapped lightning resistance
doActorLifeMana(env.player)
doActorLifeManaReservation(env.player, true)
end

-- Check for extra auras
buffExports["Aura"]["extraAura"] = { effectMult = 1, modList = new("ModList") }
for _, value in ipairs(modDB:List(nil, "ExtraAura")) do
Expand Down
2 changes: 1 addition & 1 deletion src/Modules/ModParser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5540,7 +5540,7 @@ local specialModList = {
return { mod("EnergyShield", "OVERRIDE", 1, { type = "PercentStat", stat = "Life", percent = num }) }
end,
["immun[ei]t?y? to elemental ailments while bleeding"] = { flag("ElementalAilmentImmune", { type = "Condition", var = "Bleeding" }) },
["mana is increased by (%d+)%% of overcapped lightning resistance"] = function(num) return { mod("Mana", "INC", num / 100, { type = "PerStat", stat = "LightningResistOverCap" }) } end,
["mana is increased by (%d+)%% of overcapped lightning resistance"] = function(num) return { flag("ManaIncreasedByOvercappedLightningRes"), mod("Mana", "INC", num / 100, { type = "PerStat", stat = "LightningResistOverCap" }) } end,
}
for _, name in ipairs(data.keystones) do
specialModList[name:lower()] = { mod("Keystone", "LIST", name) }
Expand Down