Skip to content

Commit 6752419

Browse files
author
LocalIdentity
committed
Simplify code
Handle it all in the ordered slot loop so it doesn't need to be called on again
1 parent d6c371f commit 6752419

1 file changed

Lines changed: 4 additions & 10 deletions

File tree

src/Modules/CalcSetup.lua

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -812,18 +812,14 @@ function calcs.initEnv(build, mode, override, specEnv)
812812
end
813813
end
814814
end
815+
if item and item.type == "Flask" and item.base.subType == "Life" and item.flaskData then
816+
-- Keep highest life flask recovery even if this slot is later disabled (e.g. Poisonous Concoction).
817+
env.itemModDB.multipliers["LifeFlaskRecovery"] = m_max(env.itemModDB.multipliers["LifeFlaskRecovery"] or 0, item.flaskData.lifeTotal or 0)
818+
end
815819
items[slotName] = item
816820
::continue::
817821
end
818822

819-
local function setLifeRecoveryFromFlasks(item) -- e.g. Poisonous Concoction
820-
if item and item.type == "Flask" and item.base.subType == "Life" then
821-
if item.flaskData.lifeTotal > (env.itemModDB.multipliers["LifeFlaskRecovery"] or 0) then
822-
env.itemModDB.multipliers["LifeFlaskRecovery"] = item.flaskData.lifeTotal
823-
end
824-
end
825-
end
826-
827823
if not env.configInput.ignoreItemDisablers then
828824
local itemDisabled = {}
829825
local itemDisablers = {}
@@ -886,7 +882,6 @@ function calcs.initEnv(build, mode, override, specEnv)
886882
end
887883
end
888884
for slot in pairs(trueDisabled) do
889-
setLifeRecoveryFromFlasks(items[slot])
890885
items[slot] = nil
891886
end
892887
end
@@ -921,7 +916,6 @@ function calcs.initEnv(build, mode, override, specEnv)
921916
env.flaskSlotOccupied[flaskNum] = true
922917
end
923918
if item.base.subType == "Life" then
924-
setLifeRecoveryFromFlasks(item)
925919
local highestCharges = env.itemModDB.multipliers["LifeFlaskCharges"] or 0
926920
if item.flaskData.chargesMax > highestCharges then
927921
env.itemModDB.multipliers["LifeFlaskCharges"] = item.flaskData.chargesMax

0 commit comments

Comments
 (0)