mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-30 05:22:44 +02:00
* Rename `Abilities` to `AbilityId` * Rename `abilities.ts` to `ability-id.ts` * Rename `Moves` to `MoveId` * Rename `moves.ts` to `move-id.ts` * Rename `Species` to `SpeciesId` * Rename `species.ts` to `species-id.ts` * Rename `Biome` to `BiomeId` * Rename `biome.ts` to `biome-id.ts` * Replace `Abilities` with `AbilityId` in comments * Replace `Biome` with `BiomeId` in comments * Replace `Moves` with `MoveId` in comments * Replace `Species` with `SpeciesId` in comments
71 lines
2.0 KiB
TypeScript
71 lines
2.0 KiB
TypeScript
import { MoveId } from "#enums/move-id";
|
|
import { SpeciesId } from "#enums/species-id";
|
|
import { MoveEffectPhase } from "#app/phases/move-effect-phase";
|
|
import GameManager from "#test/testUtils/gameManager";
|
|
import Phaser from "phaser";
|
|
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
|
|
|
describe("Moves - Foresight", () => {
|
|
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(SpeciesId.GASTLY)
|
|
.enemyMoveset(MoveId.SPLASH)
|
|
.enemyLevel(5)
|
|
.starterSpecies(SpeciesId.MAGIKARP)
|
|
.moveset([MoveId.FORESIGHT, MoveId.QUICK_ATTACK, MoveId.MACH_PUNCH]);
|
|
});
|
|
|
|
it("should allow Normal and Fighting moves to hit Ghost types", async () => {
|
|
await game.classicMode.startBattle();
|
|
|
|
const enemy = game.scene.getEnemyPokemon()!;
|
|
|
|
game.move.select(MoveId.QUICK_ATTACK);
|
|
await game.toNextTurn();
|
|
expect(enemy.hp).toBe(enemy.getMaxHp());
|
|
|
|
game.move.select(MoveId.FORESIGHT);
|
|
await game.toNextTurn();
|
|
game.move.select(MoveId.QUICK_ATTACK);
|
|
await game.toNextTurn();
|
|
|
|
expect(enemy.hp).toBeLessThan(enemy.getMaxHp());
|
|
enemy.hp = enemy.getMaxHp();
|
|
|
|
game.move.select(MoveId.MACH_PUNCH);
|
|
await game.phaseInterceptor.to(MoveEffectPhase);
|
|
|
|
expect(enemy.hp).toBeLessThan(enemy.getMaxHp());
|
|
});
|
|
|
|
it("should ignore target's evasiveness boosts", async () => {
|
|
game.override.enemyMoveset([MoveId.MINIMIZE]);
|
|
await game.classicMode.startBattle();
|
|
|
|
const pokemon = game.scene.getPlayerPokemon()!;
|
|
vi.spyOn(pokemon, "getAccuracyMultiplier");
|
|
|
|
game.move.select(MoveId.FORESIGHT);
|
|
await game.toNextTurn();
|
|
game.move.select(MoveId.QUICK_ATTACK);
|
|
await game.phaseInterceptor.to(MoveEffectPhase);
|
|
|
|
expect(pokemon.getAccuracyMultiplier).toHaveReturnedWith(1);
|
|
});
|
|
});
|