diff --git a/spec/System/TestItemParse_spec.lua b/spec/System/TestItemParse_spec.lua index 0654d3c8634..8c19280a0c7 100644 --- a/spec/System/TestItemParse_spec.lua +++ b/spec/System/TestItemParse_spec.lua @@ -1358,5 +1358,44 @@ describe("TestAdvancedItemParse #item", function() assert.equal(27, spellCrit()) assert.equal(8, spellDamage()) end) + it("does not scale modifiers that grant skills", function() + local item = new("Item", [[ + Item Class: Rings + Rarity: Rare + Plague Knuckle + Helical Ring + -------- + Item Level: 84 + -------- + { Implicit Modifier } + 50% increased Suffix Modifier magnitudes + -------- + { Suffix Modifier "of !!UNPARSEABLE!!" — 50% Increased } + Grants Level 20 Aspect of !!UNPARSEABLE!! Skill + { Suffix Modifier "of the Spider" — 50% Increased } + Grants Level 20 Aspect of the Spider Skill + -------- + ]]) + assert.truthy(item.base) + local found = 0 + local foundExtraSkill = false + for _, modLine in ipairs(item.explicitModLines) do + if modLine.line:find("Grants Level", 1, true) then + found = found + 1 + assert.matches("Level 20", itemLib.formatModLine(modLine)) + for _, mod in ipairs(modLine.modList) do + if mod.name == "ExtraSkill" then + foundExtraSkill = true + assert.equals(20, mod.value.level) + end + end + if modLine.line:find("UNPARSEABLE", 1, true) then + assert.truthy(modLine.extra) + end + end + end + assert.equals(2, found) + assert.is_true(foundExtraSkill) + end) end) end) diff --git a/src/Classes/Item.lua b/src/Classes/Item.lua index c0d2e7a7dcd..48fb55d1666 100644 --- a/src/Classes/Item.lua +++ b/src/Classes/Item.lua @@ -1390,6 +1390,18 @@ function ItemClass:ParseRaw(raw, rarity, highQuality) if mod.variantList and (self:GetModLineVariantCount(mod) == 0) then goto modMagnitudeContinue end + -- Modifiers that grant skills are not affected by modifier magnitude. + local grantsSkill = false + for _, parsedMod in ipairs(mod.modList) do + if parsedMod.name == "ExtraSkill" then + grantsSkill = true + break + end + end + if mod.extra and not grantsSkill then + local line = mod.line:lower() + grantsSkill = line:match("^grants level %d+ ") or line:match("^grants %D+$") + end -- Create a fast lookup table for all provided tags local tagLookup = {} for _, curTag in ipairs(mod.modTags) do @@ -1410,7 +1422,7 @@ function ItemClass:ParseRaw(raw, rarity, highQuality) if modMagnitudeMod.anyTags and not (tagLookup[modMagnitudeMod.anyTags[1]] or tagLookup[modMagnitudeMod.anyTags[2]]) then match = false end - if match and not mod.unscalable then + if match and not mod.unscalable and not grantsSkill then if modMagnitudeMod.multiplier then mod.valueScalar = (mod.valueScalar or 1) * modMagnitudeMod.multiplier else @@ -1420,9 +1432,11 @@ function ItemClass:ParseRaw(raw, rarity, highQuality) if mod.valueScalar and mod.valueScalar ~= 1 then local rangedLine = itemLib.applyRange(mod.line, mod.range or 1, mod.valueScalar, 1) local modList, extra = modLib.parseMod(rangedLine) - mod.displayValueScalar = 1 - mod.modList = modList - mod.extra = extra + if modList then + mod.displayValueScalar = 1 + mod.modList = modList + mod.extra = extra + end end ::modMagnitudeContinue:: end