diff --git a/src/test/moves/chilly_reception.test.ts b/src/test/moves/chilly_reception.test.ts index 1b5b5cecb4a..6c8e8172670 100644 --- a/src/test/moves/chilly_reception.test.ts +++ b/src/test/moves/chilly_reception.test.ts @@ -4,6 +4,7 @@ import { Species } from "#enums/species"; import { WeatherType } from "#enums/weather-type"; import GameManager from "#test/utils/gameManager"; import Phaser from "phaser"; +//import { TurnInitPhase } from "#app/phases/turn-init-phase"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; describe("Moves - Chilly Reception", () => { @@ -66,4 +67,58 @@ describe("Moves - Chilly Reception", () => { expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SNOW); expect(game.scene.getPlayerField()[0].species.speciesId).toBe(Species.MEOWTH); }); + + // enemy uses another move and weather doesn't change + it("check case - enemy not selecting chilly reception doesn't change weather ", async () => { + game.override.battleType("single") + .enemyMoveset([Moves.CHILLY_RECEPTION, Moves.TACKLE]) + .enemyAbility(Abilities.NONE) + .moveset(Array(4).fill(Moves.SPLASH)); + + await game.classicMode.startBattle([Species.SLOWKING, Species.MEOWTH]); + + game.move.select(Moves.SPLASH); + await game.forceEnemyMove(Moves.TACKLE); + + await game.phaseInterceptor.to("BerryPhase", false); + expect(game.scene.arena.weather?.weatherType).toBe(undefined); + }); + + it("enemy trainer - expected behavior ", async () => { + game.override.battleType("single") + .startingWave(8) + .enemyMoveset(Array(4).fill(Moves.CHILLY_RECEPTION)) + .enemyAbility(Abilities.NONE) + .enemySpecies(Species.MAGIKARP) + .moveset([Moves.SPLASH, Moves.THUNDERBOLT]); + + await game.classicMode.startBattle([Species.JOLTEON]); + const RIVAL_MAGIKARP1 = game.scene.getEnemyPokemon()?.id; + + game.move.select(Moves.SPLASH); + await game.phaseInterceptor.to("BerryPhase", false); + expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SNOW); + expect(game.scene.getEnemyPokemon()?.id !== RIVAL_MAGIKARP1); + + await game.phaseInterceptor.to("TurnInitPhase", false); + game.move.select(Moves.SPLASH); + + // second chilly reception should still switch out + await game.phaseInterceptor.to("BerryPhase", false); + expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SNOW); + await game.phaseInterceptor.to("TurnInitPhase", false); + expect(game.scene.getEnemyPokemon()?.id === RIVAL_MAGIKARP1); + game.move.select(Moves.THUNDERBOLT); + + // enemy chilly recep move should fail: it's snowing and no option to switch out + // no crashing + await game.phaseInterceptor.to("BerryPhase", false); + expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SNOW); + await game.phaseInterceptor.to("TurnInitPhase", false); + expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SNOW); + game.move.select(Moves.SPLASH); + await game.phaseInterceptor.to("BerryPhase", false); + expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SNOW); + + }); });