Skip to content

Commit f9f69fb

Browse files
committed
End Freeze Hotfix
1 parent dcf66ee commit f9f69fb

File tree

1 file changed

+34
-19
lines changed

1 file changed

+34
-19
lines changed

src/data/biomes.ts

+34-19
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,21 @@ export function getBiomeName(biome: Biome | -1) {
2525
return i18next.t(`biome:${Biome[biome].toUpperCase()}`);
2626
}
2727
}
28-
type BiomeLink = (Biome | [Biome, integer])[];
28+
2929
interface BiomeLinks {
30-
[key: integer]: BiomeLink
30+
[key: integer]: Biome | (Biome | [Biome, integer])[]
3131
}
3232

3333
interface BiomeDepths {
3434
[key: integer]: [integer, integer]
3535
}
3636

3737
export const biomeLinks: BiomeLinks = {
38-
[Biome.TOWN]: [Biome.PLAINS],
38+
[Biome.TOWN]: Biome.PLAINS,
3939
[Biome.PLAINS]: [ Biome.GRASS, Biome.METROPOLIS, Biome.LAKE ],
40-
[Biome.GRASS]: [Biome.TALL_GRASS],
40+
[Biome.GRASS]: Biome.TALL_GRASS,
4141
[Biome.TALL_GRASS]: [ Biome.FOREST, Biome.CAVE ],
42-
[Biome.SLUM]: [Biome.CONSTRUCTION_SITE],
42+
[Biome.SLUM]: Biome.CONSTRUCTION_SITE,
4343
[Biome.FOREST]: [ Biome.JUNGLE, Biome.MEADOW ],
4444
[Biome.SEA]: [ Biome.SEABED, Biome.ICE_CAVE ],
4545
[Biome.SWAMP]: [ Biome.GRAVEYARD, Biome.TALL_GRASS ],
@@ -49,26 +49,26 @@ export const biomeLinks: BiomeLinks = {
4949
[Biome.MOUNTAIN]: [ Biome.VOLCANO, [ Biome.WASTELAND, 3 ] ],
5050
[Biome.BADLANDS]: [ Biome.DESERT, Biome.MOUNTAIN ],
5151
[Biome.CAVE]: [ Biome.BADLANDS, Biome.LAKE ],
52-
[Biome.DESERT]: [Biome.RUINS],
53-
[Biome.ICE_CAVE]: [Biome.SNOWY_FOREST],
52+
[Biome.DESERT]: Biome.RUINS,
53+
[Biome.ICE_CAVE]: Biome.SNOWY_FOREST,
5454
[Biome.MEADOW]: [ Biome.PLAINS, [ Biome.FAIRY_CAVE, 2 ] ],
55-
[Biome.POWER_PLANT]: [Biome.FACTORY],
55+
[Biome.POWER_PLANT]: Biome.FACTORY,
5656
[Biome.VOLCANO]: [ Biome.BEACH, [ Biome.ICE_CAVE, 4 ] ],
57-
[Biome.GRAVEYARD]: [Biome.ABYSS],
57+
[Biome.GRAVEYARD]: Biome.ABYSS,
5858
[Biome.DOJO]: [ Biome.PLAINS, [ Biome.TEMPLE, 3 ] ],
5959
[Biome.FACTORY]: [ Biome.PLAINS, [ Biome.LABORATORY, 4 ] ],
6060
[Biome.RUINS]: [ Biome.FOREST ],
61-
[Biome.WASTELAND]: [Biome.BADLANDS],
61+
[Biome.WASTELAND]: Biome.BADLANDS,
6262
[Biome.ABYSS]: [ Biome.CAVE, [ Biome.SPACE, 3 ], [ Biome.WASTELAND, 3 ] ],
63-
[Biome.SPACE]: [Biome.RUINS],
63+
[Biome.SPACE]: Biome.RUINS,
6464
[Biome.CONSTRUCTION_SITE]: [ Biome.DOJO, Biome.POWER_PLANT ],
6565
[Biome.JUNGLE]: [ Biome.TEMPLE ],
6666
[Biome.FAIRY_CAVE]: [ Biome.ICE_CAVE, [ Biome.SPACE, 3 ] ],
6767
[Biome.TEMPLE]: [ Biome.SWAMP, [ Biome.RUINS, 3 ] ],
68-
[Biome.METROPOLIS]: [Biome.SLUM],
68+
[Biome.METROPOLIS]: Biome.SLUM,
6969
[Biome.SNOWY_FOREST]: [ Biome.FOREST, Biome.LAKE, Biome.MOUNTAIN ],
70-
[Biome.ISLAND]: [Biome.SEA],
71-
[Biome.LABORATORY]: [Biome.CONSTRUCTION_SITE]
70+
[Biome.ISLAND]: Biome.SEA,
71+
[Biome.LABORATORY]: Biome.CONSTRUCTION_SITE
7272
};
7373

7474
export const biomeDepths: BiomeDepths = {};
@@ -87,12 +87,20 @@ export enum BiomePoolTier {
8787

8888
export const uncatchableSpecies: Species[] = [];
8989

90+
export interface SpeciesTree {
91+
[key: integer]: Species[]
92+
}
93+
9094
export interface PokemonPools {
91-
[key: integer]: (Species | Record<number, Species[]>)[]
95+
[key: integer]: (Species | SpeciesTree)[]
96+
}
97+
98+
export interface BiomeTierPokemonPools {
99+
[key: integer]: PokemonPools
92100
}
93101

94102
export interface BiomePokemonPools {
95-
[key: integer]: Record<number, PokemonPools>
103+
[key: integer]: BiomeTierPokemonPools
96104
}
97105

98106
export interface BiomeTierTrainerPools {
@@ -7657,9 +7665,16 @@ export function initBiomes() {
76577665
biomeDepths[Biome.TOWN] = [ 0, 1 ];
76587666

76597667
const traverseBiome = (biome: Biome, depth: integer) => {
7660-
for (const linkedBiomeEntry of biomeLinks[biome]) {
7661-
const linkedBiome = !Array.isArray(linkedBiomeEntry) ? linkedBiomeEntry as Biome : linkedBiomeEntry[0];
7662-
const biomeChance = !Array.isArray(linkedBiomeEntry) ? 1 : linkedBiomeEntry[1];
7668+
const linkedBiomes: (Biome | [ Biome, integer ])[] = Array.isArray(biomeLinks[biome])
7669+
? biomeLinks[biome] as (Biome | [ Biome, integer ])[]
7670+
: [ biomeLinks[biome] as Biome ];
7671+
for (const linkedBiomeEntry of linkedBiomes) {
7672+
const linkedBiome = !Array.isArray(linkedBiomeEntry)
7673+
? linkedBiomeEntry as Biome
7674+
: linkedBiomeEntry[0];
7675+
const biomeChance = !Array.isArray(linkedBiomeEntry)
7676+
? 1
7677+
: linkedBiomeEntry[1];
76637678
if (!biomeDepths.hasOwnProperty(linkedBiome) || biomeChance < biomeDepths[linkedBiome][1] || (depth < biomeDepths[linkedBiome][0] && biomeChance === biomeDepths[linkedBiome][1])) {
76647679
biomeDepths[linkedBiome] = [ depth + 1, biomeChance ];
76657680
traverseBiome(linkedBiome, depth + 1);

0 commit comments

Comments
 (0)