From 7cd75b13b9513606afb9d5d44c2bb8bf6dbe27b5 Mon Sep 17 00:00:00 2001 From: Felix Staud Date: Thu, 25 Jul 2024 15:01:59 -0700 Subject: [PATCH] add OverridesHelper.enemyAbility --- src/test/utils/overridesHelper.ts | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/test/utils/overridesHelper.ts b/src/test/utils/overridesHelper.ts index bdc92a47714..f1273c26f38 100644 --- a/src/test/utils/overridesHelper.ts +++ b/src/test/utils/overridesHelper.ts @@ -1,4 +1,5 @@ import { Weather, WeatherType } from "#app/data/weather"; +import { Abilities } from "#app/enums/abilities.js"; import { Biome } from "#app/enums/biome"; import { Species } from "#app/enums/species.js"; import * as GameMode from "#app/game-mode"; @@ -56,8 +57,8 @@ export class OverridesHelper { } /** - * Override the weather (type) - * @param type weather type to set + * Override the {@linkcode WeatherType | weather (type)} + * @param type {@linkcode WeatherType | weather type} to set * @returns this */ weather(type: WeatherType): this { @@ -94,8 +95,8 @@ export class OverridesHelper { } /** - * Override the enemy (pokemon) species - * @param species the (pokemon) species to set + * Override the enemy (pokemon) {@linkcode Species | species} + * @param species the (pokemon) {@linkcode Species | species} to set * @returns this */ enemySpecies(species: Species | number): this { @@ -104,6 +105,17 @@ export class OverridesHelper { return this; } + /** + * Override the enemy (pokemon) {@linkcode Abilities | ability} + * @param ability the (pokemon) {@linkcode Abilities | ability} to set + * @returns this + */ + enemyAbility(ability: Abilities): this { + vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(ability); + this.log(`Enemy Pokemon species set to ${Abilities[ability]} (=${ability})!`); + return this; + } + private log(...params: any[]) { console.log("Overrides:", ...params); }