Removed near-unused learn move macro

This commit is contained in:
Bertie690 2025-05-30 18:29:45 -04:00
parent 3ae66b64ff
commit 1ee0667bbe
3 changed files with 11 additions and 114 deletions

View File

@ -326,23 +326,21 @@ describe("Moves - Instruct", () => {
});
it("should not repeat move since forgotten by target", async () => {
game.override.enemyLevel(5).xpMultiplier(0).enemySpecies(Species.WURMPLE).enemyMoveset(Moves.INSTRUCT);
game.override.enemyMoveset(Moves.INSTRUCT);
await game.classicMode.startBattle([Species.REGIELEKI]);
const regieleki = game.scene.getPlayerPokemon()!;
// fill out moveset with random moves
game.move.changeMoveset(regieleki, [Moves.ELECTRO_DRIFT, Moves.SPLASH, Moves.ICE_BEAM, Moves.ANCIENT_POWER]);
game.move.select(Moves.ELECTRO_DRIFT);
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
await game.phaseInterceptor.to("FaintPhase");
await game.move.learnMove(Moves.ELECTROWEB);
await game.toNextWave();
regieleki.pushMoveHistory({
move: Moves.ELECTRO_DRIFT,
targets: [BattlerIndex.PLAYER],
result: MoveResult.SUCCESS,
virtual: false,
});
game.move.select(Moves.SPLASH);
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
await game.phaseInterceptor.to("TurnEndPhase", false);
expect(game.scene.getEnemyField()[0].getLastXMoves()[0].result).toBe(MoveResult.FAIL);
await game.toEndOfTurn();
expect(game.field.getEnemyPokemon().getLastXMoves()[0].result).toBe(MoveResult.FAIL);
});
it("should disregard priority of instructed move on use", async () => {

View File

@ -56,9 +56,7 @@ describe("Learn Move Phase", () => {
game.scene.ui.processInput(Button.ACTION);
});
game.onNextPrompt("LearnMovePhase", UiMode.SUMMARY, () => {
for (let x = 0; x < moveSlotNum; x++) {
game.scene.ui.processInput(Button.DOWN);
}
game.scene.ui.setCursor(moveSlotNum);
game.scene.ui.processInput(Button.ACTION);
});
await game.phaseInterceptor.to(LearnMovePhase);
@ -88,9 +86,7 @@ describe("Learn Move Phase", () => {
game.scene.ui.processInput(Button.ACTION);
});
game.onNextPrompt("LearnMovePhase", UiMode.SUMMARY, () => {
for (let x = 0; x < 4; x++) {
game.scene.ui.processInput(Button.DOWN); // moves down 4 times to the 5th move slot
}
game.scene.ui.setCursor(4);
game.scene.ui.processInput(Button.ACTION);
});
game.onNextPrompt("LearnMovePhase", UiMode.CONFIRM, () => {
@ -102,64 +98,4 @@ describe("Learn Move Phase", () => {
expect(bulbasaur.level).toBeGreaterThanOrEqual(levelReq);
expect(bulbasaur.getMoveset().map(m => m?.moveId)).toEqual(prevMoveset);
});
it("macro should add moves in free slots normally", async () => {
await game.classicMode.startBattle([Species.BULBASAUR]);
const bulbasaur = game.scene.getPlayerPokemon()!;
game.move.changeMoveset(bulbasaur, [Moves.SPLASH, Moves.ABSORB, Moves.ACID]);
game.move.select(Moves.SPLASH);
await game.move.learnMove(Moves.SACRED_FIRE, 0, 1);
expect(bulbasaur.getMoveset().map(m => m?.moveId)).toEqual([
Moves.SPLASH,
Moves.ABSORB,
Moves.ACID,
Moves.SACRED_FIRE,
]);
});
it("macro should replace moves", async () => {
await game.classicMode.startBattle([Species.BULBASAUR]);
const bulbasaur = game.scene.getPlayerPokemon()!;
game.move.changeMoveset(bulbasaur, [Moves.SPLASH, Moves.ABSORB, Moves.ACID, Moves.VINE_WHIP]);
game.move.select(Moves.SPLASH);
await game.move.learnMove(Moves.SACRED_FIRE, 0, 1);
expect(bulbasaur.getMoveset().map(m => m?.moveId)).toEqual([
Moves.SPLASH,
Moves.SACRED_FIRE,
Moves.ACID,
Moves.VINE_WHIP,
]);
});
it("macro should allow for cancelling move learning", async () => {
await game.classicMode.startBattle([Species.BULBASAUR]);
const bulbasaur = game.scene.getPlayerPokemon()!;
game.move.changeMoveset(bulbasaur, [Moves.SPLASH, Moves.ABSORB, Moves.ACID, Moves.VINE_WHIP]);
game.move.select(Moves.SPLASH);
await game.move.learnMove(Moves.SACRED_FIRE, 0, 4);
expect(bulbasaur.getMoveset().map(m => m?.moveId)).toEqual([
Moves.SPLASH,
Moves.ABSORB,
Moves.ACID,
Moves.VINE_WHIP,
]);
});
it("macro works on off-field party members", async () => {
await game.classicMode.startBattle([Species.BULBASAUR, Species.SQUIRTLE]);
const squirtle = game.scene.getPlayerParty()[1]!;
game.move.changeMoveset(squirtle, [Moves.SPLASH, Moves.WATER_GUN, Moves.FREEZE_DRY, Moves.GROWL]);
game.move.select(Moves.TACKLE);
await game.move.learnMove(Moves.SHELL_SMASH, 1, 0);
expect(squirtle.getMoveset().map(m => m?.moveId)).toEqual([
Moves.SHELL_SMASH,
Moves.WATER_GUN,
Moves.FREEZE_DRY,
Moves.GROWL,
]);
});
});

View File

@ -1,12 +1,10 @@
import type { BattlerIndex } from "#app/battle";
import { getMoveTargets } from "#app/data/moves/move";
import { Button } from "#app/enums/buttons";
import type Pokemon from "#app/field/pokemon";
import { PokemonMove } from "#app/field/pokemon";
import Overrides from "#app/overrides";
import type { CommandPhase } from "#app/phases/command-phase";
import type { EnemyCommandPhase } from "#app/phases/enemy-command-phase";
import { LearnMovePhase } from "#app/phases/learn-move-phase";
import { MoveEffectPhase } from "#app/phases/move-effect-phase";
import { Command } from "#app/ui/command-ui-handler";
import { Moves } from "#enums/moves";
@ -233,39 +231,4 @@ export class MoveHelper extends GameManagerHelper {
*/
await this.game.phaseInterceptor.to("EnemyCommandPhase");
}
/**
* Simulates learning a move for a player pokemon.
* @param move The {@linkcode Moves} being learnt
* @param partyIndex The party position of the {@linkcode PlayerPokemon} learning the move (defaults to 0)
* @param moveSlotIndex The INDEX (0-4) of the move slot to replace if existent move slots are full;
* defaults to 0 (first slot) and 4 aborts the procedure
* @returns a promise that resolves once the move has been successfully learnt
*/
public async learnMove(move: Moves | number, partyIndex = 0, moveSlotIndex = 0) {
return new Promise<void>(async (resolve, reject) => {
this.game.scene.pushPhase(new LearnMovePhase(partyIndex, move));
// if slots are full, queue up inputs to replace existing moves
if (this.game.scene.getPlayerParty()[partyIndex].moveset.filter(m => m).length === 4) {
this.game.onNextPrompt("LearnMovePhase", UiMode.CONFIRM, () => {
this.game.scene.ui.processInput(Button.ACTION); // "Should a move be forgotten and replaced with XXX?"
});
this.game.onNextPrompt("LearnMovePhase", UiMode.SUMMARY, () => {
for (let x = 0; x < (moveSlotIndex ?? 0); x++) {
this.game.scene.ui.processInput(Button.DOWN); // Scrolling in summary pane to move position
}
this.game.scene.ui.processInput(Button.ACTION);
if (moveSlotIndex === 4) {
this.game.onNextPrompt("LearnMovePhase", UiMode.CONFIRM, () => {
this.game.scene.ui.processInput(Button.ACTION); // "Give up on learning XXX?"
});
}
});
}
await this.game.phaseInterceptor.to(LearnMovePhase).catch(e => reject(e));
resolve();
});
}
}