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
6 changes: 3 additions & 3 deletions spec/System/TestItemMods_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -202,13 +202,13 @@ describe("TetsItemMods", function()
build.itemsTab.controls.craftingSorting:SelByValue("Life", "stat")
build.calcsTab.GetMiscCalculator = function()
return function(args)
calcCount += 1
calcCount = calcCount + 1
local life = 0
for _, modLine in ipairs(args.repItem.explicitModLines) do
if modLine.line == "+19 to maximum Life" then
retainedCount += 1
retainedCount = retainedCount + 1
end
life += tonumber(modLine.line:match("%+(%d+) to maximum Life")) or 0
life = life + (tonumber(modLine.line:match("%+(%d+) to maximum Life")) or 0)
end
return { Life = life }
end
Expand Down
23 changes: 23 additions & 0 deletions spec/System/TestPassiveSpec_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,29 @@ Item Level: 80
assert.are.equals("Witch", loadClass("0_4", 1))
end)

it("switches attribute nodes without copying the passive tree graph", function()
local source
for _, node in pairs(build.spec.tree.nodes) do
if node.isAttribute then
source = node
break
end
end
assert.is_not_nil(source)

local option = source.options[1]
build.spec:SwitchAttributeNode(source.id, 1)
local override = build.spec.hashOverrides[source.id]

assert.is_not_nil(override)
assert.are_not.equals(source, override)
assert.are.equals(source.group, override.group)
assert.are.equals(source.options, override.options)
assert.are.equals(option.name, override.dn)
assert.are.same(option.sd, override.sd)
assert.are_not.equals(option.sd, override.sd)
end)

local function allocNode(spec, nodeId, allocMode)
local node = spec.nodes[nodeId]
spec.allocMode = allocMode
Expand Down
13 changes: 6 additions & 7 deletions src/Classes/Item.lua
Original file line number Diff line number Diff line change
Expand Up @@ -710,10 +710,7 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
local backupAffixList = { }
for modId, modData in pairs(self.affixes) do
-- these can produce false positives, and only ever exist on the monk glove base
if modId:match("^HandWraps") and not self.name:match("Fists of Stone") then
continue
end
if modData.affix == modName then
if not (modId:match("^HandWraps") and not self.name:match("Fists of Stone")) and modData.affix == modName then
if self:GetModSpawnWeight(modData) > 0 then
if modData.type == "Prefix" then
t_insert(self.pendingAffixList, { modId = modId, table = self.prefixes })
Expand Down Expand Up @@ -1396,7 +1393,7 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
local strippedModLine = getRuneLineParts(modLine.line)
if (disabledRuneLines[strippedModLine] or 0) > 0 then
modLine.disabled = true
disabledRuneLines[strippedModLine] -= 1
disabledRuneLines[strippedModLine] = disabledRuneLines[strippedModLine] - 1
end
end
end
Expand Down Expand Up @@ -1628,7 +1625,7 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
if #self.modMagnitudeMods > 0 then
for _, modMagnitudeMod in ipairs(self.modMagnitudeMods) do
if self:UsesVersionedOrGroupedVariants() and not self:CheckModLineVariant(modMagnitudeMod.sourceLine) then
continue
goto continueMagnitudeMod
end
local modLists
if modMagnitudeMod.modType then
Expand All @@ -1640,7 +1637,7 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
for _, mod in ipairs(mods or {}) do
-- avoid scaling variant lines which are not active
if self:GetModLineVariantCount(mod) == 0 or mod.unscalable then
continue
goto continueMod
end
-- Modifiers that grant skills are not affected by modifier magnitude.
local grantsSkill = false
Expand Down Expand Up @@ -1690,8 +1687,10 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
mod.extra = extra
end
end
::continueMod::
end
end
::continueMagnitudeMod::
end
end
end
Expand Down
5 changes: 4 additions & 1 deletion src/Classes/PassiveSpec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2717,11 +2717,14 @@ end

function PassiveSpecClass:SwitchAttributeNode(nodeId, attributeIndex)
if self.tree.nodes[nodeId] then --Make sure node exists on current tree
local newNode = copyTableSafe(self.tree.nodes[nodeId], false, true)
local newNode = copyTableSafe(self.tree.nodes[nodeId], true, true)
if not newNode.isAttribute then return end -- safety check

local option = newNode.options[attributeIndex]
self:ReplaceNode(newNode, option)
if newNode.sd then
newNode.sd = copyTable(newNode.sd, true)
end
self.tree:ProcessStats(newNode)

self.hashOverrides[nodeId] = newNode
Expand Down
10 changes: 5 additions & 5 deletions src/Classes/Tooltip.lua
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,8 @@ function TooltipClass:AddBuildPlannerNote(size, text, prefix)
depth, closeBrace = 1, openBrace + 1
while closeBrace <= finish and depth > 0 do
local char = text:sub(closeBrace, closeBrace)
if char == "{" then depth += 1 elseif char == "}" then depth -= 1 end
closeBrace += 1
if char == "{" then depth = depth + 1 elseif char == "}" then depth = depth - 1 end
closeBrace = closeBrace + 1
end
end
if validMarkup and depth == 0 then
Expand All @@ -247,9 +247,9 @@ function TooltipClass:AddBuildPlannerNote(size, text, prefix)
if tag == "s" then lineSize = m_floor(size * 0.75 + 0.5) elseif tag == "m" then lineSize = size elseif tag == "l" then lineSize = m_floor(size * 1.25 + 0.5) end
if font ~= nil or lineSize then
local line = 1
for _ in text:sub(1, tagStart - 1):gmatch("\n") do line += 1 end
for _ in text:sub(1, tagStart - 1):gmatch("\n") do line = line + 1 end
local lastLine = line
for _ in text:sub(tagStart, closeBrace - 1):gmatch("\n") do lastLine += 1 end
for _ in text:sub(tagStart, closeBrace - 1):gmatch("\n") do lastLine = lastLine + 1 end
for index = line, lastLine do
lineStyles[index] = lineStyles[index] or { }
if font ~= nil then lineStyles[index].font = font end
Expand Down Expand Up @@ -277,7 +277,7 @@ function TooltipClass:AddBuildPlannerNote(size, text, prefix)
for renderedLine in (renderedText .. "\n"):gmatch("([^\n]*)\n") do
local style = lineStyles[line]
self:AddLine(style and style.size or size, (line == 1 and (prefix or "") or "") .. renderedLine, style and style.font)
line += 1
line = line + 1
end
end

Expand Down
2 changes: 1 addition & 1 deletion src/Export/Scripts/uModsToText.lua
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ for _, name in ipairs(itemTypes) do
if mod.modTags then
for _, tag in ipairs(mod.modTags) do
if tag == "unveiled_mod" then
prefix ..= "{desecrated}"
prefix = prefix .. "{desecrated}"
end
end
end
Expand Down
15 changes: 8 additions & 7 deletions src/Modules/BuildExportPoE2.lua
Original file line number Diff line number Diff line change
Expand Up @@ -144,16 +144,16 @@ local function buildSkills(skillSet)
-- inactive skill sets don't have a display skill list so we need to make one
activeGem = activeSkillGems(group)[activeIdx]
end
if not activeGem then continue end
local activeId = activeGem.gemData?.gameId
if not activeGem then goto continue end
local activeId = activeGem.gemData and activeGem.gemData.gameId
if activeId then
local entry = { id = activeId }
local activeText = gemAdditionalText(activeGem, false)
if activeText then entry.additional_text = activeText end
local supports = {}
for _, gem in ipairs(group.gemList) do
if gem ~= activeGem and gem.enabled ~= false and gem.gemData?.grantedEffect.support then
local supId = gem.gemData?.gameId
if gem ~= activeGem and gem.enabled ~= false and gem.gemData and gem.gemData.grantedEffect and gem.gemData.grantedEffect.support then
local supId = gem.gemData.gameId
if supId then
local supText = gemAdditionalText(gem, true)
if supText then
Expand All @@ -172,6 +172,7 @@ local function buildSkills(skillSet)
else
ConPrintf("[PoE2Export] skipping active gem with no id in group '%s'", tostring(group.label or "?"))
end
::continue::
end
end
return out
Expand Down Expand Up @@ -272,9 +273,9 @@ function M.GetLoadouts(build)
t_insert(out, {
name = plainName,
fileName = displayName,
specIndex = loadout?.specId,
skillSetId = loadout?.skillSetId,
itemSetId = loadout?.itemSetId,
specIndex = loadout and loadout.specId,
skillSetId = loadout and loadout.skillSetId,
itemSetId = loadout and loadout.itemSetId,
})
end
end
Expand Down
2 changes: 1 addition & 1 deletion src/Modules/CalcOffence.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5188,7 +5188,7 @@ function calcs.offence(env, actor, activeSkill)
return baseVal
end

local critMetatable = { __index = |_, key| -> skillCfg.skillCond[key] or cfg.skillCond[key] }
local critMetatable = { __index = function(_, key) return skillCfg.skillCond[key] or cfg.skillCond[key] end }
---Calculate global / breakdown values for a damaging ailment
---@param ailment string
---@param ailmentDamageType table
Expand Down
2 changes: 1 addition & 1 deletion src/Modules/CalcSetup.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1588,7 +1588,7 @@ function calcs.initEnv(build, mode, override, specEnv)
limit = { count = 0, max = dbMod.limit, names = { } }
augmentLimits[dbMod.limitId or augmentName] = limit
end
limit.count += count
limit.count = limit.count + count
t_insert(limit.names, augmentName)
end
end
Expand Down
2 changes: 1 addition & 1 deletion src/Modules/Main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ function main:SaveModCache()
out:write("end)();(function()\n")
count = 0
else
count += 1
count = count + 1
end
end
end
Expand Down