Fix GameMode enum order

This commit is contained in:
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 fusionPaletteSwaps: boolean = true;
public enableTouchControls: boolean = false; public enableTouchControls: boolean = false;
public enableVibration: boolean = false; public enableVibration: boolean = false;
public finalWave: integer = 200;
public gameData: GameData; public gameData: GameData;

View File

@ -88,9 +88,7 @@ export default class Battle {
} }
private getLevelForWave(): integer { private getLevelForWave(): integer {
let levelWaveIndex = this.waveIndex; let levelWaveIndex = this.gameMode.getWaveForDifficulty(this.waveIndex);
if (this.gameMode.isDaily)
levelWaveIndex += 30 + Math.floor(this.waveIndex / 5);
let baseLevel = 1 + levelWaveIndex / 2 + Math.pow(levelWaveIndex / 25, 2); let baseLevel = 1 + levelWaveIndex / 2 + Math.pow(levelWaveIndex / 25, 2);
const bossMultiplier = 1.2; const bossMultiplier = 1.2;

View File

@ -1,8 +1,8 @@
export enum GameModes { export enum GameModes {
DAILY,
CLASSIC, CLASSIC,
ENDLESS, ENDLESS,
SPLICED_ENDLESS SPLICED_ENDLESS,
DAILY
} }
interface GameModeConfig { interface GameModeConfig {
@ -30,24 +30,34 @@ export class GameMode implements GameModeConfig {
constructor(modeId: GameModes, config: GameModeConfig) { constructor(modeId: GameModes, config: GameModeConfig) {
this.modeId = modeId; this.modeId = modeId;
Object.assign(this, config); 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 { isWaveFinal(waveIndex: integer): boolean {
switch (this.modeId) { switch (this.modeId) {
case GameModes.DAILY:
return waveIndex === 50;
case GameModes.CLASSIC: case GameModes.CLASSIC:
return waveIndex === 200; return waveIndex === 200;
case GameModes.ENDLESS: case GameModes.ENDLESS:
case GameModes.SPLICED_ENDLESS: case GameModes.SPLICED_ENDLESS:
return !(waveIndex % 250); return !(waveIndex % 250);
case GameModes.DAILY:
return waveIndex === 50;
} }
} }
getEnemyModifierChance(isBoss: boolean): integer { getEnemyModifierChance(isBoss: boolean): integer {
switch (this.modeId) { switch (this.modeId) {
case GameModes.DAILY:
case GameModes.CLASSIC: case GameModes.CLASSIC:
case GameModes.DAILY:
return !isBoss ? 18 : 6; return !isBoss ? 18 : 6;
case GameModes.ENDLESS: case GameModes.ENDLESS:
case GameModes.SPLICED_ENDLESS: case GameModes.SPLICED_ENDLESS:
@ -57,21 +67,21 @@ export class GameMode implements GameModeConfig {
getName(): string { getName(): string {
switch (this.modeId) { switch (this.modeId) {
case GameModes.DAILY:
return 'Daily Run';
case GameModes.CLASSIC: case GameModes.CLASSIC:
return 'Classic'; return 'Classic';
case GameModes.ENDLESS: case GameModes.ENDLESS:
return 'Endless'; return 'Endless';
case GameModes.SPLICED_ENDLESS: case GameModes.SPLICED_ENDLESS:
return 'Endless (Spliced)'; return 'Endless (Spliced)';
case GameModes.DAILY:
return 'Daily Run';
} }
} }
} }
export const gameModes = Object.freeze({ 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.CLASSIC]: new GameMode(GameModes.CLASSIC, { isClassic: true, hasTrainers: true, hasFixedBattles: true }),
[GameModes.ENDLESS]: new GameMode(GameModes.ENDLESS, { isEndless: true, hasRandomBiomes: true, hasRandomBosses: 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,7 +3771,7 @@ export class SelectModifierPhase extends BattlePhase {
} }
const applyModifier = (modifier: Modifier, playSound: boolean = false) => { const applyModifier = (modifier: Modifier, playSound: boolean = false) => {
this.scene.addModifier(modifier, false, playSound).then(() => { this.scene.addModifier(modifier, false, playSound);
if (cost) { if (cost) {
this.scene.money -= cost; this.scene.money -= cost;
this.scene.updateMoneyText(); this.scene.updateMoneyText();
@ -3782,7 +3782,6 @@ export class SelectModifierPhase extends BattlePhase {
this.scene.ui.setMode(Mode.MESSAGE); this.scene.ui.setMode(Mode.MESSAGE);
super.end(); super.end();
} }
});
}; };
if (modifierType instanceof PokemonModifierType) { if (modifierType instanceof PokemonModifierType) {