Skip to content

Commit 962aeba

Browse files
committed
Add ModStoreClass:Min() to ModStore.lua
This is the counterpart to `ModStoreClass:Max()` and gives back the lowest modifier value. This makes sense for things like the poison stack limit, where neither "BASE" nor "OVERRIDE" would work for multiple mods
1 parent a2dd9c9 commit 962aeba

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

src/Classes/ModStore.lua

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,17 @@ function ModStoreClass:Max(cfg, ...)
207207
return max
208208
end
209209

210+
function ModStoreClass:Min(cfg, ...)
211+
local min
212+
for _, value in ipairs(self:Tabulate("MIN", cfg, ...)) do
213+
local val = self:EvalMod(value.mod, cfg)
214+
if min == nil or val < min then
215+
min = val
216+
end
217+
end
218+
return min
219+
end
220+
210221
---HasMod
211222
--- Checks if a mod exists with the given properties.
212223
--- Useful for determining if the other aggregate functions will find

0 commit comments

Comments
 (0)