pokerogue/test/moves/baneful-bunker.test.ts
Bertie690 8ae79450d4
[Test] Fix even more game.scene.getXXX issues (#6811)
* [Test] Fixed even more `game.scene.getXXX` issues

* Update fell-stinger.test.ts

Co-authored-by: Fabi <192151969+fabske0@users.noreply.github.com>

* Applied review comments

* fixed doodle test inconsistencies

* fix

* applied reviews

not going too ham will make another PR later

---------

Co-authored-by: Fabi <192151969+fabske0@users.noreply.github.com>
2025-12-04 01:49:47 +00:00

77 lines
2.3 KiB
TypeScript

import { AbilityId } from "#enums/ability-id";
import { BattlerIndex } from "#enums/battler-index";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
import { StatusEffect } from "#enums/status-effect";
import { GameManager } from "#test/test-utils/game-manager";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
describe("Moves - Baneful Bunker", () => {
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")
.moveset([MoveId.SLASH, MoveId.FLASH_CANNON])
.enemySpecies(SpeciesId.TOXAPEX)
.enemyAbility(AbilityId.INSOMNIA)
.enemyMoveset(MoveId.BANEFUL_BUNKER)
.startingLevel(100)
.enemyLevel(100);
});
function expectProtected() {
expect(game.field.getEnemyPokemon().hp).toBe(game.field.getEnemyPokemon().getMaxHp());
expect(game.field.getPlayerPokemon().status?.effect).toBe(StatusEffect.POISON);
}
it("should protect the user and poison attackers that make contact", async () => {
await game.classicMode.startBattle([SpeciesId.CHARIZARD]);
game.move.select(MoveId.SLASH);
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
await game.phaseInterceptor.to("BerryPhase", false);
expectProtected();
});
it("should ignore accuracy checks", async () => {
await game.classicMode.startBattle([SpeciesId.CHARIZARD]);
game.move.select(MoveId.SLASH);
await game.phaseInterceptor.to("MoveEndPhase"); // baneful bunker
await game.move.forceMiss();
await game.phaseInterceptor.to("BerryPhase", false);
expectProtected();
});
it("should block non-contact moves without poisoning attackers", async () => {
await game.classicMode.startBattle([SpeciesId.CHARIZARD]);
const charizard = game.field.getPlayerPokemon();
const toxapex = game.field.getEnemyPokemon();
game.move.select(MoveId.FLASH_CANNON);
await game.phaseInterceptor.to("BerryPhase", false);
expect(toxapex.hp).toBe(toxapex.getMaxHp());
expect(charizard.status?.effect).toBeUndefined();
});
});