mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-03-10 03:48:27 +00:00
* Update `battle-scene.ts` and `data/field/pokemon.ts` `battle-scene.ts` changes: - `getParty()` renamed to `getPlayerParty()` for clarity - `getNonSwitchedXPokemon()` consolidated into `getXPokemon()` - Some tsdocs were added/updated for `getXParty()`, `getXField()` and `getXPokemon()`; and those functions were explicitly marked as `public` - Helper function `getPokemonAllowedInBattle()` added `pokemon.ts` changes: - `isAllowed()` renamed to `isAllowedInChallenge()` for clarity - A redundant check for an active scene is removed in `isActive()` - Some tsdocs were added/updated for `isFainted()`, `isAllowedInChallenge()`, `isAllowedInBattle()` and `isActive()`; and those functions were explicitly marked as `public` - `isFainted()` now checks for `hp <= 0` instead of `!hp` Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com> * Backport eslint change to reduce merge conflicts * Fix merge issues --------- Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com> Co-authored-by: Tempoanon <163687446+Tempo-anon@users.noreply.github.com>
83 lines
2.2 KiB
TypeScript
83 lines
2.2 KiB
TypeScript
import { Abilities } from "#enums/abilities";
|
|
import { Moves } from "#enums/moves";
|
|
import { Species } from "#enums/species";
|
|
import GameManager from "#test/utils/gameManager";
|
|
import Phaser from "phaser";
|
|
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
|
|
|
|
|
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
|
|
.battleType("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);
|
|
|
|
});
|