Fix bug with releasing first party member

This commit is contained in:
Flashfyre committed 2023-04-13 23:50:48 -04:00
1 parent 1b8c8b5a3f
commit 618128dd00
3 files changed
+27 -3

No files matched your search

+18
View File
@@ -379,6 +379,12 @@ export class CheckSwitchPhase extends BattlePhase {
start() {
super.start();
if (this.scene.field.getAll().indexOf(this.scene.getPlayerPokemon()) === -1) {
this.scene.unshiftPhase(new SummonMissingPhase(this.scene));
super.end();
return;
}
this.scene.ui.showText('Will you switch\nPOKéMON?', null, () => {
this.scene.ui.setMode(Mode.CONFIRM, () => {
this.scene.unshiftPhase(new SwitchPhase(this.scene, false, true));
@@ -388,6 +394,17 @@ export class CheckSwitchPhase extends BattlePhase {
}
}
export class SummonMissingPhase extends SummonPhase {
constructor(scene: BattleScene) {
super(scene);
}
preSummon(): void {
this.scene.ui.showText(`Go! ${this.scene.getPlayerPokemon().name}!`);
this.scene.time.delayedCall(250, () => this.summon());
}
}
export class CommandPhase extends BattlePhase {
constructor(scene: BattleScene) {
super(scene)
@@ -1375,6 +1392,7 @@ export class AttemptCapturePhase extends BattlePhase {
});
});
}, () => {
this.scene.ui.setMode(Mode.MESSAGE);
pokemon.hp = 0;
end();
});