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
15 changes: 15 additions & 0 deletions spec/System/TestDefence_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1884,4 +1884,19 @@ describe("TestDefence", function()
assert.is_true(higherResistEHP >= lowerResistEHP,
string.format("EHP fell from %.1f to %.1f", lowerResistEHP, higherResistEHP))
end)

it("treats negative unreserved mana as 0 for Arcane Cloak", function()
newBuild()
build.skillsTab:PasteSocketGroup("Arc 20/0 1")
build.skillsTab:PasteSocketGroup("Determination 20/0 1\nPride 20/0 1\nMalevolence 20/0 1")
build.mainSocketGroup = 1
runCallback("OnFrame")
local baseDPS = build.calcsTab.mainOutput.TotalDPS

build.skillsTab:PasteSocketGroup("Arcane Cloak 20/0 1")
runCallback("OnFrame")
local output = build.calcsTab.mainOutput
assert.is_true(output.ManaUnreserved < 0)
assert.are.equal(baseDPS, output.TotalDPS)
end)
end)
5 changes: 2 additions & 3 deletions src/Classes/ModStore.lua
Original file line number Diff line number Diff line change
Expand Up @@ -345,9 +345,8 @@ function ModStoreClass:GetStat(stat, cfg)
-- 0% reserved = total mana
return self.actor.output["Mana"]
elseif stat == "ManaUnreserved" and self.actor.output[stat] ~= nil and self.actor.output[stat] < 0 then
-- This reverse engineers how much mana is unreserved before efficiency for accurate Arcane Cloak calcs
local reservedPercentBeforeEfficiency = (math.abs(self.actor.output["ManaUnreservedPercent"]) + 100) * ((100 + self.actor["ManaEfficiency"]) / 100)
return self.actor.output["Mana"] * (math.ceil(reservedPercentBeforeEfficiency) / 100);
-- Negative unreserved mana means 0 mana is available for skills like Arcane Cloak
return 0
else
return (self.actor.output and self.actor.output[stat]) or (cfg and cfg.skillStats and cfg.skillStats[stat]) or 0
end
Expand Down