Conversation
* feat(tracker): 支持整手牌经交换区互易 补齐 MoveType=11 的 5↔10 整手交换协议模式:按 SpellID+FromID 登记批次, 允许己方正 CardIDs,并覆盖对侧全暗互换回归。 * fix(tracker): 收紧整手交换账本与手牌扫描 统一协议文档对正 CardIDs 的接管说明,进区复用一次手牌收集并改走 player 快照,回手只读查询避免空账本残留。 * fix(tracker): 完善整手交换候选与占位同步 * fix :已观测手牌数优先于不完整实体快照
* feat: 适配权变鹰视 * chore: 清理权变空间代码
* fix(tracker): 修复观虚牌堆顶展示与张数守恒 * fix: 补强断言 * 把占位回补位置断言到明牌段正下方 * 不让占位实体缺失时断言通过 Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * chore: 将数组抽出成模块级常量 --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
* feat(tracker): 完善诫厉观看阶段目标通知适配 同步 3483 Params 中的牌堆顶与目标手牌片段,handCount 恰好整手时 fullHand;补充交换序列协议文档并暂不挂上 decorateJieLi。 * fix: apply CodeRabbit auto-fixes Fixed 1 file(s) based on 1 unresolved review comment. Co-authored-by: CodeRabbit <noreply@coderabbit.ai> * docs: 增加协议索引并缩短整手交换文档名 新增 docs/protocols/README.md 作为 className/SpellID 定位入口,并将 PubGsCMoveCard-spell-121-hand-exchange.md 重命名为 hand-exchange.md,同步更新引用。 --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
* fix(tracker): 修复嚣翻牌底被误放到牌顶 协议 pos 与 Zone 端点约定一致,normalizeProtocolZoneTarget 不应再做顶底互换。 * chore: 简化代码
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthrough新增协议文档索引和多份技能协议说明,重构技能回复与牌堆明牌处理,统一公共区落点及占位回收,并实现整手牌交换的批次账本、候选置换和事件装饰逻辑,配套新增多组测试。 Changes协议追踪与状态同步
Estimated code review effort: 5 (Critical) | ~120 minutes Sequence Diagram(s)sequenceDiagram
participant ProtocolMessage
participant Handler
participant TrackerController
participant RoomMovement
ProtocolMessage->>Handler: parse skill or target notification
Handler->>TrackerController: reveal and position public cards
TrackerController->>RoomMovement: recover identities and placeholders
RoomMovement-->>TrackerController: corrected card locations
TrackerController-->>Handler: synchronized tracker state
sequenceDiagram
participant MoveEventHandlers
participant HandExchange
participant RoomSkillState
participant TrackerRoom
MoveEventHandlers->>HandExchange: receive exchange-zone move
HandExchange->>RoomSkillState: register or consume batch
HandExchange->>TrackerRoom: update card candidates and movement counts
TrackerRoom-->>MoveEventHandlers: decorated move event
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 7
🧹 Nitpick comments (1)
tests/tracker/pubGsCMoveCard.test.ts (1)
8-26: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win使用 Vite 路径别名。
根据项目编码规范,应统一使用
@作为指向src/的别名,避免使用跨层级的长相对路径。本文件在第 2 行已经成功使用了该别名。♻️ 建议的修复
-vi.mock('../../src/tracker/runtime/browser', () => ({ +vi.mock('`@/tracker/runtime/browser`', () => ({ tracker: { syncTrackerMove } })) -vi.mock('../../src/handler/gameFlowState', () => ({ +vi.mock('`@/handler/gameFlowState`', () => ({ handleGameFlowState: vi.fn() })) -vi.mock('../../src/handler/specialZones', () => ({ +vi.mock('`@/handler/specialZones`', () => ({ handleSpecialZones: vi.fn(() => ({ handled: false })) })) -vi.mock('../../src/handler/spellEffects', () => ({ +vi.mock('`@/handler/spellEffects`', () => ({ applySpellEffect: vi.fn() })) -import { handleMoveCard } from '../../src/handler/PubGsCMoveCard' +import { handleMoveCard } from '`@/handler/PubGsCMoveCard`'🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/tracker/pubGsCMoveCard.test.ts` around lines 8 - 26, Update all imports and mocks in the test around handleMoveCard to use the project’s @ alias for src paths instead of ../../src relative paths, matching the existing alias usage on the referenced line while preserving the mocked modules and behavior.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/handler/CGsRoleSpellOptRep.js`:
- Around line 1-3: Update the imports in CGsRoleSpellOptRep.js to use the Vite @
alias for src-based modules instead of relative paths, while preserving the
existing Game, POSITION_BOTTOM, and tracker imports.
In `@src/index.js`:
- Around line 30-38: Update the debug logging condition in the visible logging
block so non-object messages, including strings and formatted logs, are passed
to console.info when window._debug is enabled. Only suppress messages that are
objects with className equal to decodeSSCChatmsgNtf; preserve the existing
console.info(...args) behavior for all other values.
In `@src/tracker/roomMovement/sources.ts`:
- Around line 574-581: 在 swapKnownCardWithPublicSourcePlaceholder 相关的
replacement 置换流程中移除对 replacement.isKnown 的强制设为
false,保留来源端点已有的已知状态;其余候选清理、挂起状态、移动区域和替换逻辑保持不变。
In `@src/tracker/runtime/trackerController.ts`:
- Around line 537-540: 更新 recoverPlayerOccupiedIdentityForPublicReveal
及其调用方,传入当前揭示端点 position;POSITION_TOP 从尾部反向选择并保护顶部明牌段,POSITION_BOTTOM
从头部选择并保护底部明牌段,避免牌底揭示影响牌顶顺序。补充牌底揭示命中玩家身份时的占用身份测试。
In `@src/tracker/skill/HandExchange.ts`:
- Around line 495-509: The interrupted-batch path in buildExchangePatch must
move only entities still present in the exchange. Use stagedCards.length as the
entity cardCount after filtering departed members, while preserving the protocol
hand-size change separately in handMoveCount; do not let protocolCardCount
inflate the source-card movement. Add a regression test covering batch members
leaving the exchange early and verifying other batches are not moved.
- Around line 66-87: 调整 HandExchangeRoomState、HandExchangeCandidateRecord
及相关批次处理,避免 candidateRecords 保存可写的 alternatives 候选副本;始终以 Card.locationCandidates
作为唯一候选模型,并让批次令牌进入该模型或仅记录不包含候选集合的批次元数据。同步修改 projectCandidateRecord 及其调用方,回手时基于当前
Card.locationCandidates 恢复,不能用旧快照覆盖期间已消除的候选。
In `@tests/tracker/roleSpellOptRep.test.ts`:
- Around line 16-17: Update the imports in roleSpellOptRep.test.ts to use the
configured @ alias for both handleRoleSpellOptRep and Game from src, matching
the existing `@/tracker/candidate/cardPositions` import and removing the relative
../../src paths.
---
Nitpick comments:
In `@tests/tracker/pubGsCMoveCard.test.ts`:
- Around line 8-26: Update all imports and mocks in the test around
handleMoveCard to use the project’s @ alias for src paths instead of ../../src
relative paths, matching the existing alias usage on the referenced line while
preserving the mocked modules and behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 283dc4a8-b9a0-449e-9aa5-4c42e451c205
📒 Files selected for processing (31)
AGENTS.mddocs/agents/card_tracker.mddocs/protocols/CGsRoleSpellOptRep.mddocs/protocols/GsCRoleOptTargetNtf-3483.mddocs/protocols/GsCRoleOptTargetNtf-7011.mddocs/protocols/GsCRoleOptTargetNtf-987.mddocs/protocols/README.mddocs/protocols/hand-exchange.mdhtml/iframe.htmlsrc/handler/CGsRoleSpellOptRep.jssrc/handler/GsCRoleOptTargetNtf.jssrc/handler/PubGsCMoveCard.jssrc/handler/index.jssrc/index.jssrc/logic.jssrc/tracker/gameState.tssrc/tracker/roomMovement.tssrc/tracker/roomMovement/sources.tssrc/tracker/roomMovement/types.tssrc/tracker/runtime/moveEventHandlers.tssrc/tracker/runtime/trackerController.tssrc/tracker/skill/HandExchange.tssrc/tracker/skill/JieLi.tssrc/tracker/types.tssrc/tracker/view/cardButton.tstests/tracker/handExchange.test.tstests/tracker/pileDisplayOrder.test.tstests/tracker/pubGsCMoveCard.test.tstests/tracker/roleOptTargetNtf.test.tstests/tracker/roleSpellOptRep.test.tstests/tracker/trackerController.test.ts
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
- candidateRecords 从房间级下沉进 HandExchangeSpellState,与批次一样按 SpellID 隔离,消除两个交换技能并发时的候选串扰隐患 - 回手先恢复候选再清账(clearSpellExchangeStateIfEmpty),避免过早删账 连带丢弃尚未回手的候选令牌 - 整批揭示删空候选全部位置时在 DEV 下告警,暴露协议矛盾/上游观测错误 - 移除只写字段 batch.cardCount,补充模块不变式注释与 Card.ts 读面契约交叉引用 - 新增非 121 技能的候选隔离回归测试;runTwoSeatExchange 支持自定义 spellID Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Summary by CodeRabbit