Fix evolution screen not preserving form index

pull/14/head
Flashfyre 2024-01-30 13:51:00 -05:00
parent 9633897a27
commit 8f55245a38
1 changed files with 1 additions and 1 deletions

View File

@ -1882,7 +1882,7 @@ export class PlayerPokemon extends Pokemon {
getPossibleEvolution(evolution: SpeciesEvolution): Promise<Pokemon> { getPossibleEvolution(evolution: SpeciesEvolution): Promise<Pokemon> {
return new Promise(resolve => { return new Promise(resolve => {
const species = getPokemonSpecies(evolution.speciesId); const species = getPokemonSpecies(evolution.speciesId);
const formIndex = Math.max(this.species.forms.findIndex(f => f.formKey === evolution.evoFormKey), 0); const formIndex = evolution.evoFormKey !== null ? Math.max(this.species.forms.findIndex(f => f.formKey === evolution.evoFormKey), 0) : this.formIndex;
const ret = this.scene.addPlayerPokemon(species, this.level, this.abilityIndex, formIndex, this.gender, this.shiny, this.ivs, this.nature, this); const ret = this.scene.addPlayerPokemon(species, this.level, this.abilityIndex, formIndex, this.gender, this.shiny, this.ivs, this.nature, this);
ret.loadAssets().then(() => resolve(ret)); ret.loadAssets().then(() => resolve(ret));
}); });