From a9645b80fcd7f10c35537c1424e2ecdd98e90021 Mon Sep 17 00:00:00 2001 From: ImperialSympathizer Date: Thu, 26 Sep 2024 15:32:35 -0400 Subject: [PATCH] fix Uncommon Breed ME crash --- .../encounters/uncommon-breed-encounter.ts | 7 ++++--- .../mystery-encounters/utils/encounter-pokemon-utils.ts | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/data/mystery-encounters/encounters/uncommon-breed-encounter.ts b/src/data/mystery-encounters/encounters/uncommon-breed-encounter.ts index fe550e94072..14ba7895434 100644 --- a/src/data/mystery-encounters/encounters/uncommon-breed-encounter.ts +++ b/src/data/mystery-encounters/encounters/uncommon-breed-encounter.ts @@ -60,17 +60,18 @@ export const UncommonBreedEncounter: MysteryEncounter = const eggMoveIndex = randSeedInt(4); const randomEggMove: Moves = eggMoves[eggMoveIndex]; encounter.misc = { - eggMove: randomEggMove + eggMove: randomEggMove, + pokemon: pokemon }; if (pokemon.moveset.length < 4) { pokemon.moveset.push(new PokemonMove(randomEggMove)); } else { pokemon.moveset[0] = new PokemonMove(randomEggMove); } + } else { + encounter.misc.pokemon = pokemon; } - encounter.misc.pokemon = pokemon; - // Defense/Spd buffs below wave 50, +1 to all stats otherwise const statChangesForBattle: (Stat.ATK | Stat.DEF | Stat.SPATK | Stat.SPDEF | Stat.SPD | Stat.ACC | Stat.EVA)[] = scene.currentBattle.waveIndex < 50 ? [Stat.DEF, Stat.SPDEF, Stat.SPD] : diff --git a/src/data/mystery-encounters/utils/encounter-pokemon-utils.ts b/src/data/mystery-encounters/utils/encounter-pokemon-utils.ts index 5418e3ae8ab..c9b30415299 100644 --- a/src/data/mystery-encounters/utils/encounter-pokemon-utils.ts +++ b/src/data/mystery-encounters/utils/encounter-pokemon-utils.ts @@ -210,10 +210,10 @@ export function getRandomSpeciesByStarterTier(starterTiers: number | [number, nu .map(s => [parseInt(s) as Species, speciesStarters[s] as number]) .filter(s => { const pokemonSpecies = getPokemonSpecies(s[0]); - return pokemonSpecies && (!excludedSpecies || !excludedSpecies.includes(s[0]) + return pokemonSpecies && (!excludedSpecies || !excludedSpecies.includes(s[0])) && (allowSubLegendary || !pokemonSpecies.subLegendary) && (allowLegendary || !pokemonSpecies.legendary) - && (allowMythical || !pokemonSpecies.mythical)); + && (allowMythical || !pokemonSpecies.mythical); }) .map(s => [getPokemonSpecies(s[0]), s[1]]);