Skip to content

fix(move): prevent softlock when pivot move user faints from contact …#7233

Open
feelgooddd wants to merge 2 commits intopagefaultgames:betafrom
feelgooddd:fix/uturn-contact-damage-softlock
Open

fix(move): prevent softlock when pivot move user faints from contact …#7233
feelgooddd wants to merge 2 commits intopagefaultgames:betafrom
feelgooddd:fix/uturn-contact-damage-softlock

Conversation

@feelgooddd
Copy link
Copy Markdown

@feelgooddd feelgooddd commented Apr 9, 2026

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:

  1. In src/phases/faint-phase.ts, added an early exit in start() 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.

  2. In src/phases/victory-phase.ts, changed isFainted(true) to isFainted() when checking the enemy party. isFainted(true) checks both HP and status, but doSetStatus(StatusEffect.FAINT) is called asynchronously inside a faint animation callback, so VictoryPhase was running before the status was set, incorrectly thinking a 0 HP Pokémon was still alive and not pushing BattleEndPhase.

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:

npx vitest run test/tests/abilities/ability-contact-damage.test.ts

To test manually, add the following to src/overrides.ts:

BATTLE_TYPE_OVERRIDE: BattleType.TRAINER,
PASSIVE_ABILITY_OVERRIDE: AbilityId.ROUGH_SKIN,
ENEMY_MOVESET_OVERRIDE: [MoveId.U_TURN],
ENEMY_ABILITY_OVERRIDE: AbilityId.WONDER_GUARD,
ENEMY_PASSIVE_ABILITY_OVERRIDE: AbilityId.NONE,
ENEMY_LEVEL_OVERRIDE: 1,
STARTING_LEVEL_OVERRIDE: 100,

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

  • The PR content is correctly formatted:
    • I'm using beta as my base branch
    • The current branch is not named beta, main or the name of another long-lived feature branch
    • I have provided a clear explanation of the changes within the PR description
    • The PR title matches the Conventional Commits format (as described in CONTRIBUTING.md)
  • The PR is self-contained and cannot be split into smaller PRs
  • There is no overlap with another open PR
  • The PR has been confirmed to work correctly:
    • I have tested the changes manually
    • The full automated test suite still passes (use pnpm test:silent to test locally)
    • I have created new automated tests (pnpm test:create) or updated existing tests related to the PR's changes if necessary
  • I have provided screenshots/videos of the changes (if applicable)
    • I 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 repository
  • I have contacted the Translation Team on Discord for proofreading/translation

Does this require any additions or changes to in-game assets? If so:

  • I have created an associated PR on the assets repository

@feelgooddd feelgooddd requested a review from a team as a code owner April 9, 2026 06:15
@Madmadness65 Madmadness65 added Move Affects a move P1 Bug Major. Game crashing move/ability/interaction labels Apr 9, 2026
Comment thread test/tests/abilities/ability-contact-damage.test.ts Outdated
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Move Affects a move P1 Bug Major. Game crashing move/ability/interaction

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Rough Skin / Iron Barbs causes softlock when the opponent uses a pivot contact move (U-Turn)

3 participants