diff --git a/spec/System/TestDefence_spec.lua b/spec/System/TestDefence_spec.lua index 8a0d4daa3f..6dacc2dfdd 100644 --- a/spec/System/TestDefence_spec.lua +++ b/spec/System/TestDefence_spec.lua @@ -358,6 +358,26 @@ describe("TestDefence", function() build.skillsTab.socketGroupList = {} end) + it("foulborn resistance conversion remains stable across recalculation", function() + build.configTab.input.enemyIsBoss = "None" + build.configTab.input.customMods = "\z + +300 to fire resistance\n\z + modifiers to fire resistance also apply to cold and lightning resistances at 50% of their value\n\z + mana is increased by 100% of overcapped lightning resistance\n\z + " + build.configTab:BuildModList() + runCallback("OnFrame") + + assert.are.equals(90, build.calcsTab.calcsOutput.LightningResistTotal) + assert.are.equals(15, build.calcsTab.calcsOutput.LightningResistOverCap) + + build.configTab:BuildModList() + runCallback("OnFrame") + + assert.are.equals(90, build.calcsTab.calcsOutput.LightningResistTotal) + assert.are.equals(15, build.calcsTab.calcsOutput.LightningResistOverCap) + end) + -- fun part it("armoured max hits", function() build.configTab.input.enemyIsBoss = "None" @@ -1177,4 +1197,4 @@ describe("TestDefence", function() assert.are.equals(0, floor(poolsRemaining.Life)) assert.are.equals(0, floor(poolsRemaining.OverkillDamage)) end) -end) \ No newline at end of file +end) diff --git a/src/Modules/CalcDefence.lua b/src/Modules/CalcDefence.lua index 74b9583b07..e693f29ec0 100644 --- a/src/Modules/CalcDefence.lua +++ b/src/Modules/CalcDefence.lua @@ -532,7 +532,7 @@ function calcs.resistances(actor) end end end - + for _, resFrom in ipairs(resistTypeList) do local res for _, resTo in ipairs(resistTypeList) do diff --git a/src/Modules/CalcPerform.lua b/src/Modules/CalcPerform.lua index f107ade614..2f1dd52808 100644 --- a/src/Modules/CalcPerform.lua +++ b/src/Modules/CalcPerform.lua @@ -3189,8 +3189,16 @@ function calcs.perform(env, skipEHP) -- 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) + -- Calculate resistances for ManaIncreasedByOvercappedLightningRes without mutating conversion mods on the player ModDB. + local tempResistActor = { + modDB = new("ModDB", modDB), + output = output, + activeSkillList = env.player.activeSkillList, + enemy = env.player.enemy, + } + tempResistActor.player = tempResistActor + tempResistActor.modDB.actor = tempResistActor + calcs.resistances(tempResistActor) -- Set the life/mana reservations again as we now have increased mana from overcapped lightning resistance doActorLifeMana(env.player) doActorLifeManaReservation(env.player, true)