add shorthand for setting a moveset to all one move

This commit is contained in:
snoozbuster 2024-08-12 21:40:21 -07:00
parent c6e93985ca
commit eb1d195866
1 changed files with 8 additions and 2 deletions

View File

@ -111,7 +111,10 @@ export class OverridesHelper extends GameManagerHelper {
* @param moveset the {@linkcode Moves | moves}set to set * @param moveset the {@linkcode Moves | moves}set to set
* @returns this * @returns this
*/ */
moveset(moveset: Moves[]): this { moveset(moveset: Moves[] | Moves): this {
if (!Array.isArray(moveset)) {
moveset = new Array(4).fill(moveset);
}
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue(moveset); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue(moveset);
const movesetStr = moveset.map((moveId) => Moves[moveId]).join(", "); const movesetStr = moveset.map((moveId) => Moves[moveId]).join(", ");
this.log(`Player Pokemon moveset set to ${movesetStr} (=[${moveset.join(", ")}])!`); this.log(`Player Pokemon moveset set to ${movesetStr} (=[${moveset.join(", ")}])!`);
@ -230,7 +233,10 @@ export class OverridesHelper extends GameManagerHelper {
* @param moveset the {@linkcode Moves | moves}set to set * @param moveset the {@linkcode Moves | moves}set to set
* @returns this * @returns this
*/ */
enemyMoveset(moveset: Moves[]): this { enemyMoveset(moveset: Moves[] | Moves): this {
if (!Array.isArray(moveset)) {
moveset = new Array(4).fill(moveset);
}
vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue(moveset); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue(moveset);
const movesetStr = moveset.map((moveId) => Moves[moveId]).join(", "); const movesetStr = moveset.map((moveId) => Moves[moveId]).join(", ");
this.log(`Enemy Pokemon moveset set to ${movesetStr} (=[${moveset.join(", ")}])!`); this.log(`Enemy Pokemon moveset set to ${movesetStr} (=[${moveset.join(", ")}])!`);