fix Uncommon Breed ME crash

This commit is contained in:
ImperialSympathizer 2024-09-26 15:32:35 -04:00
parent 2723d11453
commit a9645b80fc
2 changed files with 6 additions and 5 deletions

View File

@ -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] :

View File

@ -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]]);