Repository navigation
Fix inverted negative resistance exceeding the enemy's maximum resistance - #10492
Merged
Wires77 merged 2 commits intoNov 19, 2026
Merged
Conversation
…ance Resistance inversion negated the enemy resistance after calcResistForType had capped it, so an enemy at -150% became +150% and hits dealt negative damage. Inverted resistances are still subject to the maximum resistance cap, so cap the inverted value at the enemy's maximum before penetration, in both the normal and the cannot-penetrate branches, and show it in the breakdown.
…erted resistance Only look up the enemy maximum resistance when there is an inversion chance, so builds without inversion do no extra work, and note the cap in the breakdown. The spec now checks the cap with 20% penetration, with "cannot penetrate", with 50% inversion chance and the breakdown text.
lucaskarsten
force-pushed
the
fix/9375-inverted-res-cap
branch
from
November 18, 2026 19:47
02f3e4c to
e92cee7
Compare
Wires77
approved these changes
Nov 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #9375 .
Description of the problem being solved:
Resistance inversion ("Hits have X% chance to treat Enemy Monster Elemental Resistance values as inverted", Wild Strike of the Extremes, etc.) negated the enemy resistance after
calcResistForTypehad already capped it, so the inverted value skipped the enemy's maximum resistance. An enemy at -150% became +150%, the effective DPS modifier went to -0.5 and the build showed negative DPS.Inverted resistances are still subject to the maximum resistance cap (poewiki, Chaos Resistance: "Inverted resistances are still subject to maximum/minimum resistance caps"), and penetration applies after inversion. The inverted value is now
min(-resist, enemy max resistance)in both the normal and the "cannot penetrate or ignore" branches, and the breakdown shows the capped value with a "capped at maximum resistance" note.The max resistance lookup was moved into a small
calcEnemyMaxResisthelper shared withcalcResistForType(unchanged behaviour) and only runs when there is an inversion chance, so builds without inversion are unaffected.Not changed: with "uses lowest resistance" mods the inversion chance still follows the hit's damage type rather than the element whose resistance is used, and the cannot-penetrate branch still ignores the chance to use resistance. Both predate this PR.
Steps taken to verify a working solution:
TestSkills_spec.lua(enemy at -150% fire resistance): 100% inversion = 0.25, with 20% penetration = 0.45, with "cannot penetrate" = 0.25, 50% inversion = 1.375, plus the breakdown text. It fails without the fix (-0.5).busted --lua=luajitin thepathofbuilding-testsimage: 743 successes / 0 failures.loadBuildFromXML): Combined DPS -214,632 ondev, 433,211 with this PR.Link to a build that showcases this PR:
https://pobb.in/pGaj43d1ZKOw (from the issue)
Before screenshot:
See the issue: Combined DPS is negative (-214,632 headless on
dev).After screenshot:
Combined DPS 433,211 (headless, this branch).