Skip to content
Open
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
50 changes: 50 additions & 0 deletions spec/System/TestItemParse_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,56 @@ describe("TestAdvancedItemParse #item", function()
assert.are.equals(19, item.catalystQuality)
end)

it("scales suffix (Dextral) catalyst", function()
local item = new("Item", raw([[
Quality (Suffix Modifiers): +20% (augmented)
{ Suffix Modifier — Attribute }
+90(80-100) to all Attributes
(Attributes are Strength, Dexterity, and Intelligence)
]], "Onyx Amulet"))
assert.are.equals(3, item.catalyst)
assert.are.equals(20, item.catalystQuality)
assert.are.equals(108, item.baseModList[1].value)
end)

it("scales prefix (Sinistral) catalyst when crafted on simplex", function()
build.itemsTab:CreateDisplayItemFromRaw(main.rareDB.list["Amulet, Simplex Amulet"].raw)
local item = build.itemsTab.displayItem
-- 26% spell damage
item.prefixes[1] = { modId = "SpellDamage5", range = 1 }
item:Craft()
assert.are.equals(52, item.baseModList[1].value)
build.itemsTab:UpdateAffixControls()
-- dextral is id 9, but selector has a "None" in position 1
build.itemsTab.controls.displayItemCatalyst:SetSel(10)
assert.are.equals(57, item.baseModList[1].value)
assert.are.equals(9, item.catalyst)
assert.are.equals(20, item.catalystQuality)
end)

it("scales prefix (Sinistral) catalyst", function()
local item = new("Item", raw([[
Quality (Prefix Modifiers): +20% (augmented)
{ Prefix Modifier — Attribute }
+90(80-100) to all Attributes
(Attributes are Strength, Dexterity, and Intelligence)
]], "Onyx Amulet"))
assert.are.equals(9, item.catalyst)
assert.are.equals(20, item.catalystQuality)
assert.are.equals(108, item.baseModList[1].value)
end)

it("suffix catalyst does not scale prefix mods", function()
local item = new("Item", raw([[
Quality (Suffix Modifiers): +20% (augmented)
{ Prefix Modifier — Attribute }
+90(80-100) to all Attributes
(Attributes are Strength, Dexterity, and Intelligence)
]], "Onyx Amulet"))
assert.are.equals(3, item.catalyst)
assert.are.equals(20, item.catalystQuality)
assert.are.equals(90, item.baseModList[1].value)
end)
it("doesn't scale unscalable", function()
local item = new("Item", raw([[
Quality (Life and Mana Modifiers): +20% (augmented)
Expand Down
24 changes: 12 additions & 12 deletions src/Classes/Item.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1711,13 +1711,13 @@ function ItemClass:Craft()
if mod then
if mod.type == "Prefix" then
self.namePrefix = mod.affix .. " " .. self.namePrefix
mod.prefix = true
elseif mod.type == "Suffix" then
self.nameSuffix = self.nameSuffix .. " " .. mod.affix
mod.suffix = true
end
self.requirements.level = m_max(self.requirements.level or 0, m_floor(mod.level * 0.8))
local rangeScalar = getCatalystScalar(self.catalyst, mod, self.catalystQuality)
for i, line in ipairs(mod) do
line = itemLib.applyRange(line, affix.range or 0.5, rangeScalar)
local order = mod.statOrder[i]
if statOrder[order] then
-- Combine stats
Expand All @@ -1728,12 +1728,7 @@ function ItemClass:Craft()
return tonumber(num) + tonumber(other)
end)
else
local modLine = { line = line, order = order, type = mod.type }
if mod.type == "Prefix" then
modLine.prefix = true
elseif mod.type == "Suffix" then
modLine.suffix = true
end
local modLine = { line = line, order = order, type = mod.type, prefix = mod.prefix, suffix = mod.suffix, modTags = mod.modTags, range = affix.range }
for l = 1, #self.explicitModLines + 1 do
if not self.explicitModLines[l] or self.explicitModLines[l].order > order then
t_insert(self.explicitModLines, l, modLine)
Expand Down Expand Up @@ -2147,18 +2142,23 @@ function ItemClass:BuildModList()
end
end
end
local function processModLine(modLine)
local function processModLine(modLine, isExplicitMod)
if self:CheckModLineVariant(modLine) then
-- special section for variant over-ride of pre-modifier item parameters
if modLine.line:find("Requires Class") then
self.classRestriction = modLine.line:gsub("{variant:([%d,]+)}", ""):match("Requires Class (.+)")
end
-- handle understood modifier variable properties
local rangedModList = not modLine.extra and getRangedModList(self, modLine)
local isRare = (self.rarity ~= "UNIQUE") and (self.rarity ~= "RELIC")
if rangedModList then
modLine.modList = rangedModList
modLine.showSlider = true
t_insert(self.rangeLineList, modLine)
-- rare explicit mods are supposed to be controlled via the crafting
-- affix selectors, and are skipped here
if not (isRare and isExplicitMod) then
modLine.showSlider = true
t_insert(self.rangeLineList, modLine)
end
elseif modLine.modId and modLine.newModId then
-- mutated mod transformation available
t_insert(self.rangeLineList, modLine)
Expand Down Expand Up @@ -2187,7 +2187,7 @@ function ItemClass:BuildModList()
processModLine(modLine)
end
for _, modLine in ipairs(self.explicitModLines) do
processModLine(modLine)
processModLine(modLine, true)
end
for _, modLine in ipairs(self.crucibleModLines) do
processModLine(modLine)
Expand Down
5 changes: 5 additions & 0 deletions src/Classes/ItemsTab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -959,6 +959,11 @@ holding Shift will put it in the second.]])
end})
local foulbornIcon = NewImageHandle()
foulbornIcon:Load("Assets/breachicon.png")
-- single affix selector. this is intended for editing a single unique affix
-- and for controlling the implicit modifiers of rares.
-- TODO: remove this. it doesn't make much sense to keep it as it duplicates a
-- lot of code from the "show all item affixes sliders" UI, which is enabled
-- by default. this also provides no advantages whatsoever over that UI
self.controls.displayItemRangeLine = new("DropDownControl", {"TOPLEFT",self.controls.displayItemSectionRange,"TOPLEFT"}, {0, 0, 350, 18}, nil, function(index, value)
self.controls.displayItemRangeSlider.val = self.displayItem.rangeLineList[index].range
end)
Expand Down
Loading
Loading