Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/Classes/ModList.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function ModListClass:ReplaceModInternal(mod)
end

function ModListClass:MergeMod(mod)
if mod.type == "BASE" or mod.type == "INC" then
Copy link
Member Author

Choose a reason for hiding this comment

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

I felt this was safe because the only places we merge mods are places that don't even have MORE modifiers, let alone multiple. If we end up being able to scale an item that has 2+ more multipliers of the same type though, we should revisit this to make sure it's accurate

if mod.type == "BASE" or mod.type == "INC" or mod.type == "MORE" then
for i = 1, #self do
if modLib.compareModParams(self[i], mod) then
self[i] = copyTable(self[i], true)
Expand Down
18 changes: 14 additions & 4 deletions src/Modules/CalcSetup.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1051,19 +1051,29 @@ function calcs.initEnv(build, mode, override, specEnv)
end
env.itemModDB:ScaleAddList(combinedList, scale)
elseif item.type == "Gloves" and calcLib.mod(env.initialNodeModDB, nil, "EffectOfBonusesFromGloves") ~=1 then
scale = calcLib.mod(env.initialNodeModDB, nil, "EffectOfBonusesFromGloves")
scale = calcLib.mod(env.initialNodeModDB, nil, "EffectOfBonusesFromGloves") - 1
local combinedList = new("ModList")
for _, mod in ipairs(srcList) do
combinedList:MergeMod(mod)
end
env.itemModDB:ScaleAddList(combinedList, scale)
local scaledList = new("ModList")
scaledList:ScaleAddList(combinedList, scale)
for _, mod in ipairs(scaledList) do
combinedList:MergeMod(mod)
end
env.itemModDB:AddList(combinedList)
Comment on lines +1059 to +1064
Copy link
Member Author

Choose a reason for hiding this comment

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

I duplicated this logic for the gloves even though it's not technically necessary. We should have this logic for all item scaling too for future proofing, most likely

elseif item.type == "Boots" and calcLib.mod(env.initialNodeModDB, nil, "EffectOfBonusesFromBoots") ~= 1 then
scale = calcLib.mod(env.initialNodeModDB, nil, "EffectOfBonusesFromBoots")
scale = calcLib.mod(env.initialNodeModDB, nil, "EffectOfBonusesFromBoots") - 1
local combinedList = new("ModList")
for _, mod in ipairs(srcList) do
combinedList:MergeMod(mod)
end
env.itemModDB:ScaleAddList(combinedList, scale)
local scaledList = new("ModList")
scaledList:ScaleAddList(combinedList, scale)
for _, mod in ipairs(scaledList) do
combinedList:MergeMod(mod)
end
env.itemModDB:AddList(combinedList)
else
env.itemModDB:ScaleAddList(srcList, scale)
end
Expand Down