Fixed Conflicts With creeping fog ME

Signed-off-by: Fuad Ali <fuad.ali@tecnico.ulisboa.pt>
Co-authored-by: Matilde Simões <matilde.simoes@tecnico.ulisboa.pt>
This commit is contained in:
Fuad Ali 2025-06-12 22:59:13 +01:00
parent 27ccd250c2
commit 266eed4d98
3 changed files with 112 additions and 107 deletions

View File

@ -10,25 +10,25 @@ import {
import { BerryType } from "#enums/berry-type";
import { randSeedInt } from "#app/utils/common";
import { globalScene } from "#app/global-scene";
import { modifierTypes } from "#app/modifier/modifier-type";
import { modifierTypes } from "#app/data/data-lists";
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
import type MysteryEncounter from "#app/data/mystery-encounters/mystery-encounter";
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
import { Nature } from "#enums/nature";
import { getPokemonSpecies } from "#app/data/pokemon-species";
import type { PokemonHeldItemModifierType } from "#app/modifier/modifier-type";
import { TimeOfDayRequirement } from "#app/data/mystery-encounters/mystery-encounter-requirements";
import { TimeOfDay } from "#enums/time-of-day";
import type { Abilities } from "#enums/abilities";
import type { AbilityId } from "#enums/ability-id";
import { Stat } from "#enums/stat";
import type HeldModifierConfig from "#app/interfaces/held-modifier-config";
import type HeldModifierConfig from "#app/@types/held-modifier-config";
import { MysteryEncounterBuilder } from "#app/data/mystery-encounters/mystery-encounter";
import { MysteryEncounterOptionBuilder } from "#app/data/mystery-encounters/mystery-encounter-option";
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
import { CustomPokemonData } from "#app/data/custom-pokemon-data";
import { ModifierTier } from "#app/modifier/modifier-tier";
import { ModifierTier } from "#enums/modifier-tier";
import {
MoveRequirement,
AbilityRequirement,
@ -40,7 +40,7 @@ import {
LIGHT_ABILITIES,
LIGHT_MOVES,
} from "#app/data/mystery-encounters/requirements/requirement-groups";
import { Biome } from "#enums/biome";
import { BiomeId } from "#enums/biome-id";
import { WeatherType } from "#enums/weather-type";
import FogOverlay from "#app/ui/fog-overlay";
@ -72,17 +72,17 @@ export const CreepingFogEncounter: MysteryEncounter = MysteryEncounterBuilder.wi
const waveIndex = globalScene.currentBattle.waveIndex;
const encounter = globalScene.currentBattle.mysteryEncounter!;
const chosenPokemonAttributes = chooseBoss();
const chosenPokemon = chosenPokemonAttributes[0] as Species;
const chosenPokemon = chosenPokemonAttributes[0] as SpeciesId;
const naturePokemon = chosenPokemonAttributes[1] as Nature;
const abilityPokemon = chosenPokemonAttributes[2] as Abilities;
const abilityPokemon = chosenPokemonAttributes[2] as AbilityId;
const passivePokemon = chosenPokemon[3] as boolean;
const movesPokemon = chosenPokemonAttributes[4] as Moves[];
const movesPokemon = chosenPokemonAttributes[4] as MoveId[];
const modifPokemon = chosenPokemonAttributes[5] as HeldModifierConfig[];
const segments = waveIndex < 80 ? 2 : waveIndex < 140 ? 3 : 4;
const pokemonConfig: EnemyPokemonConfig = {
species: getPokemonSpecies(chosenPokemon),
formIndex: [Species.LYCANROC, Species.PIDGEOT].includes(chosenPokemon) ? 1 : 0,
formIndex: [SpeciesId.LYCANROC, SpeciesId.PIDGEOT].includes(chosenPokemon) ? 1 : 0,
isBoss: true,
shiny: false,
customPokemonData: new CustomPokemonData({ spriteScale: 1 + segments * 0.05 }),
@ -308,47 +308,47 @@ function chooseBoss() {
const wave = globalScene.currentBattle.waveIndex;
const allBiomePokemon = [
[
Species.MACHAMP,
SpeciesId.MACHAMP,
Nature.JOLLY,
1,
false,
[Moves.DYNAMIC_PUNCH, Moves.STONE_EDGE, Moves.DUAL_CHOP, Moves.FISSURE],
[MoveId.DYNAMIC_PUNCH, MoveId.STONE_EDGE, MoveId.DUAL_CHOP, MoveId.FISSURE],
[],
],
[
Species.GRIMMSNARL,
SpeciesId.GRIMMSNARL,
Nature.ADAMANT,
null,
false,
[Moves.STONE_EDGE, Moves.CLOSE_COMBAT, Moves.IRON_TAIL, Moves.PLAY_ROUGH],
[MoveId.STONE_EDGE, MoveId.CLOSE_COMBAT, MoveId.IRON_TAIL, MoveId.PLAY_ROUGH],
[{ modifier: generateModifierType(modifierTypes.MICLE_BERRY) as PokemonHeldItemModifierType }],
],
];
const ForestTallGrassPokemon = [
[
Species.LYCANROC,
SpeciesId.LYCANROC,
Nature.JOLLY,
2,
false,
[Moves.STONE_EDGE, Moves.CLOSE_COMBAT, Moves.IRON_TAIL, Moves.PLAY_ROUGH],
[MoveId.STONE_EDGE, MoveId.CLOSE_COMBAT, MoveId.IRON_TAIL, MoveId.PLAY_ROUGH],
[],
],
[
Species.ALOLA_RATICATE,
SpeciesId.ALOLA_RATICATE,
Nature.ADAMANT,
1,
false,
[Moves.FALSE_SURRENDER, Moves.SUCKER_PUNCH, Moves.PLAY_ROUGH, Moves.POPULATION_BOMB],
[MoveId.FALSE_SURRENDER, MoveId.SUCKER_PUNCH, MoveId.PLAY_ROUGH, MoveId.POPULATION_BOMB],
[{ modifier: generateModifierType(modifierTypes.REVIVER_SEED) as PokemonHeldItemModifierType }],
],
];
const SwampLakePokemon = [
[
Species.POLIWRATH,
SpeciesId.POLIWRATH,
Nature.NAIVE,
null,
true,
[Moves.DYNAMIC_PUNCH, Moves.HYDRO_PUMP, Moves.DUAL_CHOP, Moves.HYPNOSIS],
[MoveId.DYNAMIC_PUNCH, MoveId.HYDRO_PUMP, MoveId.DUAL_CHOP, MoveId.HYPNOSIS],
[
{ modifier: generateModifierType(modifierTypes.BERRY, [BerryType.SITRUS]) as PokemonHeldItemModifierType },
{ modifier: generateModifierType(modifierTypes.BASE_STAT_BOOSTER, [Stat.HP]) as PokemonHeldItemModifierType },
@ -357,92 +357,92 @@ function chooseBoss() {
];
const GraveyardPokemon = [
[
Species.GOLURK,
SpeciesId.GOLURK,
Nature.ADAMANT,
2,
false,
[Moves.EARTHQUAKE, Moves.POLTERGEIST, Moves.DYNAMIC_PUNCH, Moves.STONE_EDGE],
[MoveId.EARTHQUAKE, MoveId.POLTERGEIST, MoveId.DYNAMIC_PUNCH, MoveId.STONE_EDGE],
[],
],
[
Species.HONEDGE,
SpeciesId.HONEDGE,
Nature.CAREFUL,
0,
false,
[Moves.IRON_HEAD, Moves.POLTERGEIST, Moves.SACRED_SWORD, Moves.SHADOW_SNEAK],
[MoveId.IRON_HEAD, MoveId.POLTERGEIST, MoveId.SACRED_SWORD, MoveId.SHADOW_SNEAK],
[],
],
[
Species.ZWEILOUS,
SpeciesId.ZWEILOUS,
Nature.BRAVE,
null,
true,
[Moves.DRAGON_RUSH, Moves.CRUNCH, Moves.GUNK_SHOT, Moves.SCREECH],
[MoveId.DRAGON_RUSH, MoveId.CRUNCH, MoveId.GUNK_SHOT, MoveId.SCREECH],
[{ modifier: generateModifierType(modifierTypes.QUICK_CLAW) as PokemonHeldItemModifierType, stackCount: 2 }],
],
];
const wave110_140Pokemon = [
[
Species.SCOLIPEDE,
SpeciesId.SCOLIPEDE,
Nature.ADAMANT,
2,
false,
[Moves.MEGAHORN, Moves.NOXIOUS_TORQUE, Moves.ROLLOUT, Moves.BANEFUL_BUNKER],
[MoveId.MEGAHORN, MoveId.NOXIOUS_TORQUE, MoveId.ROLLOUT, MoveId.BANEFUL_BUNKER],
[{ modifier: generateModifierType(modifierTypes.MICLE_BERRY) as PokemonHeldItemModifierType }],
],
[
Species.MIENSHAO,
SpeciesId.MIENSHAO,
Nature.JOLLY,
null,
true,
[Moves.HIGH_JUMP_KICK, Moves.STONE_EDGE, Moves.BLAZE_KICK, Moves.GUNK_SHOT],
[MoveId.HIGH_JUMP_KICK, MoveId.STONE_EDGE, MoveId.BLAZE_KICK, MoveId.GUNK_SHOT],
[],
],
[
Species.DRACOZOLT,
SpeciesId.DRACOZOLT,
Nature.JOLLY,
null,
true,
[Moves.BOLT_BEAK, Moves.DRAGON_RUSH, Moves.EARTHQUAKE, Moves.STONE_EDGE],
[MoveId.BOLT_BEAK, MoveId.DRAGON_RUSH, MoveId.EARTHQUAKE, MoveId.STONE_EDGE],
[],
],
];
const wave140PlusPokemon = [
[
Species.PIDGEOT,
SpeciesId.PIDGEOT,
Nature.HASTY,
0,
false,
[Moves.HURRICANE, Moves.HEAT_WAVE, Moves.FOCUS_BLAST, Moves.WILDBOLT_STORM],
[MoveId.HURRICANE, MoveId.HEAT_WAVE, MoveId.FOCUS_BLAST, MoveId.WILDBOLT_STORM],
[],
],
];
let pool = allBiomePokemon as [Species, Nature, Abilities, boolean, Moves[], HeldModifierConfig[]][];
let pool = allBiomePokemon as [SpeciesId, Nature, AbilityId, boolean, MoveId[], HeldModifierConfig[]][];
// Include biome-specific Pokémon if within wave 50-80
if (wave >= 50) {
if (biome === Biome.FOREST || biome === Biome.TALL_GRASS) {
if (biome === BiomeId.FOREST || biome === BiomeId.TALL_GRASS) {
pool = pool.concat(
ForestTallGrassPokemon as [Species, Nature, Abilities, boolean, Moves[], HeldModifierConfig[]][],
ForestTallGrassPokemon as [SpeciesId, Nature, AbilityId, boolean, MoveId[], HeldModifierConfig[]][],
);
}
if (biome === Biome.SWAMP || biome === Biome.LAKE) {
pool = pool.concat(SwampLakePokemon as [Species, Nature, Abilities, boolean, Moves[], HeldModifierConfig[]][]);
if (biome === BiomeId.SWAMP || biome === BiomeId.LAKE) {
pool = pool.concat(SwampLakePokemon as [SpeciesId, Nature, AbilityId, boolean, MoveId[], HeldModifierConfig[]][]);
}
if (biome === Biome.GRAVEYARD) {
pool = pool.concat(GraveyardPokemon as [Species, Nature, Abilities, boolean, Moves[], HeldModifierConfig[]][]);
if (biome === BiomeId.GRAVEYARD) {
pool = pool.concat(GraveyardPokemon as [SpeciesId, Nature, AbilityId, boolean, MoveId[], HeldModifierConfig[]][]);
}
}
// Waves 110-140 content
if (wave >= 110) {
pool = pool.concat(wave110_140Pokemon as [Species, Nature, Abilities, boolean, Moves[], HeldModifierConfig[]][]);
pool = pool.concat(wave110_140Pokemon as [SpeciesId, Nature, AbilityId, boolean, MoveId[], HeldModifierConfig[]][]);
}
// Wave 140+
if (wave >= 140) {
pool = pool.concat(wave140PlusPokemon as [Species, Nature, Abilities, boolean, Moves[], HeldModifierConfig[]][]);
pool = pool.concat(wave140PlusPokemon as [SpeciesId, Nature, AbilityId, boolean, MoveId[], HeldModifierConfig[]][]);
}
// Randomly choose one
return pool[randSeedInt(pool.length, 0)];

View File

@ -111,12 +111,12 @@ export const EXTORTION_MOVES = [
/**
* Moves that can clear a foggy weather
*/
export const DEFOG_MOVES = [Moves.DEFOG, Moves.RAPID_SPIN, Moves.GUST];
export const DEFOG_MOVES = [MoveId.DEFOG, MoveId.RAPID_SPIN, MoveId.GUST];
/**
* Moves that can help navigate through foggy weather
*/
export const LIGHT_MOVES = [Moves.FLASH, Moves.FORESIGHT];
export const LIGHT_MOVES = [MoveId.FLASH, MoveId.FORESIGHT];
/**
* Abilities that (loosely) can be used to trap/rob someone
@ -149,14 +149,14 @@ export const FIRE_RESISTANT_ABILITIES = [
/**
* Abilities that can clear foggy weather
*/
export const DEFOG_ABILITIES = [Abilities.AIR_LOCK, Abilities.CLOUD_NINE];
export const DEFOG_ABILITIES = [AbilityId.AIR_LOCK, AbilityId.CLOUD_NINE];
/**
* Abilities that can help navigate through foggy weather
*/
export const LIGHT_ABILITIES = [
Abilities.KEEN_EYE,
Abilities.ILLUMINATE,
Abilities.COMPOUND_EYES,
Abilities.VICTORY_STAR,
AbilityId.KEEN_EYE,
AbilityId.ILLUMINATE,
AbilityId.COMPOUND_EYES,
AbilityId.VICTORY_STAR,
];

View File

@ -2,17 +2,17 @@ import type BattleScene from "#app/battle-scene";
import { CreepingFogEncounter } from "#app/data/mystery-encounters/encounters/creeping-fog-encounter";
import * as MysteryEncounters from "#app/data/mystery-encounters/mystery-encounters";
import * as EncounterPhaseUtils from "#app/data/mystery-encounters/utils/encounter-phase-utils";
import { Biome } from "#app/enums/biome";
import { BiomeId } from "#enums/biome-id";
import { TimeOfDay } from "#enums/time-of-day";
import { MysteryEncounterType } from "#app/enums/mystery-encounter-type";
import { Species } from "#app/enums/species";
import { PokemonMove } from "#app/field/pokemon";
import { ModifierTier } from "#app/modifier/modifier-tier";
import { SpeciesId } from "#enums/species-id";
import { PokemonMove } from "#app/data/moves/pokemon-move";
import { ModifierTier } from "#enums/modifier-tier";
import { CommandPhase } from "#app/phases/command-phase";
import { SelectModifierPhase } from "#app/phases/select-modifier-phase";
import ModifierSelectUiHandler from "#app/ui/modifier-select-ui-handler";
import { UiMode } from "#enums/ui-mode";
import { Moves } from "#enums/moves";
import { MoveId } from "#enums/move-id";
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
import {
@ -26,43 +26,48 @@ import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vite
import { WeatherType } from "#enums/weather-type";
const namespace = "mysteryEncounters/creepingFog";
const defaultParty = [Species.LAPRAS, Species.GENGAR, Species.ABRA];
const defaultBiome = Biome.FOREST;
const defaultParty = [SpeciesId.LAPRAS, SpeciesId.GENGAR, SpeciesId.ABRA];
const defaultBiome = BiomeId.FOREST;
const defaultWave = 51;
const enemyPokemonForest50_110 = [Species.MACHAMP, Species.GRIMMSNARL, Species.LYCANROC, Species.ALOLA_RATICATE];
const enemyPokemonForest50_110 = [
SpeciesId.MACHAMP,
SpeciesId.GRIMMSNARL,
SpeciesId.LYCANROC,
SpeciesId.ALOLA_RATICATE,
];
const enemyPokemonSwamp110_140 = [
Species.MACHAMP,
Species.GRIMMSNARL,
Species.POLIWRATH,
Species.SCOLIPEDE,
Species.MIENSHAO,
Species.DRACOZOLT,
SpeciesId.MACHAMP,
SpeciesId.GRIMMSNARL,
SpeciesId.POLIWRATH,
SpeciesId.SCOLIPEDE,
SpeciesId.MIENSHAO,
SpeciesId.DRACOZOLT,
];
const enemyPokemonGraveyard140_Plus = [
Species.MACHAMP,
Species.GRIMMSNARL,
Species.GOLURK,
Species.HONEDGE,
Species.ZWEILOUS,
Species.SCOLIPEDE,
Species.MIENSHAO,
Species.DRACOZOLT,
Species.PIDGEOT,
SpeciesId.MACHAMP,
SpeciesId.GRIMMSNARL,
SpeciesId.GOLURK,
SpeciesId.HONEDGE,
SpeciesId.ZWEILOUS,
SpeciesId.SCOLIPEDE,
SpeciesId.MIENSHAO,
SpeciesId.DRACOZOLT,
SpeciesId.PIDGEOT,
];
const enemyMoveset = {
[Species.MACHAMP]: [Moves.DYNAMIC_PUNCH, Moves.STONE_EDGE, Moves.DUAL_CHOP, Moves.FISSURE],
[Species.GRIMMSNARL]: [Moves.STONE_EDGE, Moves.CLOSE_COMBAT, Moves.IRON_TAIL, Moves.PLAY_ROUGH],
[Species.LYCANROC]: [Moves.STONE_EDGE, Moves.CLOSE_COMBAT, Moves.IRON_TAIL, Moves.PLAY_ROUGH],
[Species.ALOLA_RATICATE]: [Moves.FALSE_SURRENDER, Moves.SUCKER_PUNCH, Moves.PLAY_ROUGH, Moves.POPULATION_BOMB],
[Species.POLIWRATH]: [Moves.DYNAMIC_PUNCH, Moves.HYDRO_PUMP, Moves.DUAL_CHOP, Moves.HYPNOSIS],
[Species.GOLURK]: [Moves.EARTHQUAKE, Moves.POLTERGEIST, Moves.DYNAMIC_PUNCH, Moves.STONE_EDGE],
[Species.HONEDGE]: [Moves.IRON_HEAD, Moves.POLTERGEIST, Moves.SACRED_SWORD, Moves.SHADOW_SNEAK],
[Species.ZWEILOUS]: [Moves.DRAGON_RUSH, Moves.CRUNCH, Moves.GUNK_SHOT, Moves.SCREECH],
[Species.SCOLIPEDE]: [Moves.MEGAHORN, Moves.NOXIOUS_TORQUE, Moves.ROLLOUT, Moves.BANEFUL_BUNKER],
[Species.MIENSHAO]: [Moves.HIGH_JUMP_KICK, Moves.STONE_EDGE, Moves.BLAZE_KICK, Moves.GUNK_SHOT],
[Species.DRACOZOLT]: [Moves.BOLT_BEAK, Moves.DRAGON_RUSH, Moves.EARTHQUAKE, Moves.STONE_EDGE],
[Species.PIDGEOT]: [Moves.HURRICANE, Moves.HEAT_WAVE, Moves.FOCUS_BLAST, Moves.WILDBOLT_STORM],
[SpeciesId.MACHAMP]: [MoveId.DYNAMIC_PUNCH, MoveId.STONE_EDGE, MoveId.DUAL_CHOP, MoveId.FISSURE],
[SpeciesId.GRIMMSNARL]: [MoveId.STONE_EDGE, MoveId.CLOSE_COMBAT, MoveId.IRON_TAIL, MoveId.PLAY_ROUGH],
[SpeciesId.LYCANROC]: [MoveId.STONE_EDGE, MoveId.CLOSE_COMBAT, MoveId.IRON_TAIL, MoveId.PLAY_ROUGH],
[SpeciesId.ALOLA_RATICATE]: [MoveId.FALSE_SURRENDER, MoveId.SUCKER_PUNCH, MoveId.PLAY_ROUGH, MoveId.POPULATION_BOMB],
[SpeciesId.POLIWRATH]: [MoveId.DYNAMIC_PUNCH, MoveId.HYDRO_PUMP, MoveId.DUAL_CHOP, MoveId.HYPNOSIS],
[SpeciesId.GOLURK]: [MoveId.EARTHQUAKE, MoveId.POLTERGEIST, MoveId.DYNAMIC_PUNCH, MoveId.STONE_EDGE],
[SpeciesId.HONEDGE]: [MoveId.IRON_HEAD, MoveId.POLTERGEIST, MoveId.SACRED_SWORD, MoveId.SHADOW_SNEAK],
[SpeciesId.ZWEILOUS]: [MoveId.DRAGON_RUSH, MoveId.CRUNCH, MoveId.GUNK_SHOT, MoveId.SCREECH],
[SpeciesId.SCOLIPEDE]: [MoveId.MEGAHORN, MoveId.NOXIOUS_TORQUE, MoveId.ROLLOUT, MoveId.BANEFUL_BUNKER],
[SpeciesId.MIENSHAO]: [MoveId.HIGH_JUMP_KICK, MoveId.STONE_EDGE, MoveId.BLAZE_KICK, MoveId.GUNK_SHOT],
[SpeciesId.DRACOZOLT]: [MoveId.BOLT_BEAK, MoveId.DRAGON_RUSH, MoveId.EARTHQUAKE, MoveId.STONE_EDGE],
[SpeciesId.PIDGEOT]: [MoveId.HURRICANE, MoveId.HEAT_WAVE, MoveId.FOCUS_BLAST, MoveId.WILDBOLT_STORM],
};
describe("Creeping Fog - Mystery Encounter", () => {
@ -84,10 +89,10 @@ describe("Creeping Fog - Mystery Encounter", () => {
game.override.startingTimeOfDay(TimeOfDay.NIGHT);
vi.spyOn(MysteryEncounters, "mysteryEncountersByBiome", "get").mockReturnValue(
new Map<Biome, MysteryEncounterType[]>([
[Biome.FOREST, [MysteryEncounterType.CREEPING_FOG]],
[Biome.FOREST, [MysteryEncounterType.SAFARI_ZONE]],
[Biome.SPACE, [MysteryEncounterType.MYSTERIOUS_CHALLENGERS]],
new Map<BiomeId, MysteryEncounterType[]>([
[BiomeId.FOREST, [MysteryEncounterType.CREEPING_FOG]],
[BiomeId.FOREST, [MysteryEncounterType.SAFARI_ZONE]],
[BiomeId.SPACE, [MysteryEncounterType.MYSTERIOUS_CHALLENGERS]],
]),
);
});
@ -113,7 +118,7 @@ describe("Creeping Fog - Mystery Encounter", () => {
it("should not spawn outside of proper biomes", async () => {
game.override.mysteryEncounterTier(MysteryEncounterTier.ULTRA);
game.override.startingBiome(Biome.SPACE);
game.override.startingBiome(BiomeId.SPACE);
game.override.startingTimeOfDay(TimeOfDay.NIGHT);
await game.runToMysteryEncounter();
@ -153,7 +158,7 @@ describe("Creeping Fog - Mystery Encounter", () => {
//Expect that the weather is set to heavy fog
expect(scene.arena.weather?.weatherType).toBe(WeatherType.HEAVY_FOG);
const enemyField = scene.getEnemyField();
expect(scene.getCurrentPhase()?.constructor.name).toBe(CommandPhase.name);
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(CommandPhase.name);
expect(enemyField.length).toBe(1);
expect(enemyPokemonForest50_110).toContain(enemyField[0].species.speciesId);
const moveset = enemyField[0].moveset.map(m => m.moveId);
@ -162,7 +167,7 @@ describe("Creeping Fog - Mystery Encounter", () => {
it("should start battle against shadowy Pokemon from the Swamp Mid Level Pool", async () => {
game.override.startingWave(113);
game.override.startingBiome(Biome.SWAMP);
game.override.startingBiome(BiomeId.SWAMP);
await game.runToMysteryEncounter(MysteryEncounterType.CREEPING_FOG, defaultParty);
// Make party lead's level arbitrarily high to not get KOed by move
const partyLead = scene.getPlayerParty()[0];
@ -172,7 +177,7 @@ describe("Creeping Fog - Mystery Encounter", () => {
//Expect that the weather is set to heavy fog
expect(scene.arena.weather?.weatherType).toBe(WeatherType.HEAVY_FOG);
const enemyField = scene.getEnemyField();
expect(scene.getCurrentPhase()?.constructor.name).toBe(CommandPhase.name);
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(CommandPhase.name);
expect(enemyField.length).toBe(1);
expect(enemyPokemonSwamp110_140).toContain(enemyField[0].species.speciesId);
const moveset = enemyField[0].moveset.map(m => m.moveId);
@ -181,7 +186,7 @@ describe("Creeping Fog - Mystery Encounter", () => {
it("should start battle against shadowy Pokemon from the Graveyard High Level Pool", async () => {
game.override.startingWave(143);
game.override.startingBiome(Biome.GRAVEYARD);
game.override.startingBiome(BiomeId.GRAVEYARD);
await game.runToMysteryEncounter(MysteryEncounterType.CREEPING_FOG, defaultParty);
// Make party lead's level arbitrarily high to not get KOed by move
const partyLead = scene.getPlayerParty()[0];
@ -191,7 +196,7 @@ describe("Creeping Fog - Mystery Encounter", () => {
//Expect that the weather is set to heavy fog
expect(scene.arena.weather?.weatherType).toBe(WeatherType.HEAVY_FOG);
const enemyField = scene.getEnemyField();
expect(scene.getCurrentPhase()?.constructor.name).toBe(CommandPhase.name);
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(CommandPhase.name);
expect(enemyField.length).toBe(1);
expect(enemyPokemonGraveyard140_Plus).toContain(enemyField[0].species.speciesId);
const moveset = enemyField[0].moveset.map(m => m.moveId);
@ -203,7 +208,7 @@ describe("Creeping Fog - Mystery Encounter", () => {
await runMysteryEncounterToEnd(game, 1, undefined, true);
await skipBattleRunMysteryEncounterRewardsPhase(game);
await game.phaseInterceptor.to(SelectModifierPhase, false);
expect(scene.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name);
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name);
await game.phaseInterceptor.run(SelectModifierPhase);
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
@ -240,22 +245,22 @@ describe("Creeping Fog - Mystery Encounter", () => {
it("should skip battle with Pokemon if wave level under 140", async () => {
const leaveEncounterWithoutBattleSpy = vi.spyOn(EncounterPhaseUtils, "leaveEncounterWithoutBattle");
await game.runToMysteryEncounter(MysteryEncounterType.CREEPING_FOG, defaultParty);
scene.getPlayerParty()[1].moveset = [new PokemonMove(Moves.DEFOG)];
scene.getPlayerParty()[1].moveset = [new PokemonMove(MoveId.DEFOG)];
await runMysteryEncounterToEnd(game, 2);
expect(leaveEncounterWithoutBattleSpy).toBeCalled();
});
it("should not skip battle with Pokemon", async () => {
game.override.startingWave(143);
game.override.startingBiome(Biome.GRAVEYARD);
game.override.startingBiome(BiomeId.GRAVEYARD);
await game.runToMysteryEncounter(MysteryEncounterType.CREEPING_FOG, defaultParty);
scene.getPlayerParty()[1].moveset = [new PokemonMove(Moves.DEFOG)];
scene.getPlayerParty()[1].moveset = [new PokemonMove(MoveId.DEFOG)];
const partyLead = scene.getPlayerParty()[0];
partyLead.level = 1000;
partyLead.calculateStats();
await runMysteryEncounterToEnd(game, 2, undefined, true);
const enemyField = scene.getEnemyField();
expect(scene.getCurrentPhase()?.constructor.name).toBe(CommandPhase.name);
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(CommandPhase.name);
expect(enemyField.length).toBe(1);
expect(enemyPokemonGraveyard140_Plus).toContain(enemyField[0].species.speciesId);
const moveset = enemyField[0].moveset.map(m => m.moveId);
@ -266,7 +271,7 @@ describe("Creeping Fog - Mystery Encounter", () => {
await game.runToMysteryEncounter(MysteryEncounterType.CREEPING_FOG, defaultParty);
scene.getPlayerParty().forEach(p => (p.moveset = []));
await game.phaseInterceptor.to(MysteryEncounterPhase, false);
const encounterPhase = scene.getCurrentPhase();
const encounterPhase = scene.phaseManager.getCurrentPhase();
expect(encounterPhase?.constructor.name).toBe(MysteryEncounterPhase.name);
const mysteryEncounterPhase = encounterPhase as MysteryEncounterPhase;
vi.spyOn(mysteryEncounterPhase, "continueEncounter");
@ -297,16 +302,16 @@ describe("Creeping Fog - Mystery Encounter", () => {
game.override.startingWave(63);
const leaveEncounterWithoutBattleSpy = vi.spyOn(EncounterPhaseUtils, "leaveEncounterWithoutBattle");
await game.runToMysteryEncounter(MysteryEncounterType.CREEPING_FOG, defaultParty);
scene.getPlayerParty()[1].moveset = [new PokemonMove(Moves.FORESIGHT)];
scene.getPlayerParty()[1].moveset = [new PokemonMove(MoveId.FORESIGHT)];
await runMysteryEncounterToEnd(game, 3);
expect(leaveEncounterWithoutBattleSpy).toBeCalled();
});
it("should not skip battle with Pokemon", async () => {
game.override.startingWave(143);
game.override.startingBiome(Biome.GRAVEYARD);
game.override.startingBiome(BiomeId.GRAVEYARD);
await game.runToMysteryEncounter(MysteryEncounterType.CREEPING_FOG, defaultParty);
scene.getPlayerParty()[1].moveset = [new PokemonMove(Moves.FORESIGHT)];
scene.getPlayerParty()[1].moveset = [new PokemonMove(MoveId.FORESIGHT)];
const partyLead = scene.getPlayerParty()[0];
partyLead.level = 1000;
partyLead.calculateStats();
@ -314,7 +319,7 @@ describe("Creeping Fog - Mystery Encounter", () => {
//Expect that the weather is set to heavy fog
expect(scene.arena.weather?.weatherType).toBe(WeatherType.HEAVY_FOG);
const enemyField = scene.getEnemyField();
expect(scene.getCurrentPhase()?.constructor.name).toBe(CommandPhase.name);
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(CommandPhase.name);
expect(enemyField.length).toBe(1);
expect(enemyPokemonGraveyard140_Plus).toContain(enemyField[0].species.speciesId);
const moveset = enemyField[0].moveset.map(m => m.moveId);
@ -326,7 +331,7 @@ describe("Creeping Fog - Mystery Encounter", () => {
scene.getPlayerParty().forEach(p => (p.moveset = []));
await game.phaseInterceptor.to(MysteryEncounterPhase, false);
const encounterPhase = scene.getCurrentPhase();
const encounterPhase = scene.phaseManager.getCurrentPhase();
expect(encounterPhase?.constructor.name).toBe(MysteryEncounterPhase.name);
const mysteryEncounterPhase = encounterPhase as MysteryEncounterPhase;
vi.spyOn(mysteryEncounterPhase, "continueEncounter");