Skip to content

自动粉爪 路线B优化,提升更新后的线路稳定性#136

Merged
BnanZ0 merged 1 commit into
BnanZ0:mainfrom
HazukiKaguya:main
May 30, 2026
Merged

自动粉爪 路线B优化,提升更新后的线路稳定性#136
BnanZ0 merged 1 commit into
BnanZ0:mainfrom
HazukiKaguya:main

Conversation

@HazukiKaguya
Copy link
Copy Markdown
Contributor

@HazukiKaguya HazukiKaguya commented May 30, 2026

1、游戏更新后,大厅到LG1电梯撬开锁也要再点下开门了,这里修复了这个变动导致的大厅到LG1线路稳定性问题;
2、同步优化了线路A在藏品层的稳定性变动。

Summary by CodeRabbit

  • 新增功能

    • 新增避战路线自动化,扩展流程覆盖到额外节点,提升可达性与自动化范围。
  • 优化改进

    • 调整多处路径的按键节奏、移动与交互时序及判定逻辑,提升流程稳定性与成功率。
    • 细化等待与按压时长及日志表述,改善运行可观察性。
  • 功能移除

    • 移除原有的战斗清理实现。

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 30, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b11bf2c6-cb08-4e20-bcf3-c56bf7445052

📥 Commits

Reviewing files that changed from the base of the PR and between 1e85fff and 4d4339f.

📒 Files selected for processing (1)
  • src/heist_path/HeistPathB.py

📝 Walkthrough

Walkthrough

PR 在 HeistPathB 中:把 LG1 流程延伸到 WP5,重构 goto_lg1_skip 的开门/交互控制并调整多处按键按住/释放与等待时序;新增 lg1_wp5_buster;对 lg2_wp2_to_exit2_safer 进行了大幅替换;删除 clear_current_combat_spec。

更改内容

LG1 LG2 自动化流程与时序优化

Layer / File(s) Summary
LG1 路线入口与 WP5 集成
src/heist_path/HeistPathB.py
run_path() 新增调用 lg1_wp5_buster(),扩展 LG1 执行流至 WP5。
LG1 导航与开门/交互控制流程
src/heist_path/HeistPathB.py
goto_lg1_skip() 中左移按键按住时长与多处 sleep 参数被调整;开门判定分支、OCR 命中后的短分支处理、find_interac 分支替换为 clear_current_combat()、以及基于 OCR 的开门重试循环(isOpenDoor/isOpenLoop)被引入,移除原先基于楼层字符串的提前返回逻辑。
LG1 检查点时序细化与新增 WP5
src/heist_path/HeistPathB.py
lg1_wp1_safer() 的按键按住/释放与前后 sleep 时序被微调;lg1_wp4_buster() 的日志文案大小写与多段 space 跳跃节奏被替换为更短节奏;新增 lg1_wp5_buster() 实现避战路线(切换到规避角色、规避动作、按住/释放 wwait_and_interact 组合)。
LG2 搜刮与出口自动化
src/heist_path/HeistPathB.py
lg2_wp2_to_exit2_safer() 被大幅替换:pick 段、移动键(w/a/d/s)、spacelshift 的按压时长与节奏系统性变化,并多次调整 switch_to_runner() 的插入点;末尾仍通过 try_open_exit(direction="w") 更新 exit_state[2]
战斗清理方法移除
src/heist_path/HeistPathB.py
删除 clear_current_combat_spec() 方法及其实现。

估计代码审查工作量

🎯 4 (Complex) | ⏱️ ~45 分钟

可能相关的 PR

  • BnanZ0/ok-nte#103: 与本 PR 在 HeistPathB.pyrun_path()/goto_lg1_skip() 的按键时序与开门/交互判定上存在直接变更关系。
  • BnanZ0/ok-nte#122: #122 曾引入 clear_current_combat_spec(),而本 PR删除该方法并调整相关战斗/时序逻辑,二者在战斗清理与切换点上互相关联。
  • BnanZ0/ok-nte#114: 同一文件中对 run_path()goto_lg1_skip()lg2_wp2_to_exit2_safer() 的 safer/避战相关改动具有代码级相似性与演进关系。

"🐰 我是一只小兔子,跳过战斗去远行,
WP5 的路上风轻轻,按键节奏我记清;
LG2 搜刮脚步换新声,旧的清理说再见,
自动化延伸又一程,键盘敲出新旅程。"

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.50% 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.
Title check ✅ Passed PR 标题准确总结了主要改动:针对游戏更新后路线 B 的优化和稳定性提升,与代码变更中新增 lg1_wp5_buster()、优化 goto_lg1_skip() 开门逻辑等实质性改动相符。
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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/heist_path/HeistPathB.py`:
- Around line 160-167: The loop waiting for “开门” has no exit and can hang
forever; update the logic in HeistPathB (the isOpenDoor loop that calls wait_ocr
and send_key) to use a bounded retry count or overall timeout (e.g. max_retries
or deadline based), increment a counter or check elapsed time each iteration,
and when exhausted either raise a clear exception (e.g. TimeoutError) or call
the route-abort/cleanup routine (e.g. self.abort_route() or
self.stop_current_route()) so the route terminates instead of looping
indefinitely. Ensure wait_ocr, send_key, and sleep usage remain the same inside
the retry loop and reset isOpenDoor only while retrying.
🪄 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

Run ID: d3a4a012-8a76-4c81-a998-5049d8658995

📥 Commits

Reviewing files that changed from the base of the PR and between ea4801c and 603ac7b.

📒 Files selected for processing (1)
  • src/heist_path/HeistPathB.py

Comment thread src/heist_path/HeistPathB.py
1、游戏更新后,大厅到LG1电梯撬开锁也要再点下开门了,这里修复了这个变动导致的大厅到LG1线路稳定性问题;
2、同步优化了线路A在藏品层的稳定性变动。
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/heist_path/HeistPathB.py (1)

390-436: 💤 Low value

多次冗余的 switch_to_runner() 调用可能影响效率。

在约 50 行代码内调用了 8 次 switch_to_runner(),且中间没有可能导致角色切换的操作。每次调用都会发送按键,可能造成不必要的延迟。

如果是为了确保角色状态的稳健性,建议至少在关键位置保留 check_switched=True 参数;否则可以精简到 2-3 次关键调用。

🤖 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 `@src/heist_path/HeistPathB.py` around lines 390 - 436, This sequence contains
many redundant switch_to_runner() calls (around eight) between repeated
send_key_down/send_key_up and sleep calls which creates unnecessary overhead;
consolidate them by removing intermediate switch_to_runner() calls and keep 2–3
critical switches around logical action boundaries (e.g., before the initial
pick start, mid-way between major movement groups, and after the pick end), or
when robustness is required call switch_to_runner(check_switched=True) at those
critical points; update the block that uses switch_to_runner(),
send_key_down/send_key_up, and sleep so that consecutive input sequences that
don't require role-switching run under a single switch_to_runner() call.
🤖 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/heist_path/HeistPathB.py`:
- Around line 160-172: The loop condition is wrong: replace the `or` check with
`and` and use snake_case booleans to stop immediately when OCR finds "开门" —
e.g., rename isOpenDoor→is_open_door and isOpenLoop→open_attempts, initialize
is_open_door = False and open_attempts = 0, then loop while (not is_open_door
and open_attempts < 3); inside, call self.wait_ocr(...), set is_open_door = True
when it matches (use "if self.wait_ocr(...): is_open_door = True else:
self.send_key('f', down_time=0.10); self.sleep(0.32); open_attempts += 1) and
keep subsequent calls to self.send_key_down("w") and self.wait_and_interact(...)
unchanged.

---

Nitpick comments:
In `@src/heist_path/HeistPathB.py`:
- Around line 390-436: This sequence contains many redundant switch_to_runner()
calls (around eight) between repeated send_key_down/send_key_up and sleep calls
which creates unnecessary overhead; consolidate them by removing intermediate
switch_to_runner() calls and keep 2–3 critical switches around logical action
boundaries (e.g., before the initial pick start, mid-way between major movement
groups, and after the pick end), or when robustness is required call
switch_to_runner(check_switched=True) at those critical points; update the block
that uses switch_to_runner(), send_key_down/send_key_up, and sleep so that
consecutive input sequences that don't require role-switching run under a single
switch_to_runner() call.
🪄 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

Run ID: 2a98f837-9e6b-46e0-b82c-7158772217f6

📥 Commits

Reviewing files that changed from the base of the PR and between 603ac7b and 1e85fff.

📒 Files selected for processing (1)
  • src/heist_path/HeistPathB.py

Comment thread src/heist_path/HeistPathB.py
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
48.7% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@BnanZ0 BnanZ0 merged commit 50c10c6 into BnanZ0:main May 30, 2026
2 of 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.

3 participants