[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:
Anthony 2025-10-22 16:25:14 -07:00 committed by GitHub
parent 71c1f44f91
commit 7d8ccfb745
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 55 additions and 1 deletions

View File

@ -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);

View 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);
});
});