From e373137b5840abb43cb58665c1579871351786f6 Mon Sep 17 00:00:00 2001 From: Lucas Karsten Date: Thu, 19 Nov 2026 14:26:54 -0300 Subject: [PATCH] Fix exposure from config and items not listed in Curses and Debuffs Exposure that is not inflicted by a debuff skill (the "Is the enemy Exposed to X?" config used by Corrosive Elements, Mastermind of Discord and item "inflict Exposure on Hit" mods) lowered the enemy resistance but never showed in the Calcs tab Curses and Debuffs list, unlike Wave of Conviction. Record the exposure that is applied in calcs.perform and list it, with its resistance mod, when it does not come from a debuff skill that is already listed under the same name. --- spec/System/TestExposure_spec.lua | 54 +++++++++++++++++++++++++++++++ src/Modules/CalcPerform.lua | 5 ++- src/Modules/Calcs.lua | 17 ++++++++++ 3 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 spec/System/TestExposure_spec.lua diff --git a/spec/System/TestExposure_spec.lua b/spec/System/TestExposure_spec.lua new file mode 100644 index 00000000000..1b846ab0b3c --- /dev/null +++ b/spec/System/TestExposure_spec.lua @@ -0,0 +1,54 @@ +describe("TestExposure", function() + before_each(function() + newBuild() + end) + + local function calcsDebuffs() + build.configTab:BuildModList() + runCallback("OnFrame") + build.calcsTab:BuildOutput() + local env = build.calcsTab.calcsEnv + local resist = { } + for _, entry in ipairs(env.player.breakdown.SkillDebuffs.modList) do + resist[entry.mod.name] = (resist[entry.mod.name] or 0) + entry.value + end + return env.player.output.CurseList, resist + end + + it("lists exposure from the config in Curses and Debuffs", function() + build.skillsTab:PasteSocketGroup("Arc 20/0 1\n") + build.configTab.input.customMods = "20% chance to inflict Lightning Exposure on Hit" + build.configTab.input.conditionEnemyLightningExposure = true + local curseList, resist = calcsDebuffs() + assert.is_truthy(curseList:find("Lightning Exposure", 1, true)) + assert.are.equals(-10, resist.LightningResist) + end) + + it("lists the exposure value after extra exposure", function() + build.skillsTab:PasteSocketGroup("Arc 20/0 1\n") + build.configTab.input.customMods = "20% chance to inflict Lightning Exposure on Hit\nExposure you inflict applies an extra -5% to the affected Resistance" + build.configTab.input.conditionEnemyLightningExposure = true + local curseList, resist = calcsDebuffs() + assert.is_truthy(curseList:find("Lightning Exposure", 1, true)) + assert.are.equals(-15, resist.LightningResist) + end) + + it("does not list config exposure when it is not applied", function() + build.skillsTab:PasteSocketGroup("Arc 20/0 1\n") + build.configTab.input.customMods = "20% chance to inflict Lightning Exposure on Hit" + local curseList = calcsDebuffs() + assert.is_nil(curseList:find("Exposure", 1, true)) + end) + + it("does not repeat exposure already listed under its debuff skill", function() + build.skillsTab:PasteSocketGroup("Arc 20/0 1\n") + build.skillsTab:PasteSocketGroup("Wave of Conviction 20/0 1\n") + build.configTab.input.waveOfConvictionExposureType = "Lightning" + build.configTab.input.customMods = "20% chance to inflict Lightning Exposure on Hit" + build.configTab.input.conditionEnemyLightningExposure = true + local curseList = calcsDebuffs() + local _, count = curseList:gsub("Lightning Exposure", "") + assert.are.equals(1, count) + assert.is_not_nil(build.calcsTab.calcsEnv.debuffs["Lightning Exposure"]) + end) +end) diff --git a/src/Modules/CalcPerform.lua b/src/Modules/CalcPerform.lua index 9fe45271561..f7dc80a1fc6 100644 --- a/src/Modules/CalcPerform.lua +++ b/src/Modules/CalcPerform.lua @@ -3682,6 +3682,7 @@ function calcs.perform(env, skipEHP) local major, minor = env.spec.treeVersion:match("(%d+)_(%d+)") -- Apply exposures + env.appliedExposure = { } for _, element in ipairs({"Fire", "Cold", "Lightning"}) do if tonumber(major) <= 3 and tonumber(minor) <= 15 -- Elemental Equilibrium pre-3.16 does not remove Exposure effects or not modDB:Flag(nil, "ElementalEquilibrium") -- if Elemental Equilibrium isn't active we just process Exposure normally @@ -3707,7 +3708,9 @@ function calcs.perform(env, skipEHP) min = min * (1 + exposureEffectInc / 100) end enemyDB:NewMod("Condition:Has"..element.."Exposure", "FLAG", true, "") - enemyDB:NewMod(element.."Resist", "BASE", m_min(min, modDB:Override(nil, "ExposureMin")), source) + local exposureResist = m_min(min, modDB:Override(nil, "ExposureMin")) + enemyDB:NewMod(element.."Resist", "BASE", exposureResist, source) + env.appliedExposure[element] = { value = exposureResist, source = source } modDB:NewMod("Condition:AppliedExposureRecently", "FLAG", true, "") end end diff --git a/src/Modules/Calcs.lua b/src/Modules/Calcs.lua index 9134e1080f3..872e4d8978b 100644 --- a/src/Modules/Calcs.lua +++ b/src/Modules/Calcs.lua @@ -824,6 +824,23 @@ function calcs.buildOutput(build, mode) end end end + -- Exposure that does not come from a listed debuff skill (config, items, passives) + local debuffSources = { } + for _, modList in pairs(env.debuffs) do + for _, mod in ipairs(modList) do + debuffSources[mod.source] = true + end + end + for _, element in ipairs({ "Fire", "Cold", "Lightning" }) do + local exposure = env.appliedExposure and env.appliedExposure[element] + if exposure and not debuffSources[exposure.source] and not env.debuffs[element.." Exposure"] then + t_insert(curseList, element.." Exposure") + t_insert(env.player.breakdown.SkillDebuffs.modList, { + mod = modLib.createMod(element.."Resist", "BASE", exposure.value, exposure.source), + value = exposure.value, + }) + end + end output.BuffList = table.concat(buffList, ", ") output.CombatList = table.concat(combatList, ", ") output.CurseList = table.concat(curseList, ", ")