Skip to content

修复斗地主先手事件识别及座位状态覆盖问题#23

Merged
llsccm merged 2 commits into
devfrom
fix/doudizhu-firstID
Jul 12, 2026
Merged

修复斗地主先手事件识别及座位状态覆盖问题#23
llsccm merged 2 commits into
devfrom
fix/doudizhu-firstID

Conversation

@llsccm

@llsccm llsccm commented Jul 12, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • 功能改进
    • 优化对首手信息的识别与记录,提升牌局状态展示的准确性。
    • 支持处理新的牌堆明牌消息类型,避免相关消息影响牌局流程。
  • 稳定性改进
    • 首手信息一旦确认后,冲突数据将被忽略,避免状态被错误覆盖。
    • 优化首手状态同步与界面刷新,减少不必要的更新。

@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@llsccm, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 53 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b6a89d3c-46a3-4307-8903-afdbe3b9270b

📥 Commits

Reviewing files that changed from the base of the PR and between 67a0351 and 334ad8a.

📒 Files selected for processing (1)
  • src/logic.js
📝 Walkthrough

Walkthrough

本次变更扩展牌堆消息处理和先手事件识别,并通过状态保护避免先手座位被冲突消息覆盖,同时新增重复设置场景测试。

Changes

先手追踪与消息处理

Layer / File(s) Summary
消息保留与先手事件路由
src/featureFlags.js, src/logic.js
保留 decodeGameDealPileTopCardList 消息;展示身份和技能操作消息在匹配条件下调用 tracker.setTrackerFirstHand,并为牌堆消息增加显式分支。
先手状态保护与日志
src/tracker/runtime/trackerController.ts, src/tracker/Room.ts, tests/tracker/trackerController.test.ts
已有先手座位与新座位冲突时记录告警并跳过同步、读取座位 UI 和渲染;房间日志记录传入的 firstID,测试覆盖重复与冲突设置。

Estimated code review effort: 3 (Moderate) | ~20 minutes

🚥 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%. 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.
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.
Title Check ✅ Passed Title check skipped as CodeRabbit has written the PR title.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/doudizhu-firstID

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.

@coderabbitai coderabbitai Bot changed the title @pr 修复斗地主先手事件识别及座位状态覆盖问题 Jul 12, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces updates to the game logic and tracker. It adds support for the decodeGameDealPileTopCardList message, updates first-hand seat tracking logic in MsgGameShowFigure and CGsRoleSpellOptRep (specifically for type 44), and implements a safeguard in TrackerController to ignore and warn about conflicting first-hand seat assignments. Unit tests have also been added to verify this behavior. The review feedback suggests adding defensive checks to ensure SeatID is defined before calling tracker.setTrackerFirstHand(SeatID) in both updated locations in src/logic.js to prevent passing undefined and correctly handle seat 0.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread src/logic.js
// console.info('我的身份: ' + msg.Figure, msg.SeatID)
if (Game.myID === undefined) Game.setMyID(msg.SeatID)
// console.info('座位: ' + SeatID + '的身份: ' + msg.Figure)
if (msg.Figure === 1) tracker.setTrackerFirstHand(SeatID)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Defensive check: Ensure SeatID is defined before calling tracker.setTrackerFirstHand(SeatID). Since 0 is a valid seat ID, we should explicitly check SeatID !== undefined to avoid ignoring seat 0 while preventing passing undefined to the tracker.

Suggested change
if (msg.Figure === 1) tracker.setTrackerFirstHand(SeatID)
if (msg.Figure === 1 && SeatID !== undefined) tracker.setTrackerFirstHand(SeatID)

Comment thread src/logic.js
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@llsccm
llsccm merged commit a2b433f into dev Jul 12, 2026
3 checks passed
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