From 15fa16dec369009fa67b83d372e6b4016b3d4c87 Mon Sep 17 00:00:00 2001 From: Judd Date: Sun, 4 Oct 2026 09:58:36 -0700 Subject: [PATCH] Fix Node Power giving nodes another node's score PowerBuilder caches one calculation per modKey and reuses it for every node with that modKey. Nodes with the same modKey can still calculate differently: a radius jewel only applies to the nodes in its radius, small and notable passives are scaled separately, and weapon set nodes get a weapon set condition. A Time-Lost jewel that gives small passives in its radius extra damage made every same-stat small passive on the tree show that damage, or none of them, depending on which one was scored first. Key the cache on the modKey plus the node's type, attribute flag, weapon set and the radius jewels that cover it. --- src/Classes/CalcsTab.lua | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/src/Classes/CalcsTab.lua b/src/Classes/CalcsTab.lua index 2c39f156cb..e11617d93d 100644 --- a/src/Classes/CalcsTab.lua +++ b/src/Classes/CalcsTab.lua @@ -547,6 +547,18 @@ function CalcsTabClass:BuildPower() end end +-- Nodes with the same modKey can still calculate differently: radius jewels only apply to the nodes +-- in their radius, small and notable passives are scaled separately, and weapon set nodes add a condition +local function powerCacheKey(env, node) + local key = node.modKey .. "|" .. node.type .. (node.isAttribute and "|attribute" or "") .. "|" .. (node.allocMode or 0) + for index, rad in ipairs(env.radiusJewelList) do + if rad.nodes[node.id] then + key = key .. "|" .. index + end + end + return key +end + -- Estimate the offensive and defensive power of all unallocated nodes function CalcsTabClass:PowerBuilder() -- local timer_start = GetTime() @@ -621,10 +633,11 @@ function CalcsTabClass:PowerBuilder() end for nodeId, node in pairs(nodes) do if not node.alloc and node.modKey ~= "" and not self.mainEnv.grantedPassives[nodeId] then - if not cache[node.modKey] then - cache[node.modKey] = calcFunc({ addNodes = { [node] = true } }, useFullDPS) + local key = powerCacheKey(self.mainEnv, node) + if not cache[key] then + cache[key] = calcFunc({ addNodes = { [node] = true } }, useFullDPS) end - local output = cache[node.modKey] + local output = cache[key] if self.powerStat and self.powerStat.stat and not self.powerStat.ignoreForNodes then node.power.singleStat = self:CalculatePowerStat(self.powerStat, output, calcBase) if node.path and not node.ascendancyName then @@ -649,10 +662,11 @@ function CalcsTabClass:PowerBuilder() end end elseif node.alloc and node.modKey ~= "" and not self.mainEnv.grantedPassives[nodeId] then - if not cache[node.modKey.."_remove"] then - cache[node.modKey.."_remove"] = calcFunc({ removeNodes = { [node] = true } }, useFullDPS) + local key = powerCacheKey(self.mainEnv, node).."_remove" + if not cache[key] then + cache[key] = calcFunc({ removeNodes = { [node] = true } }, useFullDPS) end - local output = cache[node.modKey.."_remove"] + local output = cache[key] if self.powerStat and self.powerStat.stat and not self.powerStat.ignoreForNodes then node.power.singleStat = self:CalculatePowerStat(self.powerStat, output, calcBase) if node.depends and not node.ascendancyName then