From 0777e1a1f9064be8f9eed2a860e0bbce1c7e2a00 Mon Sep 17 00:00:00 2001 From: claude-code-best Date: Wed, 22 Apr 2026 06:04:12 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E5=88=A0=E9=99=A4=E6=9C=AA?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E7=9A=84=20pkmn.ts=20=E8=BE=85=E5=8A=A9?= =?UTF-8?q?=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 删除 getMove、getAbility、getType、getPrimaryAbility(无生产代码引用) - 同步删除对应的 pkmn.test.ts 测试 Co-Authored-By: Claude Opus 4.6 --- packages/pokemon/src/__tests__/pkmn.test.ts | 12 +----------- packages/pokemon/src/data/pkmn.ts | 20 -------------------- 2 files changed, 1 insertion(+), 31 deletions(-) diff --git a/packages/pokemon/src/__tests__/pkmn.test.ts b/packages/pokemon/src/__tests__/pkmn.test.ts index 73f0e788d..c17837fa7 100644 --- a/packages/pokemon/src/__tests__/pkmn.test.ts +++ b/packages/pokemon/src/__tests__/pkmn.test.ts @@ -1,5 +1,5 @@ import { describe, test, expect } from 'bun:test' -import { FROM_DEX_STAT, TO_DEX_STAT, mapBaseStats, mapGenderRatio, getPrimaryAbility } from '../data/pkmn' +import { FROM_DEX_STAT, TO_DEX_STAT, mapBaseStats, mapGenderRatio } from '../data/pkmn' describe('FROM_DEX_STAT', () => { test('maps all 6 stats', () => { @@ -44,13 +44,3 @@ describe('mapGenderRatio', () => { expect(mapGenderRatio({ M: 0.5, F: 0.5 })).toBe(4) // 50% F → 4 }) }) - -describe('getPrimaryAbility', () => { - test('returns first ability', () => { - expect(getPrimaryAbility({ '0': 'Overgrow', '1': 'Chlorophyll' })).toBe('overgrow') - }) - - test('returns empty string for missing ability', () => { - expect(getPrimaryAbility({})).toBe('') - }) -}) diff --git a/packages/pokemon/src/data/pkmn.ts b/packages/pokemon/src/data/pkmn.ts index 1d2cec0cc..358c8698e 100644 --- a/packages/pokemon/src/data/pkmn.ts +++ b/packages/pokemon/src/data/pkmn.ts @@ -23,21 +23,6 @@ export function getSpecies(id: string) { return gen.species.get(id) } -/** Query move from Dex */ -export function getMove(id: string) { - return gen.moves.get(id) -} - -/** Query ability from Dex */ -export function getAbility(id: string) { - return gen.abilities.get(id) -} - -/** Query type from Dex */ -export function getType(id: string) { - return gen.types.get(id) -} - /** Map Dex baseStats to our StatName format */ export function mapBaseStats(dexStats: { hp: number; atk: number; def: number; spa: number; spd: number; spe: number }): Record { const result = {} as Record @@ -52,8 +37,3 @@ export function mapGenderRatio(genderRatio?: { M: number; F: number } | string): if (!genderRatio || typeof genderRatio === 'string') return -1 // genderless return Math.round(genderRatio.F * 8) } - -/** Get primary ability ID from Dex abilities object */ -export function getPrimaryAbility(abilities: Record): string { - return abilities['0']?.toLowerCase() ?? '' -}