diff --git a/src/phases.ts b/src/phases.ts index 9584c72f84a..e928a4d7fd0 100644 --- a/src/phases.ts +++ b/src/phases.ts @@ -1916,8 +1916,10 @@ export class EncounterPhase extends BattlePhase { } } handleTutorial(this.scene, Tutorial.Access_Menu).then(() => { + // Auto-show the flyout if (this.scene.currentBattle.battleType !== BattleType.TRAINER) { this.scene.arenaFlyout.toggleFlyout(true) + this.scene.arenaFlyout.isAuto = true } super.end() }); @@ -2857,6 +2859,9 @@ export class TurnInitPhase extends FieldPhase { start() { super.start(); + // If the flyout was shown automatically, and the user hasn't made it go away, auto-hide it + this.scene.arenaFlyout.dismiss() + this.scene.getPlayerField().forEach(p => { // If this pokemon is in play and evolved into something illegal under the current challenge, force a switch if (p.isOnField() && !p.isAllowedInBattle()) { diff --git a/src/ui/arena-flyout.ts b/src/ui/arena-flyout.ts index 78d7ad5430e..0b9ab9c0ab7 100644 --- a/src/ui/arena-flyout.ts +++ b/src/ui/arena-flyout.ts @@ -102,6 +102,8 @@ export class ArenaFlyout extends Phaser.GameObjects.Container { private readonly onFieldEffectChangedEvent = (event: Event) => this.onFieldEffectChanged(event); + public isAuto: boolean = false; + constructor(scene: Phaser.Scene) { super(scene, 0, 0); this.setName("arena-flyout"); @@ -455,6 +457,7 @@ export class ArenaFlyout extends Phaser.GameObjects.Container { * @param visible Should the flyout be shown? */ public toggleFlyout(visible: boolean): void { + this.isAuto = false; this.scene.tweens.add({ targets: this.flyoutParent, x: visible ? this.anchorX : this.anchorX - this.translationX, @@ -465,6 +468,12 @@ export class ArenaFlyout extends Phaser.GameObjects.Container { }); } + public dismiss(): void { + if (this.isAuto) { + this.toggleFlyout(false) + } + } + public destroy(fromScene?: boolean): void { this.battleScene.eventTarget.removeEventListener(BattleSceneEventType.NEW_ARENA, this.onNewArenaEvent); this.battleScene.eventTarget.removeEventListener(BattleSceneEventType.TURN_END, this.onTurnEndEvent);