add OverridesHelper.enemyAbility

This commit is contained in:
Felix Staud 2024-07-25 15:01:59 -07:00
parent 141c3f5a6a
commit 7cd75b13b9

View File

@ -1,4 +1,5 @@
import { Weather, WeatherType } from "#app/data/weather"; import { Weather, WeatherType } from "#app/data/weather";
import { Abilities } from "#app/enums/abilities.js";
import { Biome } from "#app/enums/biome"; import { Biome } from "#app/enums/biome";
import { Species } from "#app/enums/species.js"; import { Species } from "#app/enums/species.js";
import * as GameMode from "#app/game-mode"; import * as GameMode from "#app/game-mode";
@ -56,8 +57,8 @@ export class OverridesHelper {
} }
/** /**
* Override the weather (type) * Override the {@linkcode WeatherType | weather (type)}
* @param type weather type to set * @param type {@linkcode WeatherType | weather type} to set
* @returns this * @returns this
*/ */
weather(type: WeatherType): this { weather(type: WeatherType): this {
@ -94,8 +95,8 @@ export class OverridesHelper {
} }
/** /**
* Override the enemy (pokemon) species * Override the enemy (pokemon) {@linkcode Species | species}
* @param species the (pokemon) species to set * @param species the (pokemon) {@linkcode Species | species} to set
* @returns this * @returns this
*/ */
enemySpecies(species: Species | number): this { enemySpecies(species: Species | number): this {
@ -104,6 +105,17 @@ export class OverridesHelper {
return this; 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[]) { private log(...params: any[]) {
console.log("Overrides:", ...params); console.log("Overrides:", ...params);
} }