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
26 changes: 26 additions & 0 deletions spec/System/TestConfigTab_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -371,5 +371,31 @@ describe("TestConfig", function()
assert.are.equals("test", newConfigSet.placeholder.testPlaceholder)
end)
end)

describe("Leeching options", function()
local ConfigVisibility = LoadModule("Modules/ConfigVisibility")
local function isShown(var)
for _, varData in ipairs(LoadModule("Modules/ConfigOptions")) do
if varData.var == var then
return ConfigVisibility.isRelevantForBuild(varData, build)
end
end
end

it("are hidden without a leech source", function()
assert.is_false(isShown("conditionLeeching"))
assert.is_false(isShown("conditionLeechingMana"))
end)

it("are shown when the main skill leeches mana", function()
build.configTab.input.customMods = "1% of Physical Attack Damage Leeched as Mana"
build.configTab:BuildModList()
runCallback("OnFrame")

assert.is_true(isShown("conditionLeeching"))
assert.is_true(isShown("conditionLeechingMana"))
assert.is_false(isShown("conditionLeechingLife"))
end)
end)
end)
end)
9 changes: 9 additions & 0 deletions src/Modules/Calcs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,15 @@ function calcs.buildOutput(build, mode)
end
end
end
-- Show the "Are you Leeching?" options when the main skill leeches, so mods that need the condition can be compared before they are equipped
for _, resource in ipairs({ "Life", "EnergyShield", "Mana" }) do
local leechRate = (output[resource.."LeechRate"] or 0) - (output[resource.."LeechInstantRate"] or 0)
if leechRate > 0 then
local mod = modLib.createMod(resource.."LeechRate", "BASE", leechRate, "Main skill leech")
addTo(env.conditionsUsed, "Leeching", mod)
addTo(env.conditionsUsed, "Leeching"..resource, mod)
end
end
-- ConPrintf("=== Cond ===")
-- ConPrintTable(env.conditionsUsed)
-- ConPrintf("=== Mult ===")
Expand Down