mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-29 04:52:43 +02: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>
86 lines
2.5 KiB
TypeScript
86 lines
2.5 KiB
TypeScript
import { BattlerIndex } from "#app/battle";
|
|
import { isBetween } from "#app/utils";
|
|
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("Abilities - Stakeout", () => {
|
|
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.SPLASH, Moves.SURF])
|
|
.ability(Abilities.STAKEOUT)
|
|
.battleStyle("single")
|
|
.disableCrits()
|
|
.startingLevel(100)
|
|
.enemyLevel(100)
|
|
.enemySpecies(Species.SNORLAX)
|
|
.enemyAbility(Abilities.BALL_FETCH)
|
|
.enemyMoveset([Moves.SPLASH, Moves.FLIP_TURN])
|
|
.startingWave(5);
|
|
});
|
|
|
|
it("should do double damage to a pokemon that switched out", async () => {
|
|
await game.classicMode.startBattle([Species.MILOTIC]);
|
|
|
|
const [enemy1] = game.scene.getEnemyParty();
|
|
|
|
game.move.select(Moves.SURF);
|
|
await game.forceEnemyMove(Moves.SPLASH);
|
|
await game.toNextTurn();
|
|
const damage1 = enemy1.getInverseHp();
|
|
enemy1.hp = enemy1.getMaxHp();
|
|
|
|
game.move.select(Moves.SPLASH);
|
|
game.forceEnemyToSwitch();
|
|
await game.toNextTurn();
|
|
|
|
game.move.select(Moves.SURF);
|
|
game.forceEnemyToSwitch();
|
|
await game.toNextTurn();
|
|
|
|
expect(enemy1.isFainted()).toBe(false);
|
|
expect(isBetween(enemy1.getInverseHp(), damage1 * 2 - 5, damage1 * 2 + 5)).toBe(true);
|
|
});
|
|
|
|
it("should do double damage to a pokemon that switched out via U-Turn/etc", async () => {
|
|
await game.classicMode.startBattle([Species.MILOTIC]);
|
|
|
|
const [enemy1] = game.scene.getEnemyParty();
|
|
|
|
game.move.select(Moves.SURF);
|
|
await game.forceEnemyMove(Moves.SPLASH);
|
|
await game.toNextTurn();
|
|
const damage1 = enemy1.getInverseHp();
|
|
enemy1.hp = enemy1.getMaxHp();
|
|
|
|
game.move.select(Moves.SPLASH);
|
|
await game.forceEnemyMove(Moves.FLIP_TURN);
|
|
await game.toNextTurn();
|
|
|
|
game.move.select(Moves.SURF);
|
|
await game.forceEnemyMove(Moves.FLIP_TURN);
|
|
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
|
|
await game.toNextTurn();
|
|
|
|
expect(enemy1.isFainted()).toBe(false);
|
|
expect(isBetween(enemy1.getInverseHp(), damage1 * 2 - 5, damage1 * 2 + 5)).toBe(true);
|
|
});
|
|
});
|