Fix crash when returning shiny

This commit is contained in:
Flashfyre 2023-07-05 16:13:00 -04:00
parent 4b61e50d72
commit a005c7c850
1 changed files with 20 additions and 11 deletions

View File

@ -550,11 +550,7 @@ export class SummonPhase extends PartyMemberPokemonPhase {
});
}
queuePostSummon() {
this.scene.pushPhase(new PostSummonPhase(this.scene, this.getPokemon().getBattlerIndex()));
}
end() {
onEnd(): void {
const pokemon = this.getPokemon();
if (pokemon.shiny)
@ -563,6 +559,14 @@ export class SummonPhase extends PartyMemberPokemonPhase {
pokemon.resetTurnData();
this.queuePostSummon();
}
queuePostSummon(): void {
this.scene.pushPhase(new PostSummonPhase(this.scene, this.getPokemon().getBattlerIndex()));
}
end() {
this.onEnd();
super.end();
}
@ -632,19 +636,19 @@ export class SwitchSummonPhase extends SummonPhase {
this.end();
}
queuePostSummon() {
this.scene.unshiftPhase(new PostSummonPhase(this.scene, this.getPokemon().getBattlerIndex()));
}
onEnd(): void {
super.onEnd();
end() {
const pokemon = this.getPokemon();
if (this.batonPass && pokemon)
pokemon.transferSummon(this.lastPokemon);
this.lastPokemon?.resetSummonData();
}
super.end();
queuePostSummon(): void {
this.scene.unshiftPhase(new PostSummonPhase(this.scene, this.getPokemon().getBattlerIndex()));
}
}
@ -659,7 +663,12 @@ export class ReturnPhase extends SwitchSummonPhase {
summon(): void { }
queuePostSummon() { }
onEnd(): void {
const pokemon = this.getPokemon();
pokemon.resetTurnData();
pokemon.resetSummonData();
}
}
export class ToggleDoublePositionPhase extends BattlePhase {