add helper for forcing AI move targetting

This commit is contained in:
snoozbuster 2024-08-13 21:10:10 -07:00
parent 1bb79b87f6
commit c31809ed35
1 changed files with 11 additions and 0 deletions

View File

@ -1,6 +1,8 @@
import { vi } from "vitest";
import { MoveEffectPhase } from "#app/phases.js";
import { GameManagerHelper } from "./gameManagerHelper";
import { BattlerIndex } from "#app/battle.js";
import { EnemyPokemon } from "#app/field/pokemon.js";
/**
* Helper to handle a Pokemon's move
@ -32,4 +34,13 @@ export class MoveHelper extends GameManagerHelper {
hitCheck.mockReturnValue(false);
}
}
/**
* Forces an enemy Pokemon to attack into a certain slot
* @param pokemon Pokemon to force the attack of
* @param slot BattlerIndex to force the attack into
*/
forceAiTargets(pokemon: EnemyPokemon | undefined, slot: BattlerIndex | BattlerIndex[]) {
vi.spyOn(pokemon!, "getNextTargets").mockReturnValue(Array.isArray(slot) ? slot : [slot]);
}
}