diff --git a/src/phases/move-phase.ts b/src/phases/move-phase.ts index d113451f0a6..48fc5f6f960 100644 --- a/src/phases/move-phase.ts +++ b/src/phases/move-phase.ts @@ -509,6 +509,9 @@ export class MovePhase extends PokemonPhase { ) { this.showFailedText(); this.fail(); + // clear out 2 turn moves + // TODO: Make a helper for this atp + this.pokemon.getMoveQueue().shift(); this.pokemon.pushMoveHistory(this.moveHistoryEntry); return true; } diff --git a/test/moves/dig.test.ts b/test/moves/dig.test.ts index 28cbf2882a6..4e87fb3204e 100644 --- a/test/moves/dig.test.ts +++ b/test/moves/dig.test.ts @@ -131,4 +131,26 @@ describe("Moves - Dig", () => { expect(postDigEarthquakeDmg).toBeGreaterThanOrEqual(2 * preDigEarthquakeDmg); expect(postDigEarthquakeDmg).toBeLessThan(2 * (preDigEarthquakeDmg + 1)); }); + + it("should not softlock when used against a dying enemy 2 in Doubles", async () => { + game.override.battleStyle("double"); + await game.classicMode.startBattle([SpeciesId.FEEBAS]); + + const feebas = game.field.getPlayerPokemon(); + const enemy2 = game.scene.getEnemyField()[1]; + + // use dig and make the targeted enemy faint post charge + game.move.use(MoveId.DIG, BattlerIndex.PLAYER, BattlerIndex.ENEMY_2); + await game.toEndOfTurn(); + await game.killPokemon(enemy2); + await game.phaseInterceptor.to("CommandPhase"); + + expect(feebas.getMoveQueue()[0]?.targets).toEqual([BattlerIndex.ENEMY_2]); + expect(enemy2).toHaveFainted(); + + await game.toEndOfTurn(); + + // TODO: Does this redirect to the other enemy? + expect(feebas.getMoveQueue()).toHaveLength(0); + }); });