diff --git a/src/battle-scene.ts b/src/battle-scene.ts index 1a1690224..5c920f916 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -143,6 +143,7 @@ export default class BattleScene extends Phaser.Scene { private party: PlayerPokemon[]; private waveCountText: Phaser.GameObjects.Text; private moneyText: Phaser.GameObjects.Text; + private scoreText: Phaser.GameObjects.Text; private modifierBar: ModifierBar; private enemyModifierBar: ModifierBar; private fieldOverlay: Phaser.GameObjects.Rectangle; @@ -548,10 +549,14 @@ export default class BattleScene extends Phaser.Scene { this.waveCountText.setOrigin(1, 0); this.fieldUI.add(this.waveCountText); - this.moneyText = addTextObject(this, (this.game.canvas.width / 6) - 2, 0, startingWave.toString(), TextStyle.MONEY); + this.moneyText = addTextObject(this, (this.game.canvas.width / 6) - 2, 0, '', TextStyle.MONEY); this.moneyText.setOrigin(1, 0); this.fieldUI.add(this.moneyText); + this.scoreText = addTextObject(this, (this.game.canvas.width / 6) - 2, 0, '', TextStyle.PARTY, { fontSize: '54px' }); + this.scoreText.setOrigin(1, 0); + this.fieldUI.add(this.scoreText); + this.updateUIPositions(); this.damageNumberHandler = new DamageNumberHandler(); @@ -655,6 +660,7 @@ export default class BattleScene extends Phaser.Scene { this.updateWaveCountText(); this.updateMoneyText(); + this.updateScoreText(); } initExpSprites(): void { @@ -1139,12 +1145,19 @@ export default class BattleScene extends Phaser.Scene { this.moneyText.setVisible(true); } + updateScoreText(): void { + this.scoreText.setText(`Score: ${this.score.toString()}`); + this.scoreText.setVisible(this.gameMode.isDaily); + } + updateUIPositions(): void { const enemyModifierCount = this.enemyModifiers.filter(m => m.isIconVisible(this)).length; this.waveCountText.setY(-(this.game.canvas.height / 6) + (enemyModifierCount ? enemyModifierCount <= 12 ? 15 : 24 : 0)); this.moneyText.setY(this.waveCountText.y + 10); - this.partyExpBar.setY(this.moneyText.y + 15); - this.ui?.achvBar.setY((this.game.canvas.height / 6 + this.moneyText.y + 15)); + this.scoreText.setY(this.moneyText.y + 10); + const offsetY = (this.scoreText.visible ? this.scoreText : this.moneyText).y + 15; + this.partyExpBar.setY(offsetY); + this.ui?.achvBar.setY(this.game.canvas.height / 6 + offsetY); } addFaintedEnemyScore(enemy: EnemyPokemon): void { diff --git a/src/battle.ts b/src/battle.ts index 844e2e735..a049127dd 100644 --- a/src/battle.ts +++ b/src/battle.ts @@ -159,6 +159,7 @@ export default class Battle { scene.score += finalBattleScore; console.log(`Battle Score: ${finalBattleScore} (${this.turn - 1} Turns x${Math.floor(turnMultiplier * 100) / 100})`); console.log(`Total Score: ${scene.score}`); + scene.updateScoreText(); } getBgmOverride(scene: BattleScene): string { diff --git a/src/phases.ts b/src/phases.ts index 41045c96b..9e2d4bebf 100644 --- a/src/phases.ts +++ b/src/phases.ts @@ -2971,6 +2971,7 @@ export class VictoryPhase extends PokemonPhase { } else { this.scene.currentBattle.battleType = BattleType.CLEAR; this.scene.score += this.scene.gameMode.getClearScoreBonus(); + this.scene.updateScoreText(); this.scene.pushPhase(new GameOverPhase(this.scene, true)); } } diff --git a/src/system/game-data.ts b/src/system/game-data.ts index 9e52c6575..9d2eb3f92 100644 --- a/src/system/game-data.ts +++ b/src/system/game-data.ts @@ -572,6 +572,7 @@ export class GameData { this.gameStats.highestMoney = scene.money; scene.score = sessionData.score; + scene.updateScoreText(); const battleType = sessionData.battleType || 0; const battle = scene.newBattle(sessionData.waveIndex, battleType, sessionData.trainer, battleType === BattleType.TRAINER ? trainerConfigs[sessionData.trainer.trainerType].isDouble : sessionData.enemyParty.length > 1);