Skip to content

Commit b82bbfc

Browse files
committed
FIX: globalLimit not applying
1 parent dfb6ce3 commit b82bbfc

1 file changed

Lines changed: 13 additions & 10 deletions

File tree

src/Classes/ModStore.lua

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -267,15 +267,6 @@ function ModStoreClass:EvalMod(mod, cfg, globalLimits)
267267
local target = self
268268
local limitTarget = self
269269

270-
if globalLimits and tag.globalLimit and tag.globalLimitKey then
271-
value = value or 0
272-
globalLimits[tag.globalLimitKey] = globalLimits[tag.globalLimitKey] or 0
273-
if globalLimits[tag.globalLimitKey] + value > tag.globalLimit then
274-
value = tag.globalLimit - globalLimits[tag.globalLimitKey]
275-
end
276-
globalLimits[tag.globalLimitKey] = globalLimits[tag.globalLimitKey] + value
277-
end
278-
279270
-- Allow limiting a self multiplier on a parent multiplier (eg. Agony Crawler on player virulence)
280271
-- This explicit target is necessary because even though the GetMultiplier method does call self.parent.GetMultiplier, it does so with noMod = true,
281272
-- disabling the summation (3rd part): (not noMod and self:Sum("BASE", cfg, multiplierName[var]) or 0)
@@ -824,6 +815,18 @@ function ModStoreClass:EvalMod(mod, cfg, globalLimits)
824815
return
825816
end
826817
end
827-
end
818+
end
819+
820+
-- Apply global limits
821+
for _, tag in ipairs(mod) do
822+
if globalLimits and tag.globalLimit and tag.globalLimitKey then
823+
value = value or 0
824+
globalLimits[tag.globalLimitKey] = globalLimits[tag.globalLimitKey] or 0
825+
if globalLimits[tag.globalLimitKey] + value > tag.globalLimit then
826+
value = tag.globalLimit - globalLimits[tag.globalLimitKey]
827+
end
828+
globalLimits[tag.globalLimitKey] = globalLimits[tag.globalLimitKey] + value
829+
end
830+
end
828831
return value
829832
end

0 commit comments

Comments
 (0)