mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-12-15 06:15:20 +01:00
[Bug] Stats that were reset from moves display properly as being reset
https://github.com/pagefaultgames/pokerogue/pull/6650 * Stats display properly after moves reset stats * Update test/moves/clear-smog.test.ts Co-authored-by: Bertie690 <136088738+Bertie690@users.noreply.github.com> * Removed unnecessary test for Clear Smog --------- Co-authored-by: Bertie690 <136088738+Bertie690@users.noreply.github.com>
This commit is contained in:
parent
71c1f44f91
commit
7d8ccfb745
@ -595,7 +595,7 @@ export abstract class BattleInfo extends Phaser.GameObjects.Container {
|
||||
this.setTypes(pokemon.getTypes(true, false, undefined, true));
|
||||
|
||||
if (this.lastHp !== pokemon.hp || this.lastMaxHp !== pokemon.getMaxHp()) {
|
||||
return this.updatePokemonHp(pokemon, resolve, instant);
|
||||
this.updatePokemonHp(pokemon, resolve, instant);
|
||||
}
|
||||
if (!this.player && this.lastLevel !== pokemon.level) {
|
||||
this.setLevel(pokemon.level);
|
||||
|
||||
54
test/moves/clear-smog.test.ts
Normal file
54
test/moves/clear-smog.test.ts
Normal file
@ -0,0 +1,54 @@
|
||||
import { AbilityId } from "#enums/ability-id";
|
||||
import { MoveId } from "#enums/move-id";
|
||||
import { SpeciesId } from "#enums/species-id";
|
||||
import { Stat } from "#enums/stat";
|
||||
import { GameManager } from "#test/test-utils/game-manager";
|
||||
import Phaser from "phaser";
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
||||
|
||||
describe("Moves - Clear Smog", () => {
|
||||
let phaserGame: Phaser.Game;
|
||||
let game: GameManager;
|
||||
|
||||
beforeAll(() => {
|
||||
phaserGame = new Phaser.Game({ type: Phaser.HEADLESS });
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
game.phaseInterceptor.restoreOg();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
game = new GameManager(phaserGame);
|
||||
|
||||
game.override
|
||||
.battleStyle("single")
|
||||
.enemySpecies(SpeciesId.RATTATA)
|
||||
.enemyLevel(100)
|
||||
.enemyMoveset(MoveId.SWORDS_DANCE)
|
||||
.enemyAbility(AbilityId.BALL_FETCH)
|
||||
.startingLevel(100)
|
||||
.ability(AbilityId.BALL_FETCH);
|
||||
});
|
||||
|
||||
it("should clear stat changes of target", async () => {
|
||||
await game.classicMode.startBattle([SpeciesId.RATTATA]);
|
||||
const enemy = game.field.getEnemyPokemon();
|
||||
|
||||
expect(enemy).toHaveStatStage(Stat.ATK, 0);
|
||||
expect(enemy).toHaveStatStage(Stat.ACC, 0);
|
||||
|
||||
game.move.use(MoveId.SAND_ATTACK);
|
||||
await game.toNextTurn();
|
||||
|
||||
expect(enemy).toHaveStatStage(Stat.ATK, 2);
|
||||
expect(enemy).toHaveStatStage(Stat.ACC, -1);
|
||||
|
||||
game.move.use(MoveId.CLEAR_SMOG);
|
||||
await game.move.forceEnemyMove(MoveId.SPLASH);
|
||||
await game.toNextTurn();
|
||||
|
||||
expect(enemy).toHaveStatStage(Stat.ATK, 0);
|
||||
expect(enemy).toHaveStatStage(Stat.ACC, 0);
|
||||
});
|
||||
});
|
||||
Loading…
Reference in New Issue
Block a user