pokerogue/test/phases/check-biome-end-phase.test.ts
NightKev 10b9cfcdb0
[Balance] End of turn triggers won't occur when you end a biome (#6169)
* [Balance] End of turn triggers won't occur when you end a biome

* Add tests

* Move phase manipulation logic into `PhaseManager`

* Rename "biome end" to "interlude"

* Rename `TurnEndPhase#endOfBiome` to `upcomingInterlude`

---------

Co-authored-by: Wlowscha <54003515+Wlowscha@users.noreply.github.com>
2025-07-29 22:50:57 +00:00

63 lines
1.8 KiB
TypeScript

import { AbilityId } from "#enums/ability-id";
import { BerryType } from "#enums/berry-type";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
import { WeatherType } from "#enums/weather-type";
import { GameManager } from "#test/test-utils/game-manager";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
describe("Check Biome End Phase", () => {
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
.enemySpecies(SpeciesId.MAGIKARP)
.enemyMoveset(MoveId.SPLASH)
.enemyAbility(AbilityId.BALL_FETCH)
.ability(AbilityId.BALL_FETCH)
.startingLevel(100);
});
it("should not trigger end of turn effects when defeating the final pokemon of a biome in classic", async () => {
game.override
.startingWave(10)
.weather(WeatherType.SANDSTORM)
.startingHeldItems([{ name: "BERRY", type: BerryType.SITRUS }]);
await game.classicMode.startBattle([SpeciesId.FEEBAS]);
const player = game.field.getPlayerPokemon();
player.hp = 1;
game.move.use(MoveId.EXTREME_SPEED);
await game.toEndOfTurn();
expect(player.hp).toBe(1);
});
it("should not prevent end of turn effects when transitioning waves within a biome", async () => {
game.override.weather(WeatherType.SANDSTORM);
await game.classicMode.startBattle([SpeciesId.FEEBAS]);
const player = game.field.getPlayerPokemon();
game.move.use(MoveId.EXTREME_SPEED);
await game.toEndOfTurn();
expect(player.hp).toBeLessThan(player.getMaxHp());
});
});