diff --git a/src/ui/battle-info/battle-info.ts b/src/ui/battle-info/battle-info.ts index 66e0830a731..3daa0f68918 100644 --- a/src/ui/battle-info/battle-info.ts +++ b/src/ui/battle-info/battle-info.ts @@ -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); diff --git a/test/moves/clear-smog.test.ts b/test/moves/clear-smog.test.ts new file mode 100644 index 00000000000..7e8d5b6ff8a --- /dev/null +++ b/test/moves/clear-smog.test.ts @@ -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); + }); +});