Skip to content
Open
Changes from 1 commit
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
25 changes: 19 additions & 6 deletions src/Classes/CalcsTab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,17 @@ function CalcsTabClass:BuildPower()
end
end

-- Nodes with the same modKey can still calculate differently, as radius jewels only apply to the nodes in their radius
local function powerCacheKey(env, node)
local key = node.modKey .. "|" .. node.type

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warrior's Tale still lets a tattooed passive and an ordinary passive share this key even when their calculated gains differ.

A focused reproduction uses socket 28475, Tattoo of the Ngamahu Makanga on node 476, ordinary node 6043, capped fire resistance, and Taken Fire dmg. Both nodes have the same type, modKey, and radius membership. Direct calculations give gains of 45.4923 and 22.74615, but the current head's Power Report rows both show 45.5; the ordinary node receives the tattooed node's score. This also happens on the base, so it is a remaining collision rather than a new regression.

Including tattoo identity in the key separates this case: the existing correction gives report rows of 45.5 and 22.7 with the same reproduction.

AI-assisted review disclosure: This finding was identified during a review using OpenAI Codex and confirmed with a focused reproduction.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, that's right. I reproduced it with your setup: node 6043 showed 45.49 while adding it on its own gives 22.75.

I pushed ec82794 to add the tattoo type to the key. With the same setup the report now shows 45.5 for node 476 and 22.7 for node 6043, and both match a direct calculation.

I also saw that your branch fixes the same bug and predates this PR, with spec tests and the shared key on the mastery effect and cluster notable caches too. If you'd rather open yours, I'm happy to close this one in its favour.

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()
Expand Down Expand Up @@ -610,10 +621,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]
calculateAddNodePower(node.power, distance, node, output, function()
local pathNodes = { }
for _, pathNode in pairs(node.path) do
Expand All @@ -622,10 +634,11 @@ function CalcsTabClass:PowerBuilder()
return pathNodes
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
Expand Down