2024-09-09 09:55:11 -07:00
|
|
|
import { Moves } from "#app/enums/moves";
|
2024-09-02 22:12:34 -04:00
|
|
|
import { Abilities } from "#enums/abilities";
|
|
|
|
import { Species } from "#enums/species";
|
2024-09-09 09:55:11 -07:00
|
|
|
import { Stat } from "#enums/stat";
|
2025-02-22 22:52:07 -06:00
|
|
|
import GameManager from "#test/testUtils/gameManager";
|
2024-09-02 22:12:34 -04:00
|
|
|
import Phaser from "phaser";
|
|
|
|
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
|
|
|
|
|
|
|
describe("Abilities - Contrary", () => {
|
|
|
|
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
|
|
|
|
.battleType("single")
|
|
|
|
.enemySpecies(Species.BULBASAUR)
|
|
|
|
.enemyAbility(Abilities.CONTRARY)
|
|
|
|
.ability(Abilities.INTIMIDATE)
|
2024-09-09 09:55:11 -07:00
|
|
|
.enemyMoveset(Moves.SPLASH);
|
2024-09-02 22:12:34 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
it("should invert stat changes when applied", async() => {
|
2024-09-17 19:14:41 -07:00
|
|
|
await game.classicMode.startBattle([
|
2024-09-02 22:12:34 -04:00
|
|
|
Species.SLOWBRO
|
|
|
|
]);
|
|
|
|
|
|
|
|
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
|
|
|
|
|
|
|
expect(enemyPokemon.getStatStage(Stat.ATK)).toBe(1);
|
|
|
|
}, 20000);
|
2024-09-17 19:14:41 -07:00
|
|
|
|
|
|
|
describe("With Clear Body", () => {
|
|
|
|
it("should apply positive effects", async () => {
|
|
|
|
game.override
|
|
|
|
.enemyPassiveAbility(Abilities.CLEAR_BODY)
|
2024-10-04 13:08:31 +08:00
|
|
|
.moveset([ Moves.TAIL_WHIP ]);
|
|
|
|
await game.classicMode.startBattle([ Species.SLOWBRO ]);
|
2024-09-17 19:14:41 -07:00
|
|
|
|
|
|
|
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
|
|
|
|
|
|
|
expect(enemyPokemon.getStatStage(Stat.ATK)).toBe(1);
|
|
|
|
|
|
|
|
game.move.select(Moves.TAIL_WHIP);
|
|
|
|
await game.phaseInterceptor.to("TurnEndPhase");
|
|
|
|
|
|
|
|
expect(enemyPokemon.getStatStage(Stat.DEF)).toBe(1);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should block negative effects", async () => {
|
|
|
|
game.override
|
|
|
|
.enemyPassiveAbility(Abilities.CLEAR_BODY)
|
2024-10-04 13:08:31 +08:00
|
|
|
.enemyMoveset([ Moves.HOWL, Moves.HOWL, Moves.HOWL, Moves.HOWL ])
|
|
|
|
.moveset([ Moves.SPLASH ]);
|
|
|
|
await game.classicMode.startBattle([ Species.SLOWBRO ]);
|
2024-09-17 19:14:41 -07:00
|
|
|
|
|
|
|
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
|
|
|
|
|
|
|
expect(enemyPokemon.getStatStage(Stat.ATK)).toBe(1);
|
|
|
|
|
|
|
|
game.move.select(Moves.SPLASH);
|
|
|
|
await game.phaseInterceptor.to("TurnEndPhase");
|
|
|
|
|
|
|
|
expect(enemyPokemon.getStatStage(Stat.ATK)).toBe(1);
|
|
|
|
});
|
|
|
|
});
|
2024-09-02 22:12:34 -04:00
|
|
|
});
|