Commit Graph

18 Commits

Author SHA1 Message Date
claude-code-best
98284a5908 refactor: 提取共享 getStatColor、移除 deprecated EVOLUTION_CHAINS
- 新增 ui/shared.ts 统一 getStatColor 函数
- CompanionCard/SpeciesDetail 改用共享函数,消除重复
- 移除 data/evolution.ts 中已废弃的 EVOLUTION_CHAINS 常量
- 清理 index.ts 导出

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-22 01:58:33 +08:00
claude-code-best
fae96c3e7f test: 补全 spriteCache/renderer/battle 测试用例
- 新增 spriteCache.test.ts: getSpeciesDisplay 格式化测试
- 扩展 renderer.test.ts: 覆盖所有 AnimMode + getIdleAnimMode + getPetOverlay
- 扩展 battle.test.ts: AI 边界情况 + settlement XP/EV 奖励 + 失败路径

188 tests / 0 fail (was 164)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-22 01:54:28 +08:00
claude-code-best
661cc764fe refactor: 清理 SwitchPanel 未使用变量和导入
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-22 00:51:51 +08:00
claude-code-best
391e0c233a chore: 移除 SwitchPanel 未使用的 calculateStats 导入
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-22 00:50:27 +08:00
claude-code-best
74682b2a82 refactor: 代码优化 — 扩展类型覆盖、修复变量遮蔽、移除未使用导入
- engine.ts: 扩展 getSpeciesMoves 覆盖全部 18 种属性
- settlement.ts: 重命名 species → oppSpecies 避免遮蔽外层变量
- storage.ts: addItemToBag/removeItemFromBag 深拷贝 bag items 避免修改原对象
- BattleFlow.tsx: 移除未使用导入和条件 useInput 调用(React hooks 规则)
- BattleView.tsx: 移除未使用的 BattlePokemon/MoveOption/Dex 导入

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-22 00:49:48 +08:00
claude-code-best
100b1589f2 fix: 修复 BattleFlow 进化阶段输入处理 + 清理无用文件
- BattleFlow.tsx: useInput hook 提升到顶层避免 React hooks 规则违规
- 删除未使用的 battle/adapter.ts 和 battle/handler.ts

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-22 00:47:05 +08:00
claude-code-best
fa8e45e933 test: 新增数据层测试 + 引擎修复
- 新增 pkmn.test.ts: stat 映射测试
- 新增 species.test.ts: 物种数据测试
- 新增 xpTable.test.ts: XP 公式测试
- 新增 evMapping.test.ts: EV 映射测试
- 新增 names.test.ts: 多语言名称测试
- 新增 fallback.test.ts: 精灵 fallback 测试
- 修复 engine.ts 类型

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-22 00:45:57 +08:00
claude-code-best
96e6d33414 test: 新增 storage.test.ts
- 验证 BuddyData v2 结构正确性
- 验证 creature 包含 v2 字段

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-22 00:44:12 +08:00
claude-code-best
1dd36f3f6f test: 添加 battle/nature/learnsets/storage 测试,修复 nature 映射
- battle.test.ts: 10 个测试覆盖 createBattle/executeTurn/settleBattle/applyMoveLearn/applyEvolution/AI
- nature.test.ts: 测试 getAllNatureNames/randomNature/getNatureEffect
- learnsets.test.ts: 测试 getDefaultMoveset/getDefaultAbility/getNewLearnableMoves
- storage.test.ts: 测试 depositToBox/withdrawFromBox/findCreatureLocation/releaseCreature
- 修复 getNatureEffect 返回 Dex 格式(atk/spa/spe)未映射为我们的格式(attack/spAtk/speed)
- 删除遗留的 battle/adapter.ts 和 battle/handler.ts

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-22 00:43:19 +08:00
claude-code-best
e3570f8cdb feat: 添加 BattleFlow 战斗状态机组件 (Phase 3)
实现完整的战斗 UI 流程:配置 → 战斗 → 换人/道具 → 结果 → 学招 → 进化 → 完成

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-22 00:38:17 +08:00
claude-code-best
f5a97011e8 feat: Phase 3 — 战斗 UI 终端交互组件
- BattleConfigPanel: 战斗前配置(队伍展示 + 对手选择)
- BattleView: 战斗主界面(双方 HP + 招式选择 + 事件日志)
- SwitchPanel: 换人选择面板
- ItemPanel: 道具使用面板
- BattleResultPanel: 战斗结算展示
- MoveLearnPanel: 新招式学习面板
- HP 条颜色分级(绿/黄/红)
- 事件日志中文格式化

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-22 00:37:26 +08:00
claude-code-best
a3fc348421 feat: Phase 2 — 战斗引擎 @pkmn 薄适配层
- 安装 @pkmn/protocol @pkmn/client @pkmn/view
- 新建 battle/types.ts: BattleState, BattlePokemon, BattleEvent, PlayerAction 等
- 新建 battle/adapter.ts: Creature→PokemonSet 转换, 野生对手生成
- 新建 battle/engine.ts: createBattle() + executeTurn() 薄封装 @pkmn/sim
- 新建 battle/handler.ts: @pkmn/protocol Handler→BattleEvent 转换
- 新建 battle/ai.ts: 随机合法招式 AI 决策
- 新建 battle/settlement.ts: 战后结算 XP/EV/升级/进化/招式学习
- 新建 battle/index.ts: 统一导出

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-22 00:31:42 +08:00
claude-code-best
12cbb7c4c7 feat: Phase 1 — 数据模型升级 Creature v2 + PCBox/Bag
- 新增 MoveSlot, PCBox, Bag, ItemId 类型
- Creature 扩展 nature/moves/ability/heldItem/pokeball 字段
- BuddyData 升级 v2: 新增 boxes, bag, battlesWon/battlesLost
- 新建 data/learnsets.ts: getDefaultMoveset/getDefaultAbility/getNewLearnableMoves
- storage.ts v1→v2 迁移: 回填 nature/moves/ability,新增 PCBox/Bag
- 新增 PCBox 操作: deposit/withdraw/move/rename/findLocation/release
- 新增 Bag 操作: add/remove/getCount
- generateCreature/loadBuddyData/hatchEgg 改为 async (Dex.learnsets.get 异步)
- 修复 PokedexView: activeCreatureId → party[0]
- 更新测试文件: async/await + v2 BuddyData fixtures

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-22 00:20:08 +08:00
claude-code-best
96f3e1b309 refactor: Phase 0 — 清除重复,委托 @pkmn 生态
- 删除硬编码 NATURES 常量,nature.ts 委托 Dex.natures
- 删除硬编码 EVOLUTION_CHAINS,evolution.ts 委托 Dex.species.evos
- calculateStats() 手写公式替换为 gen.stats.calc()
- 统一 TO_DEX_STAT/FROM_DEX_STAT 映射到 pkmn.ts
- 简化 species.ts buildEvolutionChain() 复用 getNextEvolution()
- 添加 NatureName/NatureEffect 类型定义

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-22 00:05:05 +08:00
claude-code-best
970fcd627f feat: 又是更新了一大堆 2026-04-21 21:38:13 +08:00
claude-code-best
f74492617b feat: 一大堆优化 2026-04-21 20:31:10 +08:00
claude-code-best
722aa6c97a feat: 扩展精灵动画系统并新增 SpriteAnimator 组件
- 新增动画模式: breathe, bounce, walkLeft, walkRight, flip
- 新增 SpriteAnimator 组件,内置 tick 循环和居中渲染
- BuddyPanel 使用 SpriteAnimator 替代手动渲染

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-21 19:23:24 +08:00
claude-code-best
88ddba6c23 feat: 第一版可用 pokemon 2026-04-21 19:03:31 +08:00