mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-10-26 22:15:52 +01: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>
62 lines
2.0 KiB
TypeScript
62 lines
2.0 KiB
TypeScript
import { CommandPhase } from "#app/phases/command-phase";
|
|
import { TurnEndPhase } from "#app/phases/turn-end-phase";
|
|
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 - Magnet Rise", () => {
|
|
let phaserGame: Phaser.Game;
|
|
let game: GameManager;
|
|
const moveToUse = Moves.MAGNET_RISE;
|
|
|
|
beforeAll(() => {
|
|
phaserGame = new Phaser.Game({
|
|
type: Phaser.HEADLESS,
|
|
});
|
|
});
|
|
|
|
afterEach(() => {
|
|
game.phaseInterceptor.restoreOg();
|
|
});
|
|
|
|
beforeEach(() => {
|
|
game = new GameManager(phaserGame);
|
|
game.override.battleType("single");
|
|
game.override.starterSpecies(Species.MAGNEZONE);
|
|
game.override.enemySpecies(Species.RATTATA);
|
|
game.override.enemyMoveset([ Moves.DRILL_RUN, Moves.DRILL_RUN, Moves.DRILL_RUN, Moves.DRILL_RUN ]);
|
|
game.override.disableCrits();
|
|
game.override.enemyLevel(1);
|
|
game.override.moveset([ moveToUse, Moves.SPLASH, Moves.GRAVITY, Moves.BATON_PASS ]);
|
|
});
|
|
|
|
it("MAGNET RISE", async () => {
|
|
await game.startBattle();
|
|
|
|
const startingHp = game.scene.getPlayerParty()[0].hp;
|
|
game.move.select(moveToUse);
|
|
await game.phaseInterceptor.to(TurnEndPhase);
|
|
const finalHp = game.scene.getPlayerParty()[0].hp;
|
|
const hpLost = finalHp - startingHp;
|
|
expect(hpLost).toBe(0);
|
|
}, 20000);
|
|
|
|
it("MAGNET RISE - Gravity", async () => {
|
|
await game.startBattle();
|
|
|
|
const startingHp = game.scene.getPlayerParty()[0].hp;
|
|
game.move.select(moveToUse);
|
|
await game.phaseInterceptor.to(CommandPhase);
|
|
let finalHp = game.scene.getPlayerParty()[0].hp;
|
|
let hpLost = finalHp - startingHp;
|
|
expect(hpLost).toBe(0);
|
|
game.move.select(Moves.GRAVITY);
|
|
await game.phaseInterceptor.to(TurnEndPhase);
|
|
finalHp = game.scene.getPlayerParty()[0].hp;
|
|
hpLost = finalHp - startingHp;
|
|
expect(hpLost).not.toBe(0);
|
|
}, 20000);
|
|
});
|