From cc0fdda96afa251d476ba5f2dec47fe7a3afc40e Mon Sep 17 00:00:00 2001 From: unrealdreamz <132005717+unrealdreamz@users.noreply.github.com> Date: Mon, 18 May 2026 18:18:58 -0400 Subject: [PATCH] Fix Timeless Jewel attribute passive bonuses --- spec/System/TestItemMods_spec.lua | 70 +++++++++++++++++++++++++++++++ src/Modules/CalcSetup.lua | 9 +++- 2 files changed, 77 insertions(+), 2 deletions(-) diff --git a/spec/System/TestItemMods_spec.lua b/spec/System/TestItemMods_spec.lua index b15074c415..4717383f69 100644 --- a/spec/System/TestItemMods_spec.lua +++ b/spec/System/TestItemMods_spec.lua @@ -552,4 +552,74 @@ describe("TetsItemMods", function() assert.are_not.equals(baseColdAvg, round(build.calcsTab.mainOutput.ColdStoredCombinedAvg)) assert.equals(0, round(build.calcsTab.mainOutput.FireStoredCombinedAvg)) end) + + it("Timeless jewels grant conquered attribute passive bonuses", function() + local calcs = build.calcsTab.calcs + local jewelSocketNodeId = 999 + local attributeNode = { + id = 1, + type = "Normal", + isAttribute = true, + allocMode = 0, + modList = new("ModList"), + } + local smallNode = { + id = 2, + type = "Normal", + allocMode = 0, + modList = new("ModList"), + } + local envMode = "SPEC_TIMELESS_ATTRIBUTE" + GlobalCache.cachedData[envMode] = { } + local env = { + mode = envMode, + radiusJewelList = { }, + allocNodes = { }, + build = { + itemsTab = { + activeItemSet = { + useSecondWeaponSet = false, + }, + }, + spec = { + nodes = { + [jewelSocketNodeId] = { + allocMode = 0, + }, + }, + }, + }, + } + table.insert(env.radiusJewelList, { + type = "Other", + nodes = { + [attributeNode.id] = { type = "Normal" }, + [smallNode.id] = { type = "Normal" }, + }, + item = { + baseName = "Timeless Jewel", + }, + nodeId = jewelSocketNodeId, + jewelHash = "undying-hate-spec", + data = { + modSource = "Tree:" .. jewelSocketNodeId, + }, + func = function(node, out, data) + if node and node.type == "Normal" and node.isAttribute then + out:NewMod("Str", "BASE", 7, data.modSource) + elseif node and node.type == "Normal" and not node.isAttribute then + out:NewMod("Dex", "BASE", 11, data.modSource) + end + end, + }) + + local attributeModList = calcs.buildModListForNode(env, attributeNode, 0, false) + local smallModList = calcs.buildModListForNode(env, smallNode, 0, false) + GlobalCache.cachedData[envMode] = nil + + assert.are.equals(7, attributeModList:Sum("BASE", nil, "Str")) + assert.are.equals(0, attributeModList:Sum("BASE", nil, "Dex")) + assert.are.equals(0, smallModList:Sum("BASE", nil, "Str")) + assert.are.equals(11, smallModList:Sum("BASE", nil, "Dex")) + end) end) diff --git a/src/Modules/CalcSetup.lua b/src/Modules/CalcSetup.lua index 5e24c13397..e05018daed 100644 --- a/src/Modules/CalcSetup.lua +++ b/src/Modules/CalcSetup.lua @@ -102,6 +102,7 @@ end local function refreshJewelStatCache(env) local normalNode = { type = "Normal" } + local attributeNode = { type = "Normal", isAttribute = true } local notableNode = { type = "Notable" } GlobalCache.cachedData[env.mode].radiusJewelData = { } @@ -110,9 +111,11 @@ local function refreshJewelStatCache(env) GlobalCache.cachedData[env.mode].radiusJewelData[rad.nodeId] = { } GlobalCache.cachedData[env.mode].radiusJewelData[rad.nodeId].hash = rad.jewelHash GlobalCache.cachedData[env.mode].radiusJewelData[rad.nodeId].smallModList = new("ModList") + GlobalCache.cachedData[env.mode].radiusJewelData[rad.nodeId].attributeModList = new("ModList") GlobalCache.cachedData[env.mode].radiusJewelData[rad.nodeId].notableModList = new("ModList") end rad.func(normalNode, GlobalCache.cachedData[env.mode].radiusJewelData[rad.nodeId].smallModList, rad.data) + rad.func(attributeNode, GlobalCache.cachedData[env.mode].radiusJewelData[rad.nodeId].attributeModList, rad.data) rad.func(notableNode, GlobalCache.cachedData[env.mode].radiusJewelData[rad.nodeId].notableModList, rad.data) end end @@ -140,12 +143,14 @@ function calcs.buildModListForNode(env, node, incSmallPassiveSkill, includeKeyst if rad.type == "Other" and rad.nodes[node.id] and rad.nodes[node.id].type ~= "Mastery" then if rad.item.baseName:find("Time%-Lost") == nil and rad.item.baseName:find("Timeless Jewel") == nil then rad.func(node, modList, rad.data) - elseif not node.isAttribute and (node.type == "Normal" or node.type == "Notable") then + elseif node.type == "Normal" or node.type == "Notable" then local cache = GlobalCache.cachedData[env.mode].radiusJewelData[rad.nodeId] if not cache or (cache.hash ~= rad.jewelHash) then refreshJewelStatCache(env) end - if node.type == "Normal" and cache and #cache.smallModList > 0 then + if node.type == "Normal" and node.isAttribute and cache and #cache.attributeModList > 0 then + modList:AddList(cache.attributeModList) + elseif node.type == "Normal" and not node.isAttribute and cache and #cache.smallModList > 0 then modList:AddList(cache.smallModList) elseif node.type == "Notable" and cache and #cache.notableModList > 0 then modList:AddList(cache.notableModList)