mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-15 12:55:51 +00:00
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:
@@ -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('')
|
||||
})
|
||||
})
|
||||
|
||||
@@ -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() ?? ''
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user