Fix GameMode enum order

pull/16/head
Flashfyre 2024-03-14 17:15:01 -04:00
parent 623d600e13
commit 62ed84638f
4 changed files with 31 additions and 25 deletions

View File

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

View File

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

View File

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

View File

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