From a197980b6c2ada10faeaf8fa76612138470013af Mon Sep 17 00:00:00 2001 From: mauriliogenovese <125388969+mauriliogenovese@users.noreply.github.com> Date: Fri, 21 Feb 2025 08:21:11 +0100 Subject: [PATCH 1/2] fix curse limit is 1 more than expected --- src/Modules/CalcPerform.lua | 46 +++++++++++++++---------------------- 1 file changed, 18 insertions(+), 28 deletions(-) diff --git a/src/Modules/CalcPerform.lua b/src/Modules/CalcPerform.lua index 72322eb879..209b8db932 100644 --- a/src/Modules/CalcPerform.lua +++ b/src/Modules/CalcPerform.lua @@ -2470,16 +2470,13 @@ function calcs.perform(env, skipEHP) t_insert(allyCurses, newCurse) end - -- Set curse limit output.EnemyCurseLimit = modDB:Flag(nil, "CurseLimitIsMaximumPowerCharges") and output.PowerChargesMax or modDB:Sum("BASE", nil, "EnemyCurseLimit") output.EnemyMarkLimit = modDB:Sum("BASE", nil, "EnemyMarkLimit") curses.limit = output.EnemyCurseLimit + output.EnemyMarkLimit buffExports["CurseLimit"] = curses.limit - -- Assign curses to slots - local curseSlots = { } - env.curseSlots = curseSlots - local markCount = 0 + -- Temp different mark and curse slots to handle limits and priorities of both + local debufSlots = { curseSlots = { }, markSlots = { } } for _, source in ipairs({curses, minionCurses, allyCurses}) do for _, curse in ipairs(source) do -- Calculate curses that ignore hex limit after @@ -2495,42 +2492,35 @@ function calcs.perform(env, skipEHP) break end end - for i = 1, source.limit do - -- Prevent more than allowed marks from being considered - if curse.isMark then - if markCount >= output.EnemyMarkLimit then - slot = nil - break - end - end - if not curseSlots[i] then + + local currentSlots = curse.isMark and debufSlots.markSlots or debufSlots.curseSlots + for i = 1, curse.isMark and output.EnemyMarkLimit or output.EnemyCurseLimit do + if not currentSlots[i] then slot = i break - elseif curseSlots[i].name == curse.name then - if curseSlots[i].priority < curse.priority then + elseif currentSlots[i].name == curse.name then + if currentSlots[i].priority < curse.priority then slot = i else slot = nil end break - elseif curseSlots[i].priority < curse.priority then - slot = i + else + if currentSlots[i].priority < curse.priority then + slot = i + end end end - if slot then - if curseSlots[slot] and curseSlots[slot].isMark then - markCount = m_max(markCount - 1, 0) - end - if skipAddingCurse == false then - curseSlots[slot] = curse - end - if curse.isMark then - markCount = markCount + 1 - end + if slot and not skipAddingCurse then + currentSlots[slot] = curse end end end end + + -- Merge curse and mark slots as we now process curse ignoring hex limit + curseSlots = tableConcat(debufSlots.curseSlots, debufSlots.markSlots) + env.curseSlots = curseSlots for _, source in ipairs({curses, minionCurses}) do for _, curse in ipairs(source) do From c6d2838743952463f9d523eadbb2820e15106cd9 Mon Sep 17 00:00:00 2001 From: mauriliogenovese <125388969+mauriliogenovese@users.noreply.github.com> Date: Fri, 21 Feb 2025 08:29:27 +0100 Subject: [PATCH 2/2] var name typo --- src/Modules/CalcPerform.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Modules/CalcPerform.lua b/src/Modules/CalcPerform.lua index 209b8db932..3512105ee0 100644 --- a/src/Modules/CalcPerform.lua +++ b/src/Modules/CalcPerform.lua @@ -2476,7 +2476,7 @@ function calcs.perform(env, skipEHP) curses.limit = output.EnemyCurseLimit + output.EnemyMarkLimit buffExports["CurseLimit"] = curses.limit -- Temp different mark and curse slots to handle limits and priorities of both - local debufSlots = { curseSlots = { }, markSlots = { } } + local debuffSlots = { curseSlots = { }, markSlots = { } } for _, source in ipairs({curses, minionCurses, allyCurses}) do for _, curse in ipairs(source) do -- Calculate curses that ignore hex limit after @@ -2493,7 +2493,7 @@ function calcs.perform(env, skipEHP) end end - local currentSlots = curse.isMark and debufSlots.markSlots or debufSlots.curseSlots + local currentSlots = curse.isMark and debuffSlots.markSlots or debuffSlots.curseSlots for i = 1, curse.isMark and output.EnemyMarkLimit or output.EnemyCurseLimit do if not currentSlots[i] then slot = i @@ -2519,7 +2519,7 @@ function calcs.perform(env, skipEHP) end -- Merge curse and mark slots as we now process curse ignoring hex limit - curseSlots = tableConcat(debufSlots.curseSlots, debufSlots.markSlots) + curseSlots = tableConcat(debuffSlots.curseSlots, debuffSlots.markSlots) env.curseSlots = curseSlots for _, source in ipairs({curses, minionCurses}) do