Fix Node Power giving nodes another node's score - #10377
juddisjudd wants to merge 2 commits into
Conversation
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.
|
|
||
| -- 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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Description of the problem being solved:
PowerBuildercaches one calculation permodKeyand gives that result to every node with the samemodKey. A radius jewel only applies to the nodes in its radius, so two nodes with the samemodKey, one inside a jewel's radius and one outside, calculate differently but show the same Node Power. Which value both get depends on which nodepairsreaches 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
modKeyplus 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:
GetMiscCalculatorgives the after numbers.singleStat,pathPower,offenceanddefence: 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.