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
35 changes: 22 additions & 13 deletions src/Classes/Item.lua
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ local lineFlags = {
-- in poe2. this is currently only added as a hack for cane of kulemak and
-- should be added based on mod tags after matching a mod in the future
["unveiled"] = true,
["vestigial"] = true,
}

-- Special function to store unique instances of modifier on specific item slots
Expand Down Expand Up @@ -690,6 +691,8 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
end
elseif specName == "CatalystQuality" then
self.catalystQuality = specToNumber(specVal)
elseif specName == "Intangibility" then
self.intangibility = specToNumber(specVal)
elseif specName == "Note" then
self.note = specVal
elseif specName == "Str" or specName == "Strength" or specName == "Dex" or specName == "Dexterity" or
Expand Down Expand Up @@ -791,7 +794,7 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
self.name = self.name:gsub(" %(.+%)","")
end
if not baseName then
baseName = line:gsub("^Superior ", ""):gsub("^Synthesised ","")
baseName = line:gsub("^Superior ", ""):gsub("^Synthesised ", ""):gsub("^Vestigial ", "")
end
if baseName == "Two-Toned Boots" then
baseName = "Two-Toned Boots (Armour/Energy Shield)"
Expand Down Expand Up @@ -1479,6 +1482,9 @@ function ItemClass:BuildRaw()
end
end
end
if self.intangibility then
t_insert(rawLines, string.format("Intangibility: %d%%", self.intangibility))
end
if self.uniqueID then
t_insert(rawLines, "Unique ID: " .. self.uniqueID)
end
Expand Down Expand Up @@ -1574,6 +1580,9 @@ function ItemClass:BuildRaw()
if modLine.unscalable then
line = "{unscalable}" .. line
end
if modLine.vestigial then
line = "{vestigial}" .. line
end
if modLine.variantList then
local varSpec
for varId in pairs(modLine.variantList) do
Expand Down Expand Up @@ -1711,13 +1720,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 +1737,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 +2151,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 +2196,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
12 changes: 11 additions & 1 deletion 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 Expand Up @@ -4272,7 +4277,7 @@ function ItemsTabClass:AddItemTooltip(tooltip, item, slot, dbMode, maxWidth)
end
end
end

if item.catalyst and item.catalyst > 0 and item.catalyst <= #catalystQualityFormat and item.catalystQuality and item.catalystQuality > 0 then
tooltip:AddLine(fontSizeBig, s_format(catalystQualityFormat[item.catalyst], item.catalystQuality), "FONTIN SC")
tooltip:AddSeparator(10)
Expand Down Expand Up @@ -4314,6 +4319,11 @@ function ItemsTabClass:AddItemTooltip(tooltip, item, slot, dbMode, maxWidth)
tooltip:AddSeparator(10)
end

if item.intangibility then
tooltip:AddLine(fontSizeBig, colorCodes.INTANGIBILITY .. s_format("Intangibility: ^7%d%%", item.intangibility), "FONTIN SC")
tooltip:AddSeparator(10)
end

-- Requirements
self.build:AddRequirementsToTooltip(tooltip, item.requirements.level,
item.requirements.strMod, item.requirements.dexMod, item.requirements.intMod,
Expand Down
4 changes: 3 additions & 1 deletion src/Data/Global.lua
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ colorCodes = {
SAPBG = "^x261500",
SCOURGE = "^xFF6E25",
CRUCIBLE = "^xFFA500",
SPLITPERSONALITY = "^xFFD62A"
SPLITPERSONALITY = "^xFFD62A",
VESTIGIAL = "^xCBA5F1",
INTANGIBILITY = "^x9BF4BD",
}
colorCodes.STRENGTH = colorCodes.MARAUDER
colorCodes.DEXTERITY = colorCodes.RANGER
Expand Down
Loading
Loading