This commit is contained in:
Dean 2025-06-10 21:47:58 -07:00
parent b98dc8fb73
commit e35ee4cf18

View File

@ -1,6 +1,6 @@
import { Abilities } from "#enums/abilities"; import { AbilityId } from "#enums/ability-id";
import { Moves } from "#enums/moves"; import { MoveId } from "#enums/move-id";
import { Species } from "#enums/species"; import { SpeciesId } from "#enums/species-id";
import { Stat } from "#enums/stat"; import { Stat } from "#enums/stat";
import { WeatherType } from "#enums/weather-type"; import { WeatherType } from "#enums/weather-type";
import GameManager from "#test/testUtils/gameManager"; import GameManager from "#test/testUtils/gameManager";
@ -24,18 +24,18 @@ describe("Ability Activation Order", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override game.override
.moveset([Moves.SPLASH]) .moveset([MoveId.SPLASH])
.ability(Abilities.BALL_FETCH) .ability(AbilityId.BALL_FETCH)
.battleStyle("single") .battleStyle("single")
.disableCrits() .disableCrits()
.enemySpecies(Species.MAGIKARP) .enemySpecies(SpeciesId.MAGIKARP)
.enemyAbility(Abilities.BALL_FETCH) .enemyAbility(AbilityId.BALL_FETCH)
.enemyMoveset(Moves.SPLASH); .enemyMoveset(MoveId.SPLASH);
}); });
it("should activate the ability of the faster Pokemon first", async () => { it("should activate the ability of the faster Pokemon first", async () => {
game.override.enemyLevel(100).ability(Abilities.DRIZZLE).enemyAbility(Abilities.DROUGHT); game.override.enemyLevel(100).ability(AbilityId.DRIZZLE).enemyAbility(AbilityId.DROUGHT);
await game.classicMode.startBattle([Species.SLOWPOKE]); await game.classicMode.startBattle([SpeciesId.SLOWPOKE]);
// Enemy's ability should activate first, so sun ends up replaced with rain // Enemy's ability should activate first, so sun ends up replaced with rain
expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.RAIN); expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.RAIN);
@ -45,12 +45,12 @@ describe("Ability Activation Order", () => {
game.override game.override
.startingLevel(25) .startingLevel(25)
.enemyLevel(50) .enemyLevel(50)
.enemySpecies(Species.MAGIKARP) .enemySpecies(SpeciesId.MAGIKARP)
.enemyAbility(Abilities.DROUGHT) .enemyAbility(AbilityId.DROUGHT)
.ability(Abilities.DRIZZLE) .ability(AbilityId.DRIZZLE)
.startingHeldItems([{ name: "BASE_STAT_BOOSTER", type: Stat.SPD, count: 100 }]); .startingHeldItems([{ name: "BASE_STAT_BOOSTER", type: Stat.SPD, count: 100 }]);
await game.classicMode.startBattle([Species.MAGIKARP]); await game.classicMode.startBattle([SpeciesId.MAGIKARP]);
expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SUNNY); expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SUNNY);
}); });
@ -58,24 +58,24 @@ describe("Ability Activation Order", () => {
game.override game.override
.startingLevel(35) .startingLevel(35)
.enemyLevel(50) .enemyLevel(50)
.enemySpecies(Species.DITTO) .enemySpecies(SpeciesId.DITTO)
.enemyAbility(Abilities.DROUGHT) .enemyAbility(AbilityId.DROUGHT)
.ability(Abilities.DRIZZLE) .ability(AbilityId.DRIZZLE)
.startingHeldItems([{ name: "SPECIES_STAT_BOOSTER", type: "QUICK_POWDER" }]); .startingHeldItems([{ name: "SPECIES_STAT_BOOSTER", type: "QUICK_POWDER" }]);
await game.classicMode.startBattle([Species.DITTO]); await game.classicMode.startBattle([SpeciesId.DITTO]);
expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SUNNY); expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SUNNY);
}); });
it("should activate priority abilities first", async () => { it("should activate priority AbilityId first", async () => {
game.override game.override
.startingLevel(1) .startingLevel(1)
.enemyLevel(100) .enemyLevel(100)
.enemySpecies(Species.ACCELGOR) .enemySpecies(SpeciesId.ACCELGOR)
.enemyAbility(Abilities.DROUGHT) .enemyAbility(AbilityId.DROUGHT)
.ability(Abilities.NEUTRALIZING_GAS); .ability(AbilityId.NEUTRALIZING_GAS);
await game.classicMode.startBattle([Species.SLOWPOKE]); await game.classicMode.startBattle([SpeciesId.SLOWPOKE]);
expect(game.scene.arena.weather).toBeUndefined(); expect(game.scene.arena.weather).toBeUndefined();
}); });
@ -83,12 +83,12 @@ describe("Ability Activation Order", () => {
game.override game.override
.startingLevel(35) .startingLevel(35)
.enemyLevel(50) .enemyLevel(50)
.enemySpecies(Species.MAGIKARP) .enemySpecies(SpeciesId.MAGIKARP)
.enemyAbility(Abilities.SLOW_START) .enemyAbility(AbilityId.SLOW_START)
.enemyPassiveAbility(Abilities.DROUGHT) .enemyPassiveAbility(AbilityId.DROUGHT)
.ability(Abilities.DRIZZLE); .ability(AbilityId.DRIZZLE);
await game.classicMode.startBattle([Species.MAGIKARP]); await game.classicMode.startBattle([SpeciesId.MAGIKARP]);
// Slow start activates and makes enemy slower, so drought activates after drizzle // Slow start activates and makes enemy slower, so drought activates after drizzle
expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SUNNY); expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SUNNY);
}); });