Skip to content

feat(tracker): 使用卡牌技能 ID 识别牌种 - #111

Merged
llsccm merged 1 commit into
devfrom
codex/card-spell-id
Sep 8, 2026
Merged

llsccm merged 1 commit into
devfrom
codex/card-spell-id

Conversation

@llsccm

@llsccm llsccm commented Sep 7, 2026

Copy link
Copy Markdown
Owner

变更内容

卡牌识别原先依赖中文牌名与简称。为 BaseCard 增加从 CardConfig 加载的 spellId,焚巢筛牌和红黑杀统计改按卡牌技能 ID 判断,使显示名变化后仍能正确识别。

  • 焚巢使用杀(含属性杀)1、决斗 8、南蛮入侵 9、万箭齐发 10、火攻 83
  • setCardInfo 同步刷新卡牌技能 ID;匿名牌或配置缺失时使用 0
  • 补充全称、简称、属性杀、显示名与 ID 不一致的回归,并更新模型与协议文档。

验证

  • pnpm lint
  • pnpm typecheck:tracker
  • pnpm test:tracker:62 个测试文件、583 项测试通过
  • pnpm build
  • pnpm build:prod
  • git diff --check

风险与备注

  • spellId 表示卡牌自身技能 ID,独立于移动协议、标记区使用的 Card.spellID;回归覆盖焚巢移动后两者分别保留自身值。
  • 尚未进行真实浏览器注入验收。

Summary by CodeRabbit

  • Bug 修复

    • 优化卡牌技能识别,改用稳定的技能编号判断卡牌类型,减少因显示名称变化、别名或同名变体导致的识别错误。
    • 修复焚巢筛选目标牌及杀类卡牌颜色分类可能不准确的问题,覆盖属性杀、决斗、南蛮入侵、万箭齐发和火攻等卡牌。
  • 文档

    • 补充卡牌技能编号的含义、默认值及其在筛牌和统计中的使用说明。
  • 测试

    • 增加对不同显示名称和卡牌变体的识别测试。

@coderabbitai

coderabbitai Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 8fa09353-51d5-4e68-8102-f811c84664fe

📥 Commits

Reviewing files that changed from the base of the PR and between 657a5ec and e8cb2d6.

📒 Files selected for processing (7)
  • docs/agents/card_player_model.md
  • docs/protocols/PubGsCMoveCard-3752.md
  • src/tracker/BaseCard.ts
  • src/tracker/CardCounter.ts
  • src/tracker/skill/FenChao.ts
  • tests/tracker/cardCounter.test.ts
  • tests/tracker/fenChao.test.ts

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

本次变更为 BaseCard 增加 spellId,并将焚巢目标筛选和杀牌颜色分类从牌名匹配改为技能 ID 匹配。测试覆盖显示名称变化、同技能牌名变体及字段语义差异。

Changes

基于技能 ID 的卡牌识别

Layer / File(s) Summary
BaseCard 技能 ID 数据
src/tracker/BaseCard.ts, docs/agents/card_player_model.md
BaseCardCardConfig 读取 spellId。缺失数据时使用 0。相关文档补充字段语义和用途。
焚巢目标筛选
src/tracker/skill/FenChao.ts, docs/protocols/PubGsCMoveCard-3752.md, tests/tracker/fenChao.test.ts
焚巢使用技能 ID 集合识别目标牌。测试覆盖显示名称变化、同技能牌名变体,以及 spellId 与移动协议 spellID 的区别。
杀牌颜色分类
src/tracker/CardCounter.ts, tests/tracker/cardCounter.test.ts
杀牌颜色分类改用 spellId === 1。测试验证不同显示名称下的颜色索引结果。

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to e8cb2

Card identification now uses stable skill IDs rather than display names, preserving FenChao selection and Slash color statistics when names vary. No concrete current-head merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 5 files. (2 skipped: 2 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题准确概括了本次变更的主要内容:在 tracker 中使用卡牌技能 ID 识别牌种。标题简洁、明确,并与代码、测试和文档改动一致。
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 5 files. (2 skipped: 2 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/card-spell-id

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@llsccm
llsccm merged commit 6bc96af into dev Sep 8, 2026
4 checks passed
@llsccm
llsccm deleted the codex/card-spell-id branch September 8, 2026 00:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant