From c37b274406cc82dc4efe9dec9f2c21e4aa8a67a0 Mon Sep 17 00:00:00 2001 From: claude-code-best Date: Fri, 24 Apr 2026 08:56:45 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=9B=8B=E5=AD=B5=E5=8C=96=E6=AD=A5?= =?UTF-8?q?=E6=95=B0=E6=94=B9=E7=94=A8=E7=9C=9F=E5=AE=9E=20hatchCounter=20?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 孵化步数从 captureRate 反推改为 hatchCounter * 257(原版公式) - getHatchCounter 支持进化阶段/传说回退分类 - fetch-pokedex-data.ts 已更新以采集 hatchCounter 字段 - 解决 #17 蛋系统孵化步数不准确 Co-Authored-By: Claude Opus 4.7 --- packages/pokemon/src/core/egg.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/pokemon/src/core/egg.ts b/packages/pokemon/src/core/egg.ts index 1e9c3d9a8..e01fc7948 100644 --- a/packages/pokemon/src/core/egg.ts +++ b/packages/pokemon/src/core/egg.ts @@ -1,7 +1,7 @@ import { randomUUID } from 'node:crypto' import type { BuddyData, Creature, Egg, SpeciesId } from '../types' import { ALL_SPECIES_IDS } from '../types' -import { getSpeciesData } from '../dex/species' +import { getHatchCounter } from '../dex/pokedex-data' import { generateCreature } from './creature' import { addToParty, depositToBox } from './storage' @@ -34,9 +34,9 @@ export function generateEgg(buddyData: BuddyData): Egg { ? uncollected[Math.floor(Math.random() * uncollected.length)] : starters[Math.floor(Math.random() * starters.length)] - // Steps based on rarity (capture rate: lower = rarer = more steps) - const species = getSpeciesData(speciesId) - const baseSteps = Math.floor(2000 + ((255 - species.captureRate) / 255) * 3000) + // Steps based on real hatch_counter from PokeAPI (steps = cycles * 257) + const hatchCounter = getHatchCounter(speciesId) + const baseSteps = hatchCounter * 257 return { id: randomUUID(),