fix(move): prevent softlock when pivot move user faints from contact …#7233
Open
feelgooddd wants to merge 2 commits intopagefaultgames:betafrom
Open
fix(move): prevent softlock when pivot move user faints from contact …#7233feelgooddd wants to merge 2 commits intopagefaultgames:betafrom
feelgooddd wants to merge 2 commits intopagefaultgames:betafrom
Conversation
DayKev
reviewed
Apr 9, 2026
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
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.
What are the changes the user will see?
The game no longer softlocks or causes the replacement Pokémon to immediately faint when a pivot move user (U-Turn, Flip Turn, Volt Switch, etc.) faints from contact damage abilities like Rough Skin or Iron Barbs during a trainer battle.
Why am I making these changes?
Fixes #7226
This is a temporary hotfix for the bug reported in #6921. The root cause is a phase ordering issue that will be fully resolved by #6611, but as Bertie690 noted that PR won't be ready until 1.12 at the earliest. This fix prevents the softlock in the meantime.
What are the changes from a developer perspective?
Two changes:
In
src/phases/faint-phase.ts, added an early exit instart()if the Pokémon retrieved by battler index has HP > 0. This prevents a zombie Pokémon from being fainted. When a pivot move user faints and switches in the next Pokémon, the FaintPhase is queued for the original battler index. By the time it runs, the new Pokémon occupies that index. The HP check ensures we only process the faint for the correct Pokémon.In
src/phases/victory-phase.ts, changedisFainted(true)toisFainted()when checking the enemy party.isFainted(true)checks both HP and status, butdoSetStatus(StatusEffect.FAINT)is called asynchronously inside a faint animation callback, soVictoryPhasewas running before the status was set, incorrectly thinking a 0 HP Pokémon was still alive and not pushingBattleEndPhase.Screenshots/Videos
Before & After video
https://www.youtube.com/watch?v=YrDmq8bhm3w
How to test the changes?
An automated test has been added to
test/tests/abilities/ability-contact-damage.test.ts. Run with:To test manually, add the following to
src/overrides.ts:The trainer's first Pokémon should faint from Rough Skin after using U-Turn, and the second Pokémon should enter the field normally without immediately fainting.
Checklist
betaas my base branchbeta,mainor the name of another long-lived feature branchpnpm test:silentto test locally)pnpm test:create) or updated existing tests related to the PR's changes if necessaryI have made sure that any UI changes work for both the default and legacy UI themes (if applicable)Are there any localization additions or changes? If so:
I have created an associated PR on the locales repositoryI have contacted the Translation Team on Discord for proofreading/translationDoes this require any additions or changes to in-game assets? If so:
I have created an associated PR on the assets repository