2024-08-07 07:59:28 -07:00
|
|
|
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
|
|
|
import Phaser from "phaser";
|
|
|
|
import GameManager from "#test/utils/gameManager";
|
|
|
|
import { Species } from "#app/enums/species.js";
|
2024-08-09 23:07:55 +08:00
|
|
|
import { SPLASH_ONLY } from "../utils/testUtils";
|
2024-08-07 07:59:28 -07:00
|
|
|
import { Moves } from "#app/enums/moves.js";
|
|
|
|
import { getMovePosition } from "../utils/gameManagerUtils";
|
2024-08-08 11:02:02 -07:00
|
|
|
import { BattlerIndex } from "#app/battle.js";
|
2024-08-19 03:23:52 +01:00
|
|
|
import { MoveEffectPhase } from "#app/phases/move-effect-phase.js";
|
2024-08-07 07:59:28 -07:00
|
|
|
|
2024-08-11 21:54:42 -07:00
|
|
|
describe("Moves - Miracle Eye", () => {
|
2024-08-07 07:59:28 -07:00
|
|
|
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
|
|
|
|
.disableCrits()
|
|
|
|
.enemySpecies(Species.UMBREON)
|
|
|
|
.enemyMoveset(SPLASH_ONLY)
|
|
|
|
.enemyLevel(5)
|
|
|
|
.starterSpecies(Species.MAGIKARP)
|
|
|
|
.moveset([Moves.MIRACLE_EYE, Moves.CONFUSION]);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should allow Psychic moves to hit Dark types", async () => {
|
|
|
|
await game.startBattle();
|
|
|
|
|
2024-08-07 09:23:12 -07:00
|
|
|
const enemy = game.scene.getEnemyPokemon()!;
|
2024-08-07 07:59:28 -07:00
|
|
|
|
|
|
|
game.doAttack(getMovePosition(game.scene, 0, Moves.CONFUSION));
|
2024-08-09 23:07:55 +08:00
|
|
|
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
|
2024-08-07 07:59:28 -07:00
|
|
|
await game.toNextTurn();
|
|
|
|
expect(enemy.hp).toBe(enemy.getMaxHp());
|
|
|
|
|
|
|
|
game.doAttack(getMovePosition(game.scene, 0, Moves.MIRACLE_EYE));
|
|
|
|
await game.toNextTurn();
|
|
|
|
game.doAttack(getMovePosition(game.scene, 0, Moves.CONFUSION));
|
|
|
|
await game.phaseInterceptor.to(MoveEffectPhase);
|
|
|
|
|
|
|
|
expect(enemy.hp).toBeLessThan(enemy.getMaxHp());
|
|
|
|
});
|
|
|
|
});
|