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 eggMoveIndex = randSeedInt(4);
const randomEggMove: Moves = eggMoves[eggMoveIndex]; const randomEggMove: Moves = eggMoves[eggMoveIndex];
encounter.misc = { encounter.misc = {
eggMove: randomEggMove eggMove: randomEggMove,
pokemon: pokemon
}; };
if (pokemon.moveset.length < 4) { if (pokemon.moveset.length < 4) {
pokemon.moveset.push(new PokemonMove(randomEggMove)); pokemon.moveset.push(new PokemonMove(randomEggMove));
} else { } else {
pokemon.moveset[0] = new PokemonMove(randomEggMove); 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 // 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 ? 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] : [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]) .map(s => [parseInt(s) as Species, speciesStarters[s] as number])
.filter(s => { .filter(s => {
const pokemonSpecies = getPokemonSpecies(s[0]); const pokemonSpecies = getPokemonSpecies(s[0]);
return pokemonSpecies && (!excludedSpecies || !excludedSpecies.includes(s[0]) return pokemonSpecies && (!excludedSpecies || !excludedSpecies.includes(s[0]))
&& (allowSubLegendary || !pokemonSpecies.subLegendary) && (allowSubLegendary || !pokemonSpecies.subLegendary)
&& (allowLegendary || !pokemonSpecies.legendary) && (allowLegendary || !pokemonSpecies.legendary)
&& (allowMythical || !pokemonSpecies.mythical)); && (allowMythical || !pokemonSpecies.mythical);
}) })
.map(s => [getPokemonSpecies(s[0]), s[1]]); .map(s => [getPokemonSpecies(s[0]), s[1]]);