diff --git a/src/Modules/CalcDefence.lua b/src/Modules/CalcDefence.lua index ab123f32ec..1207ece5aa 100644 --- a/src/Modules/CalcDefence.lua +++ b/src/Modules/CalcDefence.lua @@ -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 @@ -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 @@ -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 diff --git a/src/Modules/CalcPerform.lua b/src/Modules/CalcPerform.lua index b5d6957bd9..478687309f 100644 --- a/src/Modules/CalcPerform.lua +++ b/src/Modules/CalcPerform.lua @@ -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 @@ -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 @@ -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") @@ -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 diff --git a/src/Modules/ModParser.lua b/src/Modules/ModParser.lua index c884ca3eaf..7c7750e09b 100644 --- a/src/Modules/ModParser.lua +++ b/src/Modules/ModParser.lua @@ -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) }