refactor: 删除未使用的 pkmn.ts 辅助函数

- 删除 getMove、getAbility、getType、getPrimaryAbility(无生产代码引用)
- 同步删除对应的 pkmn.test.ts 测试

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
claude-code-best
2026-04-22 06:04:12 +08:00
parent 080bd93efc
commit 0777e1a1f9
2 changed files with 1 additions and 31 deletions

View File

@@ -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('')
})
})

View File

@@ -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<StatName, number> {
const result = {} as Record<StatName, number>
@@ -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, string>): string {
return abilities['0']?.toLowerCase() ?? ''
}