Revisiting this code when looking over this PR makes me realize there are a few more hidden gotchas here.
- Making a mod
unscalable in a LIST mod doesn't do anything. An example of this would be "banners also cause enemies to take (%d+)%% increased damage". This code only checks for unscalable at the LIST level, not for each subMod:
|
function ModStoreClass:ScaleAddMod(mod, scale, replace) |
|
local unscalable = false |
|
for _, effects in ipairs(mod) do |
|
if effects.unscalable then |
|
unscalable = true |
|
break |
|
end |
|
end |
|
if scale == 1 or unscalable then |
|
self:AddMod(mod) |
|
else |
|
local scaledMod = copyTable(mod) |
|
local subMod = scaledMod |
|
if type(scaledMod.value) == "table" then |
- Unscaleable mods get added twice. I tested "take no extra damage from critical strikes" and saw the value double (even though there is a hard cap on a lot of these unscalable mods
In short, I'll merge this PR but I needed to write this down somewhere so it can be refactored again, with proper test cases added for all these corner cases.
Originally posted by @Wires77 in #8977 (comment)
Revisiting this code when looking over this PR makes me realize there are a few more hidden gotchas here.
unscalablein a LIST mod doesn't do anything. An example of this would be "banners also cause enemies to take (%d+)%% increased damage". This code only checks forunscalableat the LIST level, not for each subMod:PathOfBuilding/src/Classes/ModStore.lua
Lines 37 to 50 in 78326a6
In short, I'll merge this PR but I needed to write this down somewhere so it can be refactored again, with proper test cases added for all these corner cases.
Originally posted by @Wires77 in #8977 (comment)