mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-04-27 12:03:59 +01:00
* Add isPartner method to trainer class * Ensure force switches cannot pull pokemon from the wrong trainer * Add override for battle type * Fixup tests and broken assumptions * Make move fail override semi-invuln check Bandaid fix because move effect phase does not allow for the move to fail if all of its conditions fail * Restore overrides * Apply kev's suggestions from code review Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Fix illusion test battle type invocation * Update struggle and healer tests to use battleStyle --------- Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
95 lines
2.8 KiB
TypeScript
95 lines
2.8 KiB
TypeScript
import { Abilities } from "#enums/abilities";
|
|
import { Moves } from "#enums/moves";
|
|
import { Species } from "#enums/species";
|
|
import GameManager from "#test/testUtils/gameManager";
|
|
import Phaser from "phaser";
|
|
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
|
import { ArenaTagSide, ArenaTrapTag } from "#app/data/arena-tag";
|
|
|
|
describe("Moves - Spikes", () => {
|
|
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(Species.MAGIKARP)
|
|
.enemyAbility(Abilities.BALL_FETCH)
|
|
.ability(Abilities.BALL_FETCH)
|
|
.enemyMoveset(Moves.SPLASH)
|
|
.moveset([Moves.SPIKES, Moves.SPLASH, Moves.ROAR]);
|
|
});
|
|
|
|
it("should not damage the team that set them", async () => {
|
|
await game.startBattle([Species.MIGHTYENA, Species.POOCHYENA]);
|
|
|
|
game.move.select(Moves.SPIKES);
|
|
await game.toNextTurn();
|
|
|
|
game.move.select(Moves.SPLASH);
|
|
await game.toNextTurn();
|
|
|
|
game.doSwitchPokemon(1);
|
|
await game.toNextTurn();
|
|
|
|
game.doSwitchPokemon(1);
|
|
await game.toNextTurn();
|
|
|
|
const player = game.scene.getPlayerParty()[0];
|
|
expect(player.hp).toBe(player.getMaxHp());
|
|
}, 20000);
|
|
|
|
it("should damage opposing pokemon that are forced to switch in", async () => {
|
|
game.override.startingWave(5);
|
|
await game.startBattle([Species.MIGHTYENA, Species.POOCHYENA]);
|
|
|
|
game.move.select(Moves.SPIKES);
|
|
await game.toNextTurn();
|
|
|
|
game.move.select(Moves.ROAR);
|
|
await game.toNextTurn();
|
|
|
|
const enemy = game.scene.getEnemyParty()[0];
|
|
expect(enemy.hp).toBeLessThan(enemy.getMaxHp());
|
|
}, 20000);
|
|
|
|
it("should damage opposing pokemon that choose to switch in", async () => {
|
|
game.override.startingWave(5);
|
|
await game.startBattle([Species.MIGHTYENA, Species.POOCHYENA]);
|
|
|
|
game.move.select(Moves.SPIKES);
|
|
await game.toNextTurn();
|
|
|
|
game.move.select(Moves.SPLASH);
|
|
game.forceEnemyToSwitch();
|
|
await game.toNextTurn();
|
|
|
|
const enemy = game.scene.getEnemyParty()[0];
|
|
expect(enemy.hp).toBeLessThan(enemy.getMaxHp());
|
|
}, 20000);
|
|
|
|
it("should work when all targets fainted", async () => {
|
|
game.override.enemySpecies(Species.DIGLETT);
|
|
game.override.battleStyle("double");
|
|
game.override.startingLevel(50);
|
|
await game.classicMode.startBattle([Species.RAYQUAZA, Species.ROWLET]);
|
|
|
|
game.move.select(Moves.EARTHQUAKE);
|
|
game.move.select(Moves.SPIKES, 1);
|
|
await game.phaseInterceptor.to("TurnEndPhase");
|
|
|
|
expect(game.scene.arena.getTagOnSide(ArenaTrapTag, ArenaTagSide.ENEMY)).toBeDefined();
|
|
}, 20000);
|
|
});
|