mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-14 19:39:29 +02:00
[Balance] Daily Mode now has its own Generate Random Starting Biome
This commit is contained in:
parent
8c4b20f056
commit
b2b7dead5f
@ -8,6 +8,7 @@ import type { PokemonSpeciesForm } from "#app/data/pokemon-species";
|
||||
import PokemonSpecies, { getPokemonSpecies, getPokemonSpeciesForm } from "#app/data/pokemon-species";
|
||||
import { speciesStarterCosts } from "#app/data/balance/starters";
|
||||
import { pokerogueApi } from "#app/plugins/api/pokerogue-api";
|
||||
import { Biome } from "#app/enums/biome";
|
||||
|
||||
export interface DailyRunConfig {
|
||||
seed: integer;
|
||||
@ -71,3 +72,76 @@ function getDailyRunStarter(starterSpeciesForm: PokemonSpeciesForm, startingLeve
|
||||
pokemon.destroy();
|
||||
return starter;
|
||||
}
|
||||
|
||||
interface BiomeWeights {
|
||||
[key: integer]: integer
|
||||
}
|
||||
|
||||
// Initially weighted by amount of exits each biome has
|
||||
// Town and End are set to 0 however
|
||||
// And some other biomes were balanced +1/-1 based on average size of the total daily.
|
||||
const dailyBiomeWeights: BiomeWeights = {
|
||||
[Biome.CAVE]: 3,
|
||||
[Biome.LAKE]: 3,
|
||||
[Biome.PLAINS]: 3,
|
||||
[Biome.SNOWY_FOREST]: 3,
|
||||
[Biome.SWAMP]: 3, // 2 -> 3
|
||||
[Biome.TALL_GRASS]: 3, // 2 -> 3
|
||||
|
||||
[Biome.ABYSS]: 2, // 3 -> 2
|
||||
[Biome.RUINS]: 2,
|
||||
[Biome.BADLANDS]: 2,
|
||||
[Biome.BEACH]: 2,
|
||||
[Biome.CONSTRUCTION_SITE]: 2,
|
||||
[Biome.DESERT]: 2,
|
||||
[Biome.DOJO]: 2, // 3 -> 2
|
||||
[Biome.FACTORY]: 2,
|
||||
[Biome.FAIRY_CAVE]: 2,
|
||||
[Biome.FOREST]: 2,
|
||||
[Biome.GRASS]: 2, // 1 -> 2
|
||||
[Biome.MEADOW]: 2,
|
||||
[Biome.MOUNTAIN]: 2, // 3 -> 2
|
||||
[Biome.SEA]: 2,
|
||||
[Biome.SEABED]: 2,
|
||||
[Biome.SLUM]: 2,
|
||||
[Biome.TEMPLE]: 2, // 3 -> 2
|
||||
[Biome.VOLCANO]: 2,
|
||||
|
||||
[Biome.GRAVEYARD]: 1,
|
||||
[Biome.ICE_CAVE]: 1,
|
||||
[Biome.ISLAND]: 1,
|
||||
[Biome.JUNGLE]: 1,
|
||||
[Biome.LABORATORY]: 1,
|
||||
[Biome.METROPOLIS]: 1,
|
||||
[Biome.POWER_PLANT]: 1,
|
||||
[Biome.SPACE]: 1,
|
||||
[Biome.WASTELAND]: 1,
|
||||
|
||||
[Biome.TOWN]: 0,
|
||||
[Biome.END]: 0,
|
||||
};
|
||||
|
||||
export function getDailyStartingBiome(): Biome {
|
||||
const biomes = Utils.getEnumValues(Biome).filter(b => b !== Biome.TOWN && b !== Biome.END);
|
||||
|
||||
let totalWeight = 0;
|
||||
const biomeThresholds: integer[] = [];
|
||||
for (const biome of biomes) {
|
||||
// Keep track of the total weight
|
||||
totalWeight += dailyBiomeWeights[biome];
|
||||
|
||||
// Keep track of each biomes cumulative weight
|
||||
biomeThresholds.push(totalWeight);
|
||||
}
|
||||
|
||||
const randInt = Utils.randSeedInt(totalWeight);
|
||||
|
||||
for (let i = 0; i < biomes.length; i++) {
|
||||
if (randInt < biomeThresholds[i]) {
|
||||
return biomes[i];
|
||||
}
|
||||
}
|
||||
|
||||
// Fallback in case something went wrong
|
||||
return biomes[Utils.randSeedInt(biomes.length)];
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ import { Biome } from "#enums/biome";
|
||||
import { Species } from "#enums/species";
|
||||
import { Challenges } from "./enums/challenges";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
import { getDailyStartingBiome } from "./data/daily-run";
|
||||
|
||||
export enum GameModes {
|
||||
CLASSIC,
|
||||
@ -120,7 +121,7 @@ export class GameMode implements GameModeConfig {
|
||||
getStartingBiome(): Biome {
|
||||
switch (this.modeId) {
|
||||
case GameModes.DAILY:
|
||||
return globalScene.generateRandomBiome(this.getWaveForDifficulty(1));
|
||||
return getDailyStartingBiome();
|
||||
default:
|
||||
return Overrides.STARTING_BIOME_OVERRIDE || Biome.TOWN;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user