pokerogue/test/abilities/intimidate.test.ts
Bertie690 12fbff71d2
[Test] Added tests for Intimidate, Fishious Rend/Bolt Beak, Payback and Moongeist Beam & co. (#5858)
* Added additional tests for intimidate & ability-ignoring moves

* Added a few basic tests for Fishious Rend and Bolt Beak

* Fixed comment

* Fixe test and added commetn

* Update first-attack-double-power.test.ts

* Fixed incorrect ignore-abilities.test.ts test suite description

* Update ignore-abilities.test.ts suite name

* Fix first-attack-double-power.test.ts

* Actually fixed import

* Update intimidate.test.ts

* Fix test imprts

* Added guard dog tests

* Fixed tests

* Renamed test file

* Added Payback tests

* Fixed accidental unusde class

* Fixed tests

* Fixed flaky test due to 1 length trainer thing

* dd

---------

Co-authored-by: Wlowscha <54003515+Wlowscha@users.noreply.github.com>
2025-07-13 05:55:05 +00:00

91 lines
2.8 KiB
TypeScript

import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import Phaser from "phaser";
import GameManager from "#test/testUtils/gameManager";
import { Stat } from "#enums/stat";
import { AbilityId } from "#enums/ability-id";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
import { BattleType } from "#enums/battle-type";
describe("Abilities - Intimidate", () => {
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)
.enemyAbility(AbilityId.INTIMIDATE)
.ability(AbilityId.INTIMIDATE)
.passiveAbility(AbilityId.NO_GUARD)
.enemyMoveset(MoveId.SPLASH);
});
it("should lower all opponents' ATK by 1 stage on entry and switch", async () => {
await game.classicMode.startBattle([SpeciesId.MIGHTYENA, SpeciesId.POOCHYENA]);
const enemy = game.field.getEnemyPokemon();
expect(enemy.getStatStage(Stat.ATK)).toBe(-1);
game.doSwitchPokemon(1);
await game.toNextTurn();
expect(enemy.getStatStage(Stat.ATK)).toBe(-2);
});
it("should lower ATK of all opponents in a double battle", async () => {
game.override.battleStyle("double");
await game.classicMode.startBattle([SpeciesId.MIGHTYENA]);
const [enemy1, enemy2] = game.scene.getEnemyField();
expect(enemy1.getStatStage(Stat.ATK)).toBe(-1);
expect(enemy2.getStatStage(Stat.ATK)).toBe(-1);
});
it("should not trigger on switching moves used by wild Pokemon", async () => {
game.override.enemyMoveset(MoveId.VOLT_SWITCH).battleType(BattleType.WILD);
await game.classicMode.startBattle([SpeciesId.MIGHTYENA]);
const player = game.field.getPlayerPokemon();
expect(player.getStatStage(Stat.ATK)).toBe(-1);
game.move.use(MoveId.SPLASH);
await game.toNextTurn();
// doesn't lower attack due to not actually switching out
expect(player.getStatStage(Stat.ATK)).toBe(-1);
});
it("should trigger on moves that switch user/target out during trainer battles", async () => {
game.override.battleType(BattleType.TRAINER).startingWave(50);
await game.classicMode.startBattle([SpeciesId.MIGHTYENA]);
const player = game.field.getPlayerPokemon();
expect(player.getStatStage(Stat.ATK)).toBe(-1);
game.move.use(MoveId.SPLASH);
await game.move.forceEnemyMove(MoveId.TELEPORT);
await game.toNextTurn();
expect(player.getStatStage(Stat.ATK)).toBe(-2);
game.move.use(MoveId.DRAGON_TAIL);
await game.move.forceEnemyMove(MoveId.SPLASH);
await game.toNextTurn();
expect(player.getStatStage(Stat.ATK)).toBe(-3);
});
});