Prevent duplicate evolutions crashing the game (#1416)

This commit is contained in:
Xavion3 2024-05-27 09:14:38 +10:00 committed by GitHub
parent 6418632bd3
commit 72c7e9c194
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -736,7 +736,7 @@ export default class PokemonSpecies extends PokemonSpeciesForm implements Locali
const allEvolvingPokemon = Object.keys(pokemonEvolutions); const allEvolvingPokemon = Object.keys(pokemonEvolutions);
for (const p of allEvolvingPokemon) { for (const p of allEvolvingPokemon) {
for (const e of pokemonEvolutions[p]) { for (const e of pokemonEvolutions[p]) {
if (e.speciesId === this.speciesId && (!this.forms.length || !e.evoFormKey || e.evoFormKey === this.forms[this.formIndex].formKey)) { if (e.speciesId === this.speciesId && (!this.forms.length || !e.evoFormKey || e.evoFormKey === this.forms[this.formIndex].formKey) && prevolutionLevels.every(pe => pe[0] !== parseInt(p))) {
const speciesId = parseInt(p) as Species; const speciesId = parseInt(p) as Species;
const level = e.level; const level = e.level;
prevolutionLevels.push([ speciesId, level ]); prevolutionLevels.push([ speciesId, level ]);