mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-04-26 03:25:00 +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>
87 lines
2.7 KiB
TypeScript
87 lines
2.7 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";
|
|
|
|
describe("Moves - Endure", () => {
|
|
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
|
|
.moveset([Moves.THUNDER, Moves.BULLET_SEED, Moves.TOXIC, Moves.SHEER_COLD])
|
|
.ability(Abilities.SKILL_LINK)
|
|
.startingLevel(100)
|
|
.battleStyle("single")
|
|
.disableCrits()
|
|
.enemySpecies(Species.MAGIKARP)
|
|
.enemyAbility(Abilities.NO_GUARD)
|
|
.enemyMoveset(Moves.ENDURE);
|
|
});
|
|
|
|
it("should let the pokemon survive with 1 HP", async () => {
|
|
await game.classicMode.startBattle([Species.ARCEUS]);
|
|
|
|
game.move.select(Moves.THUNDER);
|
|
await game.phaseInterceptor.to("BerryPhase");
|
|
|
|
expect(game.scene.getEnemyPokemon()!.hp).toBe(1);
|
|
});
|
|
|
|
it("should let the pokemon survive with 1 HP when hit with a multihit move", async () => {
|
|
await game.classicMode.startBattle([Species.ARCEUS]);
|
|
|
|
game.move.select(Moves.BULLET_SEED);
|
|
await game.phaseInterceptor.to("BerryPhase");
|
|
|
|
expect(game.scene.getEnemyPokemon()!.hp).toBe(1);
|
|
});
|
|
|
|
it("should let the pokemon survive against OHKO moves", async () => {
|
|
await game.classicMode.startBattle([Species.MAGIKARP]);
|
|
const enemy = game.scene.getEnemyPokemon()!;
|
|
|
|
game.move.select(Moves.SHEER_COLD);
|
|
await game.phaseInterceptor.to("TurnEndPhase");
|
|
|
|
expect(enemy.isFainted()).toBeFalsy();
|
|
});
|
|
|
|
// comprehensive indirect damage test copied from Reviver Seed test
|
|
it.each([
|
|
{ moveType: "Damaging Move Chip Damage", move: Moves.SALT_CURE },
|
|
{ moveType: "Chip Damage", move: Moves.LEECH_SEED },
|
|
{ moveType: "Trapping Chip Damage", move: Moves.WHIRLPOOL },
|
|
{ moveType: "Status Effect Damage", move: Moves.TOXIC },
|
|
{ moveType: "Weather", move: Moves.SANDSTORM },
|
|
])("should not prevent fainting from $moveType", async ({ move }) => {
|
|
game.override
|
|
.enemyLevel(1)
|
|
.startingLevel(100)
|
|
.enemySpecies(Species.MAGIKARP)
|
|
.moveset(move)
|
|
.enemyMoveset(Moves.ENDURE);
|
|
await game.classicMode.startBattle([Species.MAGIKARP, Species.FEEBAS]);
|
|
const enemy = game.scene.getEnemyPokemon()!;
|
|
enemy.damageAndUpdate(enemy.hp - 1);
|
|
|
|
game.move.select(move);
|
|
await game.phaseInterceptor.to("TurnEndPhase");
|
|
|
|
expect(enemy.isFainted()).toBeTruthy();
|
|
});
|
|
});
|