diff --git a/packages/pokemon/src/data/evolution.ts b/packages/pokemon/src/data/evolution.ts index 6da728a61..754f0e0a6 100644 --- a/packages/pokemon/src/data/evolution.ts +++ b/packages/pokemon/src/data/evolution.ts @@ -2,6 +2,8 @@ import { Dex } from '@pkmn/sim' import type { SpeciesId } from '../types' import { ALL_SPECIES_IDS } from '../types' + + export interface EvolutionChainStep { from: SpeciesId to: SpeciesId @@ -33,13 +35,3 @@ export function getNextEvolution(speciesId: SpeciesId): EvolutionChainStep | und minLevel: targetDex.evoLevel ?? undefined, } } - -/** @deprecated Use getNextEvolution() instead. Kept for backward compat. */ -export const EVOLUTION_CHAINS: EvolutionChainStep[] = (() => { - const chains: EvolutionChainStep[] = [] - for (const id of ALL_SPECIES_IDS) { - const evo = getNextEvolution(id) - if (evo) chains.push(evo) - } - return chains -})() diff --git a/packages/pokemon/src/index.ts b/packages/pokemon/src/index.ts index 4debb21e0..6ee0e7f6c 100644 --- a/packages/pokemon/src/index.ts +++ b/packages/pokemon/src/index.ts @@ -32,7 +32,7 @@ export { DEFAULT_EV_MAPPING, getEVForTool, MAX_EV_PER_STAT, MAX_EV_TOTAL } from export { xpForLevel, levelFromXp, xpToNextLevel } from './data/xpTable' export { SPECIES_NAMES, SPECIES_I18N, SPECIES_PERSONALITY } from './data/names' export { getAllNatureNames, randomNature, getNatureEffect } from './data/nature' -export { getNextEvolution, EVOLUTION_CHAINS } from './data/evolution' +export { getNextEvolution } from './data/evolution' export { getDefaultMoveset, getDefaultAbility, getNewLearnableMoves } from './data/learnsets' export { FROM_DEX_STAT, TO_DEX_STAT } from './data/pkmn' diff --git a/packages/pokemon/src/ui/CompanionCard.tsx b/packages/pokemon/src/ui/CompanionCard.tsx index cc1e02453..d37a7b840 100644 --- a/packages/pokemon/src/ui/CompanionCard.tsx +++ b/packages/pokemon/src/ui/CompanionCard.tsx @@ -8,6 +8,7 @@ import { calculateStats, getCreatureName, getTotalEV } from '../core/creature' import { getXpProgress } from '../core/experience' import { getEVSummary } from '../core/effort' import { getGenderSymbol } from '../core/gender' +import { getStatColor } from './shared' import { getNextEvolution } from '../data/evolution' import { StatBar } from './StatBar' @@ -156,15 +157,3 @@ export function CompanionCard({ creature, buddyData, spriteLines }: CompanionCar ) } - -function getStatColor(stat: string): Color { - const colors: Record = { - hp: 'ansi:green', - attack: 'ansi:red', - defense: 'ansi:yellow', - spAtk: 'ansi:blue', - spDef: 'ansi:magenta', - speed: 'ansi:cyan', - } - return colors[stat] ?? 'ansi:white' -} diff --git a/packages/pokemon/src/ui/SpeciesDetail.tsx b/packages/pokemon/src/ui/SpeciesDetail.tsx index a05022884..9fe158c72 100644 --- a/packages/pokemon/src/ui/SpeciesDetail.tsx +++ b/packages/pokemon/src/ui/SpeciesDetail.tsx @@ -6,6 +6,7 @@ import { getSpeciesData } from '../data/species' import { SPECIES_PERSONALITY } from '../data/names' import { getNextEvolution } from '../data/evolution' import { StatBar } from './StatBar' +import { getStatColor } from './shared' const CYAN: Color = 'ansi:cyan' const GRAY: Color = 'ansi:white' @@ -184,10 +185,3 @@ function isInChain(target: SpeciesId, head: SpeciesId): boolean { return false } -function getStatColor(stat: string): Color { - const colors: Record = { - hp: 'ansi:green', attack: 'ansi:red', defense: 'ansi:yellow', - spAtk: 'ansi:blue', spDef: 'ansi:magenta', speed: 'ansi:cyan', - } - return colors[stat] ?? 'ansi:white' -} diff --git a/packages/pokemon/src/ui/shared.ts b/packages/pokemon/src/ui/shared.ts new file mode 100644 index 000000000..a20803cab --- /dev/null +++ b/packages/pokemon/src/ui/shared.ts @@ -0,0 +1,14 @@ +import type { Color } from '@anthropic/ink' + +const STAT_COLORS: Record = { + hp: 'ansi:green', + attack: 'ansi:red', + defense: 'ansi:yellow', + spAtk: 'ansi:blue', + spDef: 'ansi:magenta', + speed: 'ansi:cyan', +} + +export function getStatColor(stat: string): Color { + return STAT_COLORS[stat] ?? 'ansi:white' +}