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
54 changes: 54 additions & 0 deletions spec/System/TestExposure_spec.lua
Original file line number Diff line number Diff line change
@@ -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)
5 changes: 4 additions & 1 deletion src/Modules/CalcPerform.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
17 changes: 17 additions & 0 deletions src/Modules/Calcs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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, ", ")
Expand Down
Loading