From 62ed84638fa163c6c37035ec9c75636df50fa06a Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Thu, 14 Mar 2024 17:15:01 -0400 Subject: [PATCH] Fix GameMode enum order --- src/battle-scene.ts | 1 - src/battle.ts | 4 +--- src/game-mode.ts | 28 +++++++++++++++++++--------- src/phases.ts | 23 +++++++++++------------ 4 files changed, 31 insertions(+), 25 deletions(-) diff --git a/src/battle-scene.ts b/src/battle-scene.ts index a5051baaeab..5d6b3d67077 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -102,7 +102,6 @@ export default class BattleScene extends Phaser.Scene { public fusionPaletteSwaps: boolean = true; public enableTouchControls: boolean = false; public enableVibration: boolean = false; - public finalWave: integer = 200; public gameData: GameData; diff --git a/src/battle.ts b/src/battle.ts index 6eafbf311ce..b3e96d6c20d 100644 --- a/src/battle.ts +++ b/src/battle.ts @@ -88,9 +88,7 @@ export default class Battle { } private getLevelForWave(): integer { - let levelWaveIndex = this.waveIndex; - if (this.gameMode.isDaily) - levelWaveIndex += 30 + Math.floor(this.waveIndex / 5); + let levelWaveIndex = this.gameMode.getWaveForDifficulty(this.waveIndex); let baseLevel = 1 + levelWaveIndex / 2 + Math.pow(levelWaveIndex / 25, 2); const bossMultiplier = 1.2; diff --git a/src/game-mode.ts b/src/game-mode.ts index 962236c6af3..ebb7582ab47 100644 --- a/src/game-mode.ts +++ b/src/game-mode.ts @@ -1,8 +1,8 @@ export enum GameModes { - DAILY, CLASSIC, ENDLESS, - SPLICED_ENDLESS + SPLICED_ENDLESS, + DAILY } interface GameModeConfig { @@ -30,24 +30,34 @@ export class GameMode implements GameModeConfig { constructor(modeId: GameModes, config: GameModeConfig) { this.modeId = modeId; Object.assign(this, config); + console.log(modeId, this, config); + } + + getWaveForDifficulty(waveIndex: integer): integer { + switch (this.modeId) { + case GameModes.DAILY: + return waveIndex + 30 + Math.floor(waveIndex / 5); + default: + return waveIndex; + } } isWaveFinal(waveIndex: integer): boolean { switch (this.modeId) { - case GameModes.DAILY: - return waveIndex === 50; case GameModes.CLASSIC: return waveIndex === 200; case GameModes.ENDLESS: case GameModes.SPLICED_ENDLESS: return !(waveIndex % 250); + case GameModes.DAILY: + return waveIndex === 50; } } getEnemyModifierChance(isBoss: boolean): integer { switch (this.modeId) { - case GameModes.DAILY: case GameModes.CLASSIC: + case GameModes.DAILY: return !isBoss ? 18 : 6; case GameModes.ENDLESS: case GameModes.SPLICED_ENDLESS: @@ -57,21 +67,21 @@ export class GameMode implements GameModeConfig { getName(): string { switch (this.modeId) { - case GameModes.DAILY: - return 'Daily Run'; case GameModes.CLASSIC: return 'Classic'; case GameModes.ENDLESS: return 'Endless'; case GameModes.SPLICED_ENDLESS: return 'Endless (Spliced)'; + case GameModes.DAILY: + return 'Daily Run'; } } } export const gameModes = Object.freeze({ - [GameModes.DAILY]: new GameMode(GameModes.DAILY, { isDaily: true, hasTrainers: true }), [GameModes.CLASSIC]: new GameMode(GameModes.CLASSIC, { isClassic: true, hasTrainers: true, hasFixedBattles: true }), [GameModes.ENDLESS]: new GameMode(GameModes.ENDLESS, { isEndless: true, hasRandomBiomes: true, hasRandomBosses: true }), - [GameModes.SPLICED_ENDLESS]: new GameMode(GameModes.SPLICED_ENDLESS, { isEndless: true, hasRandomBiomes: true, hasRandomBosses: true, isSplicedOnly: true }) + [GameModes.SPLICED_ENDLESS]: new GameMode(GameModes.SPLICED_ENDLESS, { isEndless: true, hasRandomBiomes: true, hasRandomBosses: true, isSplicedOnly: true }), + [GameModes.DAILY]: new GameMode(GameModes.DAILY, { isDaily: true, hasTrainers: true }) }); \ No newline at end of file diff --git a/src/phases.ts b/src/phases.ts index 6483aee38fb..21ded3f97b7 100644 --- a/src/phases.ts +++ b/src/phases.ts @@ -3771,18 +3771,17 @@ export class SelectModifierPhase extends BattlePhase { } const applyModifier = (modifier: Modifier, playSound: boolean = false) => { - this.scene.addModifier(modifier, false, playSound).then(() => { - if (cost) { - this.scene.money -= cost; - this.scene.updateMoneyText(); - this.scene.playSound('buy'); - (this.scene.ui.getHandler() as ModifierSelectUiHandler).updateCostText(); - } else { - this.scene.ui.clearText(); - this.scene.ui.setMode(Mode.MESSAGE); - super.end(); - } - }); + this.scene.addModifier(modifier, false, playSound); + if (cost) { + this.scene.money -= cost; + this.scene.updateMoneyText(); + this.scene.playSound('buy'); + (this.scene.ui.getHandler() as ModifierSelectUiHandler).updateCostText(); + } else { + this.scene.ui.clearText(); + this.scene.ui.setMode(Mode.MESSAGE); + super.end(); + } }; if (modifierType instanceof PokemonModifierType) {