Fix post-summon abilities sometimes triggering twice on switch

This commit is contained in:
Flashfyre 2024-04-11 12:35:22 -04:00
parent 053c07cfba
commit af23bfc1f9
1 changed files with 3 additions and 2 deletions

View File

@ -535,8 +535,8 @@ export abstract class FieldPhase extends BattlePhase {
export abstract class PokemonPhase extends FieldPhase { export abstract class PokemonPhase extends FieldPhase {
protected battlerIndex: BattlerIndex | integer; protected battlerIndex: BattlerIndex | integer;
protected player: boolean; public player: boolean;
protected fieldIndex: integer; public fieldIndex: integer;
constructor(scene: BattleScene, battlerIndex: BattlerIndex | integer) { constructor(scene: BattleScene, battlerIndex: BattlerIndex | integer) {
super(scene); super(scene);
@ -1446,6 +1446,7 @@ export class CheckSwitchPhase extends BattlePhase {
this.scene.ui.showText(`Will you switch\n${this.useName ? pokemon.name : 'Pokémon'}?`, null, () => { this.scene.ui.showText(`Will you switch\n${this.useName ? pokemon.name : 'Pokémon'}?`, null, () => {
this.scene.ui.setMode(Mode.CONFIRM, () => { this.scene.ui.setMode(Mode.CONFIRM, () => {
this.scene.ui.setMode(Mode.MESSAGE); this.scene.ui.setMode(Mode.MESSAGE);
this.scene.tryRemovePhase(p => p instanceof PostSummonPhase && p.player && p.fieldIndex === this.fieldIndex);
this.scene.unshiftPhase(new SwitchPhase(this.scene, this.fieldIndex, false, true)); this.scene.unshiftPhase(new SwitchPhase(this.scene, this.fieldIndex, false, true));
this.end(); this.end();
}, () => { }, () => {