mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-12-15 06:15:20 +01:00
[Bug] Fix 2-turn/charging moves breaking on lack of targets (#6759)
This commit is contained in:
parent
a0aa25ab75
commit
d8d5c12bbc
@ -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;
|
||||
}
|
||||
|
||||
@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user