Change auto showing IVs

if the player doesn't dismiss the IVs, they go away on their own
This commit is contained in:
RedstonewolfX 2024-08-11 09:21:21 -04:00
parent a7d9fc028e
commit 7c0ae8eec0
2 changed files with 14 additions and 0 deletions

View File

@ -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()) {

View File

@ -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);