From f13e1ffa47982111d20c9ca269bdff5df67f3258 Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Sun, 17 Mar 2024 20:31:09 -0400 Subject: [PATCH] Record clears for failed daily runs --- src/battle.ts | 3 ++- src/phases.ts | 6 ++++-- src/ui/daily-run-scoreboard.ts | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/battle.ts b/src/battle.ts index 10fc679e0..ed49bec86 100644 --- a/src/battle.ts +++ b/src/battle.ts @@ -13,7 +13,8 @@ import { PokemonHeldItemModifier } from "./modifier/modifier"; export enum BattleType { WILD, - TRAINER + TRAINER, + CLEAR } export enum BattlerIndex { diff --git a/src/phases.ts b/src/phases.ts index 0a700902e..e3f397bf8 100644 --- a/src/phases.ts +++ b/src/phases.ts @@ -2960,8 +2960,10 @@ export class VictoryPhase extends PokemonPhase { } } this.scene.pushPhase(new NewBattlePhase(this.scene)); - } else + } else { + this.scene.currentBattle.battleType = BattleType.CLEAR; this.scene.pushPhase(new GameOverPhase(this.scene, true)); + } } this.end(); @@ -3107,7 +3109,7 @@ export class GameOverPhase extends BattlePhase { start() { super.start(); - (this.victory ? this.scene.gameData.tryClearSession(this.scene, this.scene.sessionSlotId) : this.scene.gameData.deleteSession(this.scene.sessionSlotId)).then((success: boolean | [boolean, boolean]) => { + this.scene.gameData.tryClearSession(this.scene, this.scene.sessionSlotId).then((success: boolean | [boolean, boolean]) => { this.scene.time.delayedCall(1000, () => { let firstClear = false; if (this.victory && success[1]) { diff --git a/src/ui/daily-run-scoreboard.ts b/src/ui/daily-run-scoreboard.ts index 32521ab80..91a767f07 100644 --- a/src/ui/daily-run-scoreboard.ts +++ b/src/ui/daily-run-scoreboard.ts @@ -21,14 +21,14 @@ export class DailyRunScoreboard extends Phaser.GameObjects.Container { } setup() { - const titleWindow = addWindow(this.scene, 0, 0, 110, 16, false, false, null, null, WindowVariant.THIN); + const titleWindow = addWindow(this.scene, 0, 0, 104, 16, false, false, null, null, WindowVariant.THIN); this.add(titleWindow); this.titleLabel = addTextObject(this.scene, titleWindow.displayWidth / 2, titleWindow.displayHeight / 2, 'Daily Rankings', TextStyle.WINDOW, { fontSize: '64px' }); this.titleLabel.setOrigin(0.5, 0.5); this.add(this.titleLabel); - const window = addWindow(this.scene, 0, 15, 110, 115, false, false, null, null, WindowVariant.THIN); + const window = addWindow(this.scene, 0, 15, 104, 115, false, false, null, null, WindowVariant.THIN); this.add(window); this.rankingsContainer = this.scene.add.container(6, 19);