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