Fix eggs ignoring forms

This commit is contained in:
Flashfyre 2023-12-20 00:35:41 -05:00
parent aa94e044ab
commit 534d5a907c
3 changed files with 12 additions and 7 deletions

View File

@ -730,7 +730,7 @@ export default class BattleScene extends Phaser.Scene {
this.currentBattle.incrementTurn(this);
//this.pushPhase(new TrainerMessageTestPhase(this));
if (!waveIndex) {
const isNewBiome = !lastBattle || !(lastBattle.waveIndex % 10);
const resetArenaState = isNewBiome || this.currentBattle.battleType === BattleType.TRAINER;
@ -782,7 +782,7 @@ export default class BattleScene extends Phaser.Scene {
return this.arena;
}
getSpeciesFormIndex(species: PokemonSpecies): integer {
getSpeciesFormIndex(species: PokemonSpecies, ignoreArena?: boolean): integer {
if (!species.forms?.length)
return 0;
@ -794,7 +794,9 @@ export default class BattleScene extends Phaser.Scene {
return Utils.randSeedInt(species.forms.length);
}
return this.arena.getSpeciesFormIndex(species);
return !ignoreArena
? this.arena.getSpeciesFormIndex(species)
: 0;
}
trySpreadPokerus(): void {

View File

@ -327,7 +327,8 @@ export class EggHatchPhase extends BattlePhase {
if (speciesOverride) {
this.scene.executeWithSeedOffset(() => {
ret = new PlayerPokemon(this.scene, getPokemonSpecies(speciesOverride), 5, null, null, undefined, false);
const pokemonSpecies = getPokemonSpecies(speciesOverride);
ret = new PlayerPokemon(this.scene, pokemonSpecies, 5, undefined, this.scene.getSpeciesFormIndex(pokemonSpecies, true), undefined, false);
}, this.egg.id, EGG_SEED.toString());
} else {
let minStarterValue: integer;
@ -394,7 +395,9 @@ export class EggHatchPhase extends BattlePhase {
}
}
ret = new PlayerPokemon(this.scene, getPokemonSpecies(species), 5, null, null, undefined, false);
const pokemonSpecies = getPokemonSpecies(species);
ret = new PlayerPokemon(this.scene, pokemonSpecies, 5, undefined, this.scene.getSpeciesFormIndex(pokemonSpecies, true), undefined, false);
}, this.egg.id, EGG_SEED.toString());
}

View File

@ -659,8 +659,8 @@ export default class PartyUiHandler extends MessageUiHandler {
const selectCallback = this.selectCallback;
this.selectCallback = null;
selectCallback(this.cursor, PartyOption.RELEASE);
} else
this.showText(null, 0);
}
this.showText(null, 0);
}, null, true);
}