mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2024-11-26 16:56:11 +00:00
Fix softlock with switch out moves used on player
This commit is contained in:
parent
211d8d3636
commit
2cc38ac2cb
@ -2096,7 +2096,7 @@ export class ForceSwitchOutAttr extends MoveEffectAttr {
|
||||
return resolve(false);
|
||||
const switchOutTarget = this.user ? user : target;
|
||||
if (switchOutTarget instanceof PlayerPokemon) {
|
||||
(switchOutTarget as PlayerPokemon).switchOut(this.batonPass).then(() => resolve(true));
|
||||
(switchOutTarget as PlayerPokemon).switchOut(this.batonPass, true).then(() => resolve(true));
|
||||
return;
|
||||
} else if (user.scene.currentBattle.battleType) {
|
||||
switchOutTarget.resetTurnData();
|
||||
|
@ -2057,7 +2057,7 @@ export class PlayerPokemon extends Pokemon {
|
||||
return true;
|
||||
}
|
||||
|
||||
switchOut(batonPass: boolean): Promise<void> {
|
||||
switchOut(batonPass: boolean, removeFromField: boolean = false): Promise<void> {
|
||||
return new Promise(resolve => {
|
||||
this.resetTurnData();
|
||||
this.resetSummonData();
|
||||
@ -2067,6 +2067,11 @@ export class PlayerPokemon extends Pokemon {
|
||||
this.scene.ui.setMode(Mode.PARTY, PartyUiMode.FAINT_SWITCH, this.getFieldIndex(), (slotIndex: integer, option: PartyOption) => {
|
||||
if (slotIndex >= this.scene.currentBattle.getBattlerCount() && slotIndex < 6)
|
||||
this.scene.unshiftPhase(new SwitchSummonPhase(this.scene, this.getFieldIndex(), slotIndex, false, batonPass));
|
||||
if (removeFromField) {
|
||||
this.setVisible(false);
|
||||
this.scene.field.remove(this);
|
||||
this.scene.triggerPokemonFormChange(this, SpeciesFormChangeActiveTrigger, true);
|
||||
}
|
||||
this.scene.ui.setMode(Mode.MESSAGE).then(() => resolve());
|
||||
}, PartyUiHandler.FilterNonFainted);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user