Skip to content

fix curse limit is 1 more than expected #815

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
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
46 changes: 18 additions & 28 deletions src/Modules/CalcPerform.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 debuffSlots = { curseSlots = { }, markSlots = { } }
for _, source in ipairs({curses, minionCurses, allyCurses}) do
for _, curse in ipairs(source) do
-- Calculate curses that ignore hex limit after
Expand All @@ -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 debuffSlots.markSlots or debuffSlots.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(debuffSlots.curseSlots, debuffSlots.markSlots)
env.curseSlots = curseSlots

for _, source in ipairs({curses, minionCurses}) do
for _, curse in ipairs(source) do
Expand Down