Skip to content
Merged
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
26 changes: 15 additions & 11 deletions src/Modules/CalcPerform.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1684,6 +1684,9 @@ function calcs.perform(env, skipEHP)
local effectMod = 1 + (flaskEffectInc) / 100
local effectModNonPlayer = 1 + (flaskEffectIncNonPlayer) / 100

-- Life and Mana flasks are not Utility flasks, so their effects are kept when Utility flasks are disabled
local isUtilityFlask = not (item.base.flask.life or item.base.flask.mana)

-- Avert thine eyes, lest they be forever scarred
-- I have no idea how to determine which buff is applied by a given flask,
-- so utility flasks are grouped by base, unique flasks are grouped by name, and magic flasks by their modifiers
Expand All @@ -1693,6 +1696,9 @@ function calcs.perform(env, skipEHP)
srcList:ScaleAddList(buffModList, effectMod)
mergeBuff(srcList, flaskBuffs, baseName)
mergeBuff(srcList, flaskBuffsPerBase[item.baseName], baseName)
if not isUtilityFlask then
mergeBuff(srcList, flaskBuffsNonUtility, baseName)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Keep the all-flasks-disabled flag authoritative

Codex: Adding recovery modifiers to flaskBuffsNonUtility also makes them apply when FlasksDoNotApplyToPlayer is set. With Toad's Price and Umbilicus Immortalis, both flags are active; the utility-only branch is evaluated first, so an enduring Divine Life Flask gives the player 685.7 life/s even though Flasks do not apply to you is active. Before this change, the same probe returns 0. Could we give FlasksDoNotApplyToPlayer precedence and add a regression test for this combination?

end
end
if (not onlyRecovery or checkNonRecoveryFlasksForMinions) and (flasksApplyToMinion or quickSilverAppliesToAllies or (nonUniqueFlasksApplyToMinion and item.rarity ~= "UNIQUE" and item.rarity ~= "RELIC")) then
srcList = new("ModList"):ModList()
Expand All @@ -1717,7 +1723,9 @@ function calcs.perform(env, skipEHP)
if not onlyRecovery then
mergeBuff(srcList, flaskBuffs, key)
mergeBuff(srcList, flaskBuffsPerBase[item.baseName], key)
mergeBuff(srcList, flaskBuffsNonUtility, key)
if not isUtilityFlask then
mergeBuff(srcList, flaskBuffsNonUtility, key)
end
end
if (not onlyRecovery or checkNonRecoveryFlasksForMinions) and (flasksApplyToMinion or quickSilverAppliesToAllies or (nonUniqueFlasksApplyToMinion and item.rarity ~= "UNIQUE" and item.rarity ~= "RELIC")) then
srcList = new("ModList"):ModList()
Expand Down Expand Up @@ -1773,18 +1781,14 @@ function calcs.perform(env, skipEHP)
calcFlaskMods(item, item.baseName, item.buffModList, item.modList)
end
end
if modDB:Flag(nil, "UtilityFlasksDoNotApplyToPlayer") then
for flaskCond, status in pairs(flaskConditionsNonUtility) do
modDB.conditions[flaskCond] = status
end
for _, buffModList in pairs(flaskBuffsNonUtility) do
modDB:AddList(buffModList)
end
elseif not modDB:Flag(nil, "FlasksDoNotApplyToPlayer") then
for flaskCond, status in pairs(flaskConditions) do
if not modDB:Flag(nil, "FlasksDoNotApplyToPlayer") then
local utilityFlasksDisabled = modDB:Flag(nil, "UtilityFlasksDoNotApplyToPlayer")
local appliedFlaskConditions = utilityFlasksDisabled and flaskConditionsNonUtility or flaskConditions
local appliedFlaskBuffs = utilityFlasksDisabled and flaskBuffsNonUtility or flaskBuffs
for flaskCond, status in pairs(appliedFlaskConditions) do
modDB.conditions[flaskCond] = status
end
for _, buffModList in pairs(flaskBuffs) do
for _, buffModList in pairs(appliedFlaskBuffs) do
modDB:AddList(buffModList)
end
end
Expand Down
Loading