From 91a4333e967851ee246ea5a0a0a523a7fed6162b Mon Sep 17 00:00:00 2001 From: Wlowscha <54003515+Wlowscha@users.noreply.github.com> Date: Tue, 4 Feb 2025 02:43:52 +0100 Subject: [PATCH] [Misc] New data structures for pokedex (#5223) * Introducing catchableStarters in biomes.ts * Introducing SpeciesTmMoves with a list of TM moves for each species * speciesTmMoves now properly accounts for form-specific tms * Removed argument from transverse function * Adding types to passive abilities data structures * Update tms.ts * Update src/data/balance/passives.ts Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> --------- Co-authored-by: damocleas Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> --- src/data/balance/biomes.ts | 21 +++++++++++++++++++ src/data/balance/passives.ts | 10 ++++++++- src/data/balance/tms.ts | 40 ++++++++++++++++++++++++++++++++++++ 3 files changed, 70 insertions(+), 1 deletion(-) diff --git a/src/data/balance/biomes.ts b/src/data/balance/biomes.ts index 240881ad580..8913fd47e93 100644 --- a/src/data/balance/biomes.ts +++ b/src/data/balance/biomes.ts @@ -102,6 +102,18 @@ export interface BiomePokemonPools { [key: integer]: BiomeTierPokemonPools } +export interface BiomeTierTod { + biome: Biome, + tier: BiomePoolTier, + tod: TimeOfDay[] +} + +export interface CatchableSpecies{ + [key: integer]: BiomeTierTod[] +} + +export const catchableSpecies: CatchableSpecies = {}; + export interface BiomeTierTrainerPools { [key: integer]: TrainerType[] } @@ -7716,6 +7728,9 @@ export function initBiomes() { uncatchableSpecies.push(speciesId); } + // array of biome options for the current species + catchableSpecies[speciesId] = []; + for (const b of biomeEntries) { const biome = b[0]; const tier = b[1]; @@ -7725,6 +7740,12 @@ export function initBiomes() { : [ b[2] ] : [ TimeOfDay.ALL ]; + catchableSpecies[speciesId].push({ + biome: biome as Biome, + tier: tier as BiomePoolTier, + tod: timesOfDay as TimeOfDay[] + }); + for (const tod of timesOfDay) { if (!biomePokemonPools.hasOwnProperty(biome) || !biomePokemonPools[biome].hasOwnProperty(tier) || !biomePokemonPools[biome][tier].hasOwnProperty(tod)) { continue; diff --git a/src/data/balance/passives.ts b/src/data/balance/passives.ts index 60b50c7909c..f28b8bbdeea 100644 --- a/src/data/balance/passives.ts +++ b/src/data/balance/passives.ts @@ -1,7 +1,15 @@ import { Abilities } from "#app/enums/abilities"; import { Species } from "#app/enums/species"; -export const starterPassiveAbilities = { +export interface PassiveAbilities { + [key: number]: Abilities +} + +interface StarterPassiveAbilities { + [key: integer]: PassiveAbilities +} + +export const starterPassiveAbilities: StarterPassiveAbilities = { [Species.BULBASAUR]: { 0: Abilities.GRASSY_SURGE }, [Species.CHARMANDER]: { 0: Abilities.BEAST_BOOST }, [Species.SQUIRTLE]: { 0: Abilities.STURDY }, diff --git a/src/data/balance/tms.ts b/src/data/balance/tms.ts index da900768987..e44f7bf44bf 100644 --- a/src/data/balance/tms.ts +++ b/src/data/balance/tms.ts @@ -68433,6 +68433,46 @@ export const tmSpecies: TmSpecies = { ], }; +interface SpeciesTmMoves { + [key: integer]: (Moves | [string | Species, Moves])[]; +} + +function transposeTmSpecies(): SpeciesTmMoves { + const flipped: SpeciesTmMoves = {}; + + for (const move in tmSpecies) { + const moveKey = Number(move); + const speciesList = tmSpecies[move]; + + for (const species of speciesList) { + + if (Array.isArray(species)) { + // Extract base species and all associated forms + const [ baseSpecies, ...forms ] = species; + const speciesKey = Number(baseSpecies); + + if (!flipped[speciesKey]) { + flipped[speciesKey] = []; + } + + for (const form of forms) { + flipped[speciesKey].push([ form, moveKey ]); + } + + } else { + const speciesKey = Number(species); + if (!flipped[speciesKey]) { + flipped[speciesKey] = []; + } + flipped[speciesKey].push(moveKey); + } + } + } + return flipped; +} + +export const speciesTmMoves: SpeciesTmMoves = transposeTmSpecies(); + interface TmPoolTiers { [key: integer]: ModifierTier }