Fixed test comments + added copycat test

This commit is contained in:
Bertie690 2025-01-25 16:32:36 -05:00
parent 37bbc1d232
commit 5fe09e0ecf
2 changed files with 46 additions and 35 deletions

View File

@ -7,7 +7,6 @@ import GameManager from "#test/utils/gameManager";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
describe("Abilities - Dancer", () => {
let phaserGame: Phaser.Game;
let game: GameManager;
@ -24,20 +23,21 @@ describe("Abilities - Dancer", () => {
beforeEach(() => {
game = new GameManager(phaserGame);
game.override
.battleType("double")
.moveset([ Moves.SWORDS_DANCE, Moves.SPLASH ])
.enemySpecies(Species.MAGIKARP)
.enemyAbility(Abilities.DANCER)
.enemyMoveset([ Moves.VICTORY_DANCE ]);
game.override.battleType("double");
});
// Reference Link: https://bulbapedia.bulbagarden.net/wiki/Dancer_(Ability)
it("triggers when dance moves are used, doesn't consume extra PP", async () => {
game.override
.enemyAbility(Abilities.DANCER)
.enemySpecies(Species.MAGIKARP)
.enemyMoveset(Moves.VICTORY_DANCE);
await game.classicMode.startBattle([ Species.ORICORIO, Species.FEEBAS ]);
const [ oricorio ] = game.scene.getPlayerField();
const [ oricorio, feebas ] = game.scene.getPlayerField();
game.move.changeMoveset(oricorio, [ Moves.SWORDS_DANCE, Moves.VICTORY_DANCE, Moves.SPLASH ]);
game.move.changeMoveset(feebas, [ Moves.SWORDS_DANCE, Moves.SPLASH ]);
game.move.select(Moves.SPLASH);
game.move.select(Moves.SWORDS_DANCE, 1);
@ -59,19 +59,20 @@ describe("Abilities - Dancer", () => {
// doesn't use PP if copied move is also in moveset
expect(oricorio.moveset[0]?.ppUsed).toBe(0);
expect(oricorio.moveset[1]?.ppUsed).toBe(0);
});
// TODO: Enable after move-calling move rework
// TODO: Enable after Dancer rework to not push to move history
it.todo("should not count as the last move used for mirror move/instruct", async () => {
game.override
.moveset([ Moves.FIERY_DANCE, Moves.REVELATION_DANCE ])
.enemyMoveset([ Moves.INSTRUCT, Moves.MIRROR_MOVE, Moves.SPLASH ])
.enemySpecies(Species.DIALGA)
.enemyLevel(100);
.enemySpecies(Species.SHUCKLE)
.enemyLevel(10);
await game.classicMode.startBattle([ Species.ORICORIO, Species.FEEBAS ]);
const [ oricorio ] = game.scene.getPlayerField();
const [ , dialga2 ] = game.scene.getEnemyField();
const [ , shuckle2 ] = game.scene.getEnemyField();
game.move.select(Moves.REVELATION_DANCE, BattlerIndex.PLAYER, BattlerIndex.ENEMY_2);
game.move.select(Moves.FIERY_DANCE, BattlerIndex.PLAYER_2, BattlerIndex.ENEMY_2);
@ -80,17 +81,18 @@ describe("Abilities - Dancer", () => {
await game.setTurnOrder([ BattlerIndex.PLAYER, BattlerIndex.PLAYER_2, BattlerIndex.ENEMY_2, BattlerIndex.ENEMY ]);
await game.phaseInterceptor.to("MovePhase"); // Oricorio rev dance
await game.phaseInterceptor.to("MovePhase"); // Feebas fiery dance
await game.phaseInterceptor.to("MovePhase"); // Oricorio fiery dance
await game.phaseInterceptor.to("MovePhase"); // Oricorio fiery dance (from dancer)
await game.phaseInterceptor.to("MoveEndPhase", false);
expect(oricorio.getLastXMoves(-1)[0].move).toBe(Moves.REVELATION_DANCE); // dancer copied move doesn't appear in move history
// dancer copied move doesn't appear in move history
expect(oricorio.getLastXMoves(-1)[0].move).toBe(Moves.REVELATION_DANCE);
await game.phaseInterceptor.to("MovePhase"); // dialga 2 mirror moves oricorio
await game.phaseInterceptor.to("MovePhase"); // shuckle 2 mirror moves oricorio
await game.phaseInterceptor.to("MovePhase"); // calls instructed rev dance
let currentPhase = game.scene.getCurrentPhase() as MovePhase;
expect(currentPhase.pokemon).toBe(dialga2);
expect(currentPhase.pokemon).toBe(shuckle2);
expect(currentPhase.move.moveId).toBe(Moves.REVELATION_DANCE);
await game.phaseInterceptor.to("MovePhase"); // dialga 1 instructs oricorio
await game.phaseInterceptor.to("MovePhase"); // shuckle 1 instructs oricorio
await game.phaseInterceptor.to("MovePhase");
currentPhase = game.scene.getCurrentPhase() as MovePhase;
expect(currentPhase.pokemon).toBe(oricorio);

View File

@ -1,9 +1,7 @@
import { BattlerIndex } from "#app/battle";
import { Button } from "#app/enums/buttons";
import type Pokemon from "#app/field/pokemon";
import { MoveResult } from "#app/field/pokemon";
import type { MovePhase } from "#app/phases/move-phase";
import { Mode } from "#app/ui/ui";
import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
@ -119,13 +117,34 @@ describe("Moves - Instruct", () => {
await game.classicMode.startBattle([ Species.AMOONGUSS ]);
const enemy = game.scene.getEnemyPokemon()!;
game.move.changeMoveset(enemy, Moves.GIGATON_HAMMER);
game.move.changeMoveset(enemy, [ Moves.GIGATON_HAMMER, Moves.BLOOD_MOON ]);
game.move.select(Moves.INSTRUCT);
await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]);
await game.phaseInterceptor.to("TurnEndPhase", false);
await game.phaseInterceptor.to("BerryPhase");
instructSuccess(enemy, Moves.GIGATON_HAMMER);
expect(game.scene.getPlayerPokemon()!.turnData.attacksReceived.length).toBe(2);
});
it("should add moves to move queue for copycat", async () => {
game.override
.battleType("double")
.moveset(Moves.INSTRUCT)
.enemyLevel(5);
await game.classicMode.startBattle([ Species.AMOONGUSS ]);
const [ enemy1, enemy2 ] = game.scene.getEnemyField()!;
game.move.changeMoveset(enemy1, Moves.WATER_GUN);
game.move.changeMoveset(enemy2, Moves.COPYCAT);
game.move.select(Moves.INSTRUCT, BattlerIndex.PLAYER, BattlerIndex.ENEMY);
await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER, BattlerIndex.ENEMY_2 ]);
await game.phaseInterceptor.to("BerryPhase");
instructSuccess(enemy1, Moves.WATER_GUN);
// amoonguss gets hit by water gun thrice; once by original attack, once by instructed use and once by copycat
expect(game.scene.getPlayerPokemon()!.turnData.attacksReceived.length).toBe(3);
});
it("should respect enemy's status condition", async () => {
@ -318,11 +337,10 @@ describe("Moves - Instruct", () => {
expect(player.getLastXMoves()[0].result).toBe(MoveResult.FAIL);
});
// TODO: Fix test code up to use learn move utility function once that gets added
it.todo("should not repeat move since forgotten by target", async () => {
it("should not repeat move since forgotten by target", async () => {
game.override
.enemyLevel(5)
.xpMultiplier(50)
.xpMultiplier(0)
.enemySpecies(Species.WURMPLE)
.enemyMoveset(Moves.INSTRUCT);
await game.classicMode.startBattle([ Species.REGIELEKI ]);
@ -333,17 +351,8 @@ describe("Moves - Instruct", () => {
game.move.select(Moves.ELECTRO_DRIFT);
await game.setTurnOrder([ BattlerIndex.PLAYER, BattlerIndex.ENEMY ]);
// setup macro to mash enter and learn hydro pump in slot 1
game.onNextPrompt("LearnMovePhase", Mode.CONFIRM, () => {
game.scene.ui.getHandler().processInput(Button.ACTION);
game.onNextPrompt("LearnMovePhase", Mode.SUMMARY, () => {
game.scene.ui.getHandler().processInput(Button.ACTION);
game.onNextPrompt("LearnMovePhase", Mode.CONFIRM, () => {
game.scene.ui.getHandler().processInput(Button.ACTION);
});
});
});
await game.phaseInterceptor.to("FaintPhase");
await game.move.learnMove(Moves.ELECTROWEB);
await game.toNextWave();
game.move.select(Moves.SPLASH);