Skip to content

Fix Node Power giving nodes another node's score - #10377

Open
juddisjudd wants to merge 2 commits into
PathOfBuildingCommunity:devfrom
juddisjudd:fix/power-cache-key
Open

juddisjudd wants to merge 2 commits into
PathOfBuildingCommunity:devfrom
juddisjudd:fix/power-cache-key

Conversation

@juddisjudd

@juddisjudd juddisjudd commented Oct 4, 2026 •

Copy link
Copy Markdown

Description of the problem being solved:

PowerBuilder caches one calculation per modKey and gives that result to every node with the same modKey. A radius jewel only applies to the nodes in its radius, so two nodes with the same modKey, one inside a jewel's radius and one outside, calculate differently but show the same Node Power. Which value both get depends on which node pairs reaches first.

With Unnatural Instinct, an unallocated small passive in its radius already grants its bonus, so allocating it loses that bonus. Node Power showed those nodes gaining as much as the same passive outside the radius.

Tattoos collide the same way: Warrior's Tale only boosts tattoos in its radius, and tattoo counts depend on the tattoo type, so a tattooed node and an ordinary node with the same stats also need separate entries.

This change keys the cache on the modKey plus the node's type, its tattoo type and the radius jewels that cover it. Nodes that calculate the same still share one calculation.

Steps taken to verify a working solution:

  • Level 100 Slayer with Unnatural Instinct, Lethal Pride and The Light of Meaning, Node Power on Combined DPS:
    • "+10 to Strength" small passive outside the radius (node 63282): +2006.3 before and after.
    • Same passive inside Unnatural Instinct's radius (node 56001): +2006.3 before, -1945.1 after.
    • "Damaging Ailments deal damage 5% faster" small passive outside the radius (11364): +194.1 before and after; inside it (43684): +194.1 before, -194.3 after.
    • Adding each of these nodes on its own through GetMiscCalculator gives the after numbers.
  • Tattoo of the Ngamahu Makanga on node 476 in a Warrior's Tale radius (socket 28475), capped fire resistance, Node Power on Taken Fire dmg: ordinary node 6043 showed 45.5 before and 22.7 after, which matches adding it on its own.
  • Scored every node a second time in a different order (sorted by cache key and split across separate calc instances, so a different node fills each cache entry) and compared singleStat, pathPower, offence and defence: they match on 8 builds after the change.

Link to a build that showcases this PR:

Any build with Unnatural Instinct: compare Node Power on two unallocated small passives with the same text, one inside its radius and one outside.

Before screenshot:

Both "+10 to Strength" small passives: +2006.3 Combined DPS.

After screenshot:

Outside the radius: +2006.3. Inside: -1945.1.

PowerBuilder caches one calculation per modKey and reuses it for every node
with that modKey. A radius jewel only applies to the nodes in its radius, so
nodes with the same modKey inside and outside a jewel's radius calculate
differently, and every one of them showed the score of whichever was scored
first.

Key the cache on the modKey plus the node's type and the radius jewels that
cover it.
Comment thread src/Classes/CalcsTab.lua Outdated

-- 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.

A tattooed passive and an ordinary passive with the same stats shared a
cache entry, but Warrior's Tale only boosts tattoos in its radius and tattoo
counts depend on the tattoo type. With Tattoo of the Ngamahu Makanga on a
node in a Warrior's Tale radius, an ordinary node with the same stats showed
the tattooed node's gain.

The key now also includes the tattoo type.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants