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
39 changes: 39 additions & 0 deletions spec/System/TestItemParse_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1358,5 +1358,44 @@
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 }

Check warning on line 1373 in spec/System/TestItemParse_spec.lua

View workflow job for this annotation

GitHub Actions / spellcheck

Unknown word (UNPARSEABLE)
Grants Level 20 Aspect of !!UNPARSEABLE!! Skill

Check warning on line 1374 in spec/System/TestItemParse_spec.lua

View workflow job for this annotation

GitHub Actions / spellcheck

Unknown word (UNPARSEABLE)
{ 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

Check warning on line 1392 in spec/System/TestItemParse_spec.lua

View workflow job for this annotation

GitHub Actions / spellcheck

Unknown word (UNPARSEABLE)
assert.truthy(modLine.extra)
end
end
end
assert.equals(2, found)
assert.is_true(foundExtraSkill)
end)
end)
end)
22 changes: 18 additions & 4 deletions src/Classes/Item.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
Loading