Add score to daily run mode
parent
91b74fbef3
commit
88e050581e
|
@ -143,6 +143,7 @@ export default class BattleScene extends Phaser.Scene {
|
||||||
private party: PlayerPokemon[];
|
private party: PlayerPokemon[];
|
||||||
private waveCountText: Phaser.GameObjects.Text;
|
private waveCountText: Phaser.GameObjects.Text;
|
||||||
private moneyText: Phaser.GameObjects.Text;
|
private moneyText: Phaser.GameObjects.Text;
|
||||||
|
private scoreText: Phaser.GameObjects.Text;
|
||||||
private modifierBar: ModifierBar;
|
private modifierBar: ModifierBar;
|
||||||
private enemyModifierBar: ModifierBar;
|
private enemyModifierBar: ModifierBar;
|
||||||
private fieldOverlay: Phaser.GameObjects.Rectangle;
|
private fieldOverlay: Phaser.GameObjects.Rectangle;
|
||||||
|
@ -548,10 +549,14 @@ export default class BattleScene extends Phaser.Scene {
|
||||||
this.waveCountText.setOrigin(1, 0);
|
this.waveCountText.setOrigin(1, 0);
|
||||||
this.fieldUI.add(this.waveCountText);
|
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.moneyText.setOrigin(1, 0);
|
||||||
this.fieldUI.add(this.moneyText);
|
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.updateUIPositions();
|
||||||
|
|
||||||
this.damageNumberHandler = new DamageNumberHandler();
|
this.damageNumberHandler = new DamageNumberHandler();
|
||||||
|
@ -655,6 +660,7 @@ export default class BattleScene extends Phaser.Scene {
|
||||||
|
|
||||||
this.updateWaveCountText();
|
this.updateWaveCountText();
|
||||||
this.updateMoneyText();
|
this.updateMoneyText();
|
||||||
|
this.updateScoreText();
|
||||||
}
|
}
|
||||||
|
|
||||||
initExpSprites(): void {
|
initExpSprites(): void {
|
||||||
|
@ -1139,12 +1145,19 @@ export default class BattleScene extends Phaser.Scene {
|
||||||
this.moneyText.setVisible(true);
|
this.moneyText.setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateScoreText(): void {
|
||||||
|
this.scoreText.setText(`Score: ${this.score.toString()}`);
|
||||||
|
this.scoreText.setVisible(this.gameMode.isDaily);
|
||||||
|
}
|
||||||
|
|
||||||
updateUIPositions(): void {
|
updateUIPositions(): void {
|
||||||
const enemyModifierCount = this.enemyModifiers.filter(m => m.isIconVisible(this)).length;
|
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.waveCountText.setY(-(this.game.canvas.height / 6) + (enemyModifierCount ? enemyModifierCount <= 12 ? 15 : 24 : 0));
|
||||||
this.moneyText.setY(this.waveCountText.y + 10);
|
this.moneyText.setY(this.waveCountText.y + 10);
|
||||||
this.partyExpBar.setY(this.moneyText.y + 15);
|
this.scoreText.setY(this.moneyText.y + 10);
|
||||||
this.ui?.achvBar.setY((this.game.canvas.height / 6 + this.moneyText.y + 15));
|
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 {
|
addFaintedEnemyScore(enemy: EnemyPokemon): void {
|
||||||
|
|
|
@ -159,6 +159,7 @@ export default class Battle {
|
||||||
scene.score += finalBattleScore;
|
scene.score += finalBattleScore;
|
||||||
console.log(`Battle Score: ${finalBattleScore} (${this.turn - 1} Turns x${Math.floor(turnMultiplier * 100) / 100})`);
|
console.log(`Battle Score: ${finalBattleScore} (${this.turn - 1} Turns x${Math.floor(turnMultiplier * 100) / 100})`);
|
||||||
console.log(`Total Score: ${scene.score}`);
|
console.log(`Total Score: ${scene.score}`);
|
||||||
|
scene.updateScoreText();
|
||||||
}
|
}
|
||||||
|
|
||||||
getBgmOverride(scene: BattleScene): string {
|
getBgmOverride(scene: BattleScene): string {
|
||||||
|
|
|
@ -2971,6 +2971,7 @@ export class VictoryPhase extends PokemonPhase {
|
||||||
} else {
|
} else {
|
||||||
this.scene.currentBattle.battleType = BattleType.CLEAR;
|
this.scene.currentBattle.battleType = BattleType.CLEAR;
|
||||||
this.scene.score += this.scene.gameMode.getClearScoreBonus();
|
this.scene.score += this.scene.gameMode.getClearScoreBonus();
|
||||||
|
this.scene.updateScoreText();
|
||||||
this.scene.pushPhase(new GameOverPhase(this.scene, true));
|
this.scene.pushPhase(new GameOverPhase(this.scene, true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -572,6 +572,7 @@ export class GameData {
|
||||||
this.gameStats.highestMoney = scene.money;
|
this.gameStats.highestMoney = scene.money;
|
||||||
|
|
||||||
scene.score = sessionData.score;
|
scene.score = sessionData.score;
|
||||||
|
scene.updateScoreText();
|
||||||
|
|
||||||
const battleType = sessionData.battleType || 0;
|
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);
|
const battle = scene.newBattle(sessionData.waveIndex, battleType, sessionData.trainer, battleType === BattleType.TRAINER ? trainerConfigs[sessionData.trainer.trainerType].isDouble : sessionData.enemyParty.length > 1);
|
||||||
|
|
Loading…
Reference in New Issue