Fix bug with releasing first party member
parent
1b8c8b5a3f
commit
618128dd00
|
@ -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();
|
||||
});
|
||||
|
|
|
@ -15,7 +15,7 @@ import { initMoveAnim, loadMoveAnimAssets } from './battle-anims';
|
|||
import { Status, StatusEffect } from './status-effect';
|
||||
import { tmSpecies } from './tms';
|
||||
import { pokemonEvolutions, SpeciesEvolution, SpeciesEvolutionCondition } from './pokemon-evolutions';
|
||||
import { MessagePhase, StatChangePhase } from './battle-phases';
|
||||
import { MessagePhase } from './battle-phases';
|
||||
import { BattleStat } from './battle-stat';
|
||||
import { BattleTag, BattleTagLapseType, BattleTagType } from './battle-tag';
|
||||
|
||||
|
@ -716,6 +716,11 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
this.scene.sound.play('sparkle');
|
||||
}
|
||||
}
|
||||
|
||||
destroy(): void {
|
||||
this.battleInfo.destroy();
|
||||
super.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
export class PlayerPokemon extends Pokemon {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { CommandPhase } from "../battle-phases";
|
||||
import { CommandPhase, SummonMissingPhase } from "../battle-phases";
|
||||
import BattleScene, { Button } from "../battle-scene";
|
||||
import { PlayerPokemon, PokemonMove } from "../pokemon";
|
||||
import { addTextObject, TextStyle } from "../text";
|
||||
|
@ -411,7 +411,8 @@ export default class PartyUiHandler extends MessageUiHandler {
|
|||
this.showText(this.getReleaseMessage(this.scene.getParty()[slotIndex].name), null, () => {
|
||||
this.clearPartySlots();
|
||||
this.scene.removePartyMemberModifiers(slotIndex);
|
||||
this.scene.getParty().splice(slotIndex, 1);
|
||||
const releasedPokemon = this.scene.getParty().splice(slotIndex, 1)[0];
|
||||
releasedPokemon.destroy();
|
||||
this.populatePartySlots();
|
||||
if (this.cursor >= this.scene.getParty().length)
|
||||
this.setCursor(this.cursor - 1);
|
||||
|
|
Loading…
Reference in New Issue