Skip to content

Commit ebe3dde

Browse files
fix curse limit is 1 more than expected (#815)
* fix curse limit is 1 more than expected * var name typo
1 parent 74a0f48 commit ebe3dde

File tree

1 file changed

+18
-28
lines changed

1 file changed

+18
-28
lines changed

src/Modules/CalcPerform.lua

Lines changed: 18 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2532,16 +2532,13 @@ function calcs.perform(env, skipEHP)
25322532
t_insert(allyCurses, newCurse)
25332533
end
25342534

2535-
25362535
-- Set curse limit
25372536
output.EnemyCurseLimit = modDB:Flag(nil, "CurseLimitIsMaximumPowerCharges") and output.PowerChargesMax or modDB:Sum("BASE", nil, "EnemyCurseLimit")
25382537
output.EnemyMarkLimit = modDB:Sum("BASE", nil, "EnemyMarkLimit")
25392538
curses.limit = output.EnemyCurseLimit + output.EnemyMarkLimit
25402539
buffExports["CurseLimit"] = curses.limit
2541-
-- Assign curses to slots
2542-
local curseSlots = { }
2543-
env.curseSlots = curseSlots
2544-
local markCount = 0
2540+
-- Temp different mark and curse slots to handle limits and priorities of both
2541+
local debuffSlots = { curseSlots = { }, markSlots = { } }
25452542
for _, source in ipairs({curses, minionCurses, allyCurses}) do
25462543
for _, curse in ipairs(source) do
25472544
-- Calculate curses that ignore hex limit after
@@ -2557,42 +2554,35 @@ function calcs.perform(env, skipEHP)
25572554
break
25582555
end
25592556
end
2560-
for i = 1, source.limit do
2561-
-- Prevent more than allowed marks from being considered
2562-
if curse.isMark then
2563-
if markCount >= output.EnemyMarkLimit then
2564-
slot = nil
2565-
break
2566-
end
2567-
end
2568-
if not curseSlots[i] then
2557+
2558+
local currentSlots = curse.isMark and debuffSlots.markSlots or debuffSlots.curseSlots
2559+
for i = 1, curse.isMark and output.EnemyMarkLimit or output.EnemyCurseLimit do
2560+
if not currentSlots[i] then
25692561
slot = i
25702562
break
2571-
elseif curseSlots[i].name == curse.name then
2572-
if curseSlots[i].priority < curse.priority then
2563+
elseif currentSlots[i].name == curse.name then
2564+
if currentSlots[i].priority < curse.priority then
25732565
slot = i
25742566
else
25752567
slot = nil
25762568
end
25772569
break
2578-
elseif curseSlots[i].priority < curse.priority then
2579-
slot = i
2570+
else
2571+
if currentSlots[i].priority < curse.priority then
2572+
slot = i
2573+
end
25802574
end
25812575
end
2582-
if slot then
2583-
if curseSlots[slot] and curseSlots[slot].isMark then
2584-
markCount = m_max(markCount - 1, 0)
2585-
end
2586-
if skipAddingCurse == false then
2587-
curseSlots[slot] = curse
2588-
end
2589-
if curse.isMark then
2590-
markCount = markCount + 1
2591-
end
2576+
if slot and not skipAddingCurse then
2577+
currentSlots[slot] = curse
25922578
end
25932579
end
25942580
end
25952581
end
2582+
2583+
-- Merge curse and mark slots as we now process curse ignoring hex limit
2584+
curseSlots = tableConcat(debuffSlots.curseSlots, debuffSlots.markSlots)
2585+
env.curseSlots = curseSlots
25962586

25972587
for _, source in ipairs({curses, minionCurses}) do
25982588
for _, curse in ipairs(source) do

0 commit comments

Comments
 (0)