mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-21 00:52:47 +02:00
Fixed rest bug
This commit is contained in:
parent
45bbaf2b25
commit
96e4bb5e0e
@ -281,7 +281,8 @@ export class MovePhase extends BattlePhase {
|
||||
globalScene.queueMessage(
|
||||
getStatusEffectHealText(this.pokemon.status.effect, getPokemonNameWithAffix(this.pokemon)),
|
||||
);
|
||||
this.pokemon.resetStatus();
|
||||
// cannot use `unshiftPhase` as it will cause status to be reset _after_ move condition checks fire
|
||||
this.pokemon.resetStatus(false, false, false, false);
|
||||
this.pokemon.updateInfo();
|
||||
}
|
||||
}
|
||||
|
@ -103,26 +103,9 @@ describe("Moves - Rest", () => {
|
||||
const snorlax = game.scene.getPlayerPokemon()!;
|
||||
snorlax.hp = 1;
|
||||
|
||||
// Turn 1
|
||||
game.move.select(Moves.REST);
|
||||
await game.toNextTurn();
|
||||
|
||||
snorlax.hp = 1;
|
||||
expect(snorlax.status?.effect).toBe(StatusEffect.SLEEP);
|
||||
snorlax.status!.sleepTurnsRemaining = 1;
|
||||
|
||||
// Turn 2
|
||||
game.move.select(Moves.REST);
|
||||
await game.toNextTurn();
|
||||
|
||||
expect(snorlax.status?.effect).toBe(StatusEffect.SLEEP);
|
||||
|
||||
// Turn 3
|
||||
game.move.select(Moves.REST);
|
||||
await game.toNextTurn();
|
||||
|
||||
expect(snorlax.status?.effect).toBe(StatusEffect.SLEEP);
|
||||
|
||||
// Turn 4 (wakeup)
|
||||
game.move.select(Moves.REST);
|
||||
await game.toNextTurn();
|
||||
|
||||
|
@ -61,7 +61,7 @@ describe("Moves - Sleep Talk", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("should fail when the user is not asleep", async () => {
|
||||
it("should fail if the user is not asleep", async () => {
|
||||
game.override.statusEffect(StatusEffect.NONE);
|
||||
await game.classicMode.startBattle([Species.FEEBAS]);
|
||||
|
||||
@ -70,6 +70,18 @@ describe("Moves - Sleep Talk", () => {
|
||||
expect(game.scene.getPlayerPokemon()!.getLastXMoves()[0].result).toBe(MoveResult.FAIL);
|
||||
});
|
||||
|
||||
it("should fail the turn the user wakes up from Sleep", async () => {
|
||||
await game.classicMode.startBattle([Species.FEEBAS]);
|
||||
|
||||
const feebas = game.scene.getPlayerPokemon()!;
|
||||
expect(feebas.status?.effect).toBe(StatusEffect.SLEEP);
|
||||
feebas.status!.sleepTurnsRemaining = 1;
|
||||
|
||||
game.move.select(Moves.SLEEP_TALK);
|
||||
await game.toNextTurn();
|
||||
expect(feebas.getLastXMoves()[0].result).toBe(MoveResult.FAIL);
|
||||
});
|
||||
|
||||
it("should fail if the user has no valid moves", async () => {
|
||||
game.override.moveset([Moves.SLEEP_TALK, Moves.DIG, Moves.METRONOME, Moves.SOLAR_BEAM]);
|
||||
await game.classicMode.startBattle([Species.FEEBAS]);
|
||||
|
Loading…
Reference in New Issue
Block a user