mauybe fixed tests

This commit is contained in:
Bertie690 2025-06-24 19:35:22 -04:00
parent 999801160d
commit a7676fd33c
2 changed files with 12 additions and 14 deletions

View File

@ -126,21 +126,20 @@ describe("Moves - Instruct", () => {
expect(game.scene.getPlayerPokemon()!.turnData.attacksReceived.length).toBe(2); expect(game.scene.getPlayerPokemon()!.turnData.attacksReceived.length).toBe(2);
}); });
it("should add moves to move queue for copycat", async () => { it("should be considered as the last move used for copycat", async () => {
game.override.battleStyle("double").moveset(MoveId.INSTRUCT).enemyLevel(5); game.override.battleStyle("double").enemyLevel(5);
await game.classicMode.startBattle([SpeciesId.AMOONGUSS]); await game.classicMode.startBattle([SpeciesId.AMOONGUSS]);
const [enemy1, enemy2] = game.scene.getEnemyField()!; const [enemy1, enemy2] = game.scene.getEnemyField()!;
game.move.changeMoveset(enemy1, MoveId.WATER_GUN); game.move.changeMoveset(enemy1, MoveId.WATER_GUN);
game.move.changeMoveset(enemy2, MoveId.COPYCAT); game.move.changeMoveset(enemy2, MoveId.COPYCAT);
game.move.select(MoveId.INSTRUCT, BattlerIndex.PLAYER, BattlerIndex.ENEMY); game.move.use(MoveId.INSTRUCT, BattlerIndex.PLAYER, BattlerIndex.ENEMY);
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER, BattlerIndex.ENEMY_2]); await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER, BattlerIndex.ENEMY_2]);
await game.phaseInterceptor.to("BerryPhase"); await game.phaseInterceptor.to("BerryPhase");
instructSuccess(enemy1, MoveId.WATER_GUN); instructSuccess(enemy1, MoveId.WATER_GUN);
// amoonguss gets hit by water gun thrice; once by original attack, once by instructed use and once by copycat expect(enemy2.getLastXMoves()[0].move).toBe(MoveId.WATER_GUN);
expect(game.scene.getPlayerPokemon()!.turnData.attacksReceived.length).toBe(3);
}); });
it("should fail on metronomed moves, even if also in moveset", async () => { it("should fail on metronomed moves, even if also in moveset", async () => {

View File

@ -11,13 +11,12 @@ import { SpeciesId } from "#enums/species-id";
import GameManager from "#test/testUtils/gameManager"; import GameManager from "#test/testUtils/gameManager";
import Phaser from "phaser"; import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, it, expect, vi } from "vitest"; import { afterEach, beforeAll, beforeEach, describe, it, expect, vi } from "vitest";
import { RandomMoveAttr } from "#app/data/moves/move";
describe("Moves - Metronome", () => { describe("Moves - Metronome", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;
let game: GameManager; let game: GameManager;
const randomMoveAttr = allMoves[MoveId.METRONOME].getAttrs("RandomMoveAttr")[0];
beforeAll(() => { beforeAll(() => {
phaserGame = new Phaser.Game({ phaserGame = new Phaser.Game({
type: Phaser.HEADLESS, type: Phaser.HEADLESS,
@ -55,7 +54,7 @@ describe("Moves - Metronome", () => {
}); });
it("should become semi-invulnerable when using phasing moves", async () => { it("should become semi-invulnerable when using phasing moves", async () => {
vi.spyOn(randomMoveAttr, "getMove").mockReturnValue(MoveId.DIVE); vi.spyOn(RandomMoveAttr.prototype, "getMove").mockReturnValue(MoveId.DIVE);
await game.classicMode.startBattle([SpeciesId.REGIELEKI]); await game.classicMode.startBattle([SpeciesId.REGIELEKI]);
const player = game.field.getPlayerPokemon(); const player = game.field.getPlayerPokemon();
@ -77,7 +76,7 @@ describe("Moves - Metronome", () => {
}); });
it("should apply secondary effects of the called move", async () => { it("should apply secondary effects of the called move", async () => {
vi.spyOn(randomMoveAttr, "getMove").mockReturnValue(MoveId.WOOD_HAMMER); vi.spyOn(RandomMoveAttr.prototype, "getMove").mockReturnValue(MoveId.WOOD_HAMMER);
await game.classicMode.startBattle([SpeciesId.REGIELEKI]); await game.classicMode.startBattle([SpeciesId.REGIELEKI]);
game.move.select(MoveId.METRONOME); game.move.select(MoveId.METRONOME);
@ -91,7 +90,7 @@ describe("Moves - Metronome", () => {
}); });
it("should count as last move used for Copycat/Mirror Move", async () => { it("should count as last move used for Copycat/Mirror Move", async () => {
vi.spyOn(randomMoveAttr, "getMove").mockReturnValue(MoveId.ABSORB); vi.spyOn(RandomMoveAttr.prototype, "getMove").mockReturnValue(MoveId.ABSORB);
await game.classicMode.startBattle([SpeciesId.REGIELEKI]); await game.classicMode.startBattle([SpeciesId.REGIELEKI]);
game.move.select(MoveId.METRONOME); game.move.select(MoveId.METRONOME);
@ -110,7 +109,7 @@ describe("Moves - Metronome", () => {
it("should recharge after using recharge moves", async () => { it("should recharge after using recharge moves", async () => {
await game.classicMode.startBattle([SpeciesId.REGIELEKI]); await game.classicMode.startBattle([SpeciesId.REGIELEKI]);
const player = game.field.getPlayerPokemon(); const player = game.field.getPlayerPokemon();
vi.spyOn(randomMoveAttr, "getMove").mockReturnValue(MoveId.HYPER_BEAM); vi.spyOn(RandomMoveAttr.prototype, "getMove").mockReturnValue(MoveId.HYPER_BEAM);
vi.spyOn(allMoves[MoveId.HYPER_BEAM], "accuracy", "get").mockReturnValue(100); vi.spyOn(allMoves[MoveId.HYPER_BEAM], "accuracy", "get").mockReturnValue(100);
game.move.select(MoveId.METRONOME); game.move.select(MoveId.METRONOME);
@ -121,7 +120,7 @@ describe("Moves - Metronome", () => {
it("should charge for charging moves while still maintaining follow-up status", async () => { it("should charge for charging moves while still maintaining follow-up status", async () => {
game.override.moveset([]).enemyMoveset(MoveId.SPITE); game.override.moveset([]).enemyMoveset(MoveId.SPITE);
vi.spyOn(randomMoveAttr, "getMove").mockReturnValue(MoveId.SOLAR_BEAM); vi.spyOn(RandomMoveAttr.prototype, "getMove").mockReturnValue(MoveId.SOLAR_BEAM);
await game.classicMode.startBattle([SpeciesId.REGIELEKI]); await game.classicMode.startBattle([SpeciesId.REGIELEKI]);
const player = game.field.getPlayerPokemon(); const player = game.field.getPlayerPokemon();
@ -160,7 +159,7 @@ describe("Moves - Metronome", () => {
const [leftPlayer, rightPlayer] = game.scene.getPlayerField(); const [leftPlayer, rightPlayer] = game.scene.getPlayerField();
const [leftOpp, rightOpp] = game.scene.getEnemyField(); const [leftOpp, rightOpp] = game.scene.getEnemyField();
vi.spyOn(randomMoveAttr, "getMove").mockReturnValue(MoveId.AROMATIC_MIST); vi.spyOn(RandomMoveAttr.prototype, "getMove").mockReturnValue(MoveId.AROMATIC_MIST);
game.move.select(MoveId.METRONOME, 0); game.move.select(MoveId.METRONOME, 0);
game.move.select(MoveId.SPLASH, 1); game.move.select(MoveId.SPLASH, 1);
@ -174,7 +173,7 @@ describe("Moves - Metronome", () => {
it("should cause opponent to flee when using Roar", async () => { it("should cause opponent to flee when using Roar", async () => {
await game.classicMode.startBattle([SpeciesId.REGIELEKI]); await game.classicMode.startBattle([SpeciesId.REGIELEKI]);
vi.spyOn(randomMoveAttr, "getMove").mockReturnValue(MoveId.ROAR); vi.spyOn(RandomMoveAttr.prototype, "getMove").mockReturnValue(MoveId.ROAR);
const enemyPokemon = game.field.getEnemyPokemon(); const enemyPokemon = game.field.getEnemyPokemon();