Add score to daily run mode

pull/16/head
Flashfyre 2024-03-19 00:03:41 -04:00
parent 91b74fbef3
commit 88e050581e
4 changed files with 19 additions and 3 deletions

View File

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

View File

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

View File

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

View File

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