This commit is contained in:
NightKev 2025-06-03 15:24:29 -04:00 committed by GitHub
commit a0ced49666
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 6 deletions

View File

@ -1,7 +1,6 @@
import { BattlerIndex } from "#app/battle"; import { BattlerIndex } from "#app/battle";
import { Stat } from "#app/enums/stat"; import { Stat } from "#app/enums/stat";
import { MoveResult } from "#app/field/pokemon"; import { MoveResult } from "#app/field/pokemon";
import { CommandPhase } from "#app/phases/command-phase";
import { Abilities } from "#enums/abilities"; import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
@ -80,7 +79,6 @@ describe("Moves - Assist", () => {
// Player uses Sketch to copy Swords Dance, Player_2 stalls a turn. Player will attempt Assist and should have no usable moves // Player uses Sketch to copy Swords Dance, Player_2 stalls a turn. Player will attempt Assist and should have no usable moves
await game.toNextTurn(); await game.toNextTurn();
game.move.select(Moves.ASSIST, 0); game.move.select(Moves.ASSIST, 0);
await game.phaseInterceptor.to(CommandPhase);
game.move.select(Moves.PROTECT, 1); game.move.select(Moves.PROTECT, 1);
await game.toNextTurn(); await game.toNextTurn();
@ -88,15 +86,13 @@ describe("Moves - Assist", () => {
}); });
it("should apply secondary effects of a move", async () => { it("should apply secondary effects of a move", async () => {
game.override.moveset([Moves.ASSIST, Moves.WOOD_HAMMER, Moves.WOOD_HAMMER, Moves.WOOD_HAMMER]);
await game.classicMode.startBattle([Species.FEEBAS, Species.SHUCKLE]); await game.classicMode.startBattle([Species.FEEBAS, Species.SHUCKLE]);
const [feebas, shuckle] = game.scene.getPlayerField(); const [feebas, shuckle] = game.scene.getPlayerField();
game.move.changeMoveset(feebas, [Moves.ASSIST, Moves.SKETCH, Moves.PROTECT, Moves.DRAGON_TAIL]); game.move.changeMoveset(feebas, [Moves.ASSIST, Moves.WOOD_HAMMER]);
game.move.changeMoveset(shuckle, [Moves.ASSIST, Moves.SKETCH, Moves.PROTECT, Moves.DRAGON_TAIL]); game.move.changeMoveset(shuckle, [Moves.ASSIST, Moves.WOOD_HAMMER]);
game.move.select(Moves.ASSIST, 0); game.move.select(Moves.ASSIST, 0);
await game.phaseInterceptor.to(CommandPhase);
game.move.select(Moves.ASSIST, 1); game.move.select(Moves.ASSIST, 1);
await game.toNextTurn(); await game.toNextTurn();

View File

@ -146,10 +146,23 @@ export class MoveHelper extends GameManagerHelper {
/** /**
* Changes a pokemon's moveset to the given move(s). * Changes a pokemon's moveset to the given move(s).
* Used when the normal moveset override can't be used (such as when it's necessary to check or update properties of the moveset). * Used when the normal moveset override can't be used (such as when it's necessary to check or update properties of the moveset).
*
* **Note**: Will disable the moveset override matching the pokemon's party.
* @param pokemon - The {@linkcode Pokemon} being modified * @param pokemon - The {@linkcode Pokemon} being modified
* @param moveset - The {@linkcode Moves} (single or array) to change the Pokemon's moveset to * @param moveset - The {@linkcode Moves} (single or array) to change the Pokemon's moveset to
*/ */
public changeMoveset(pokemon: Pokemon, moveset: Moves | Moves[]): void { public changeMoveset(pokemon: Pokemon, moveset: Moves | Moves[]): void {
if (pokemon.isPlayer()) {
if ([Overrides.MOVESET_OVERRIDE].flat().length > 0) {
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([]);
console.warn("Player moveset override disabled due to use of `game.move.changeMoveset`!");
}
} else {
if ([Overrides.OPP_MOVESET_OVERRIDE].flat().length > 0) {
vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([]);
console.warn("Enemy moveset override disabled due to use of `game.move.changeMoveset`!");
}
}
if (!Array.isArray(moveset)) { if (!Array.isArray(moveset)) {
moveset = [moveset]; moveset = [moveset];
} }