Skip to content

【自动粉爪 线路B】大厅到办公层线路:优化稳定性、适配浔#141

Merged
BnanZ0 merged 3 commits into
BnanZ0:mainfrom
HazukiKaguya:main
May 31, 2026
Merged

【自动粉爪 线路B】大厅到办公层线路:优化稳定性、适配浔#141
BnanZ0 merged 3 commits into
BnanZ0:mainfrom
HazukiKaguya:main

Conversation

@HazukiKaguya
Copy link
Copy Markdown
Contributor

@HazukiKaguya HazukiKaguya commented May 30, 2026

1、大厅到办公层早雾避战线路:优化在进入战斗后的分支的稳定性;
2、全新大厅到办公层浔时停避战线路,理论正常11分12到办公层(实际耗时65s)。

Summary by CodeRabbit

  • 新功能
    • 新增独立的“浔(Hotori)”避战路线变体,提供线性按键/等待/点击序列以应对特殊场景。
  • 改进
    • 进入 LG1 流程按避战策略分流,不同策略下关键路点与控怪/避战组合更灵活。
    • 优化大厅开门识别与重试:先检测再交互,增加确认与失败终止机制以提升稳定性。
  • 文档
    • 更新任务说明为简体中文,补充画质/FPS/分辨率建议及更细化的战斗/避战角色要求。

Review Change Stack

优化大厅战斗的稳定性
全新大厅到LG1办公层线路,浔时停避战,理论正常11分12到办公层(实际耗时65s)
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 30, 2026

📝 Walkthrough

Walkthrough

HeistPathB 在 run_path() 中根据 avoider_strategy_index() 路由到三条 LG1 入口(原路、Sakiri、Hotori);重命名并重构 Sakiri 的大厅开门/交互判定,新增 Hotori 线路与 lobby_open_door_check();同时更新任务说明文本细节。

变更

LG1 避战路线策略分支

Layer / File(s) Summary
run_path() 中的策略选择与路由
src/heist_path/HeistPathB.py
run_path() 通过 avoider_strategy_index() 获取索引,分别路由到 goto_lg1()goto_lg1_skip_Sakiri()goto_lg1_skip_Hotori(),并根据索引选择不同的 LG1 WP4/WP5 行为组合。
Sakiri 变体:门口交互重写
src/heist_path/HeistPathB.py
goto_lg1_skip 重命名为 goto_lg1_skip_Sakiri(),在 lobby 门口先做单次 OCR 判定再发送 f;若未命中则清战斗并额外交互后调用 lobby_open_door_check();在检查失败时抛出 AbortException
Hotori 变体:新增停避战序列
src/heist_path/HeistPathB.py
新增 goto_lg1_skip_Hotori(),以线性按键/等待/点击和多次 space 的停避序列推进至办公层交互阶段。
开门检测辅助方法
src/heist_path/HeistPathB.py
新增 lobby_open_door_check(self, check_time=3),在最多 check_time 轮内循环 OCR 检测“开门”,每轮未命中发送 f 并重试,返回检测结果。
任务说明文本更新
src/tasks/AutoHeistTask.py
INST 文本由繁体改为简体并补充画质/分辨率/FPS 建议,细化“早雾避战”“浔避战”的战斗/避战角色与设置要求。

Sequence Diagram(s)

sequenceDiagram
  participant run_path
  participant goto_lg1_skip_Sakiri
  participant goto_lg1_skip_Hotori
  participant OCR
  participant lobby_open_door_check
  participant input_send_f

  run_path->>goto_lg1_skip_Sakiri: idx == 0 路由
  run_path->>goto_lg1_skip_Hotori: idx == 1 路由
  goto_lg1_skip_Sakiri->>OCR: 单次 OCR 检测“开门”
  OCR-->>goto_lg1_skip_Sakiri: 返回命中/未命中
  goto_lg1_skip_Sakiri->>lobby_open_door_check: 未命中时调用重试检测(check_time)
  lobby_open_door_check->>OCR: 循环 OCR 检测
  lobby_open_door_check-->>input_send_f: 未命中时发送 `f`
  input_send_f-->>lobby_open_door_check: 重试或返回检测结果
Loading

代码审查工作量估计

🎯 4 (Complex) | ⏱️ ~45 minutes

可能相关的 PRs

  • BnanZ0/ok-nte#114: 也改动了 src/heist_path/HeistPathB.py 中 goto_lg1_skip 路线和大厅交互时序,存在实现细节交叉。
  • BnanZ0/ok-nte#122: 与本次在同一文件对进入 LG1(大厅→办公层)阶段的流程和交互进行了增强/重构,相关联。
  • BnanZ0/ok-nte#108: 在 run_path() 与 LG1 路径上有过修改,可能与本次策略路由和 WP4/WP5 选择存在直接代码级关联。

🐰 三路分岔夜更轻,
OCR 望门细又明,
Sakiri 先试再重判,
Hotori 空格步不停,
兔儿悄唱新分支歌。

🚥 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.
Title check ✅ Passed 标题清晰准确地概括了主要变更:针对线路B的大厅到办公层路线,优化稳定性并适配浔避战策略。
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: 2

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

235-253: ⚡ Quick win

把这段重复输入收敛成循环。

这里连续硬编码了 10 次完全相同的 space 节奏,后续调时很容易漏改。抽成循环可读性和可维护性都会更稳。

♻️ 建议改法
-        self.send_key('space', down_time=0.24)
-        self.sleep(0.64)
-        self.send_key('space', down_time=0.24)
-        self.sleep(0.64)
-        self.send_key('space', down_time=0.24)
-        self.sleep(0.64)
-        self.send_key('space', down_time=0.24)
-        self.sleep(0.64)
-        self.send_key('space', down_time=0.24)
-        self.sleep(0.64)
-        self.send_key('space', down_time=0.24)
-        self.sleep(0.64)
-        self.send_key('space', down_time=0.24)
-        self.sleep(0.64)
-        self.send_key('space', down_time=0.24)
-        self.sleep(0.64)
-        self.send_key('space', down_time=0.24)
-        self.sleep(0.64)
-        self.send_key('space', down_time=0.24)
-        self.sleep(0.64)
+        for _ in range(10):
+            self.send_key("space", down_time=0.24)
+            self.sleep(0.64)
🤖 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 235 - 253, 这段在 HeistPathB.py 中重复调用
self.send_key('space', down_time=0.24) 与 self.sleep(0.64) 的逻辑应收敛为循环:用一个 for 循环运行
10 次调用 self.send_key('space', down_time=0.24) 并在每次(除了最后一次以保留当前行为)之后调用
self.sleep(0.64),以替换原来的十次硬编码,保留 down_time=0.24 与 sleep=0.64 的值并确保没有多余的尾随 sleep。
🤖 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 186-188: The current silent return inside goto_lg1_skip_Sakiri()
(when lobby_open_door_check() is false) only exits that function while
run_path() continues, causing the path to proceed from an invalid state; change
goto_lg1_skip_Sakiri() to return an explicit boolean success value (True on
success, False on failure) instead of doing a bare return, update
lobby_open_door_check() usage to propagate failure, and modify the caller
run_path() to check the boolean and abort or perform a reset/recovery when False
rather than continuing execution.
- Around line 322-326: The method signature for lobby_open_door_check currently
requires check_time causing a TypeError when called without args; change its
definition to accept an optional parameter (e.g., def
lobby_open_door_check(self, check_time=None):) and keep the existing fallback
logic to set check_time = 3 when check_time is None (or falsy), ensuring
existing callers that call lobby_open_door_check() without arguments no longer
fail; update any unit tests or call sites if they depended on positional-only
behavior.

---

Nitpick comments:
In `@src/heist_path/HeistPathB.py`:
- Around line 235-253: 这段在 HeistPathB.py 中重复调用 self.send_key('space',
down_time=0.24) 与 self.sleep(0.64) 的逻辑应收敛为循环:用一个 for 循环运行 10 次调用
self.send_key('space', down_time=0.24) 并在每次(除了最后一次以保留当前行为)之后调用
self.sleep(0.64),以替换原来的十次硬编码,保留 down_time=0.24 与 sleep=0.64 的值并确保没有多余的尾随 sleep。
🪄 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: 0246bf31-23aa-4cf7-9ffb-f9c67c0392d6

📥 Commits

Reviewing files that changed from the base of the PR and between 9cf54fc and 0c35be5.

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

Comment thread src/heist_path/HeistPathB.py Outdated
Comment thread src/heist_path/HeistPathB.py Outdated
@HazukiKaguya HazukiKaguya force-pushed the main branch 2 times, most recently from 128191b to 76ba3dc Compare May 30, 2026 19:36
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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/tasks/AutoHeistTask.py (1)

56-73: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

处理 RUF001 以避免文案改动触发静态检查告警。

这些中文文案包含全角标点,Ruff 在 Line 56、Line 66-73 会报 RUF001。若该规则在 CI 中为阻断,建议统一改半角标点,或对该多语言文案行做定向忽略(例如 # noqa: RUF001)以保持检查稳定。

🤖 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/tasks/AutoHeistTask.py` around lines 56 - 73, The Chinese strings in the
_inst_line calls (e.g., the lines that call _inst_line and _inst_gap in
AutoHeistTask.py) use fullwidth punctuation and trigger Ruff RUF001; fix by
either replacing fullwidth punctuation with halfwidth equivalents in those
string literals (e.g., convert “:”、“,”、“(”、“)” to ":" , "," , "(" , ")") for the
lines under the two "路径" blocks, or if you must preserve the exact copy, append
a per-line directive to ignore the linter (add "# noqa: RUF001" at the end of
each offending _inst_line call) so CI won’t fail—apply this change to the calls
invoking _inst_line that contain the multilingual text.
🧹 Nitpick comments (1)
src/heist_path/HeistPathB.py (1)

9-18: ⚡ Quick win

把策略分发表收敛成一处。

现在入口路线和 LG1 的 WP4/WP5 各维护了一套 idx 分支;后续再加/改策略时,很容易只改其中一处,导致“前半段路线”和“后半段行为”错配。建议把日志、入口方法、WP4、WP5 绑定到同一个策略映射里统一调度。

♻️ 一个更稳的组织方式
+        strategies = {
+            -1: (
+                "没有配置避战角色,全程使用原始线路(路线A)",
+                self.goto_lg1,
+                self.lg1_wp4,
+                self.lg1_wp5_avoid_combat_01,
+            ),
+            0: (
+                "配置避战角色狗哥,使用早雾避战(路线B)",
+                self.goto_lg1_skip_Sakiri,
+                self.lg1_wp4_buster,
+                self.lg1_wp5_buster,
+            ),
+            1: (
+                "配置避战角色浔,使用浔避战(路线B)",
+                self.goto_lg1_skip_Hotori,
+                self.lg1_wp4,
+                self.lg1_wp5_avoid_combat_03,
+            ),
+        }
+        msg, goto_lg1, wp4, wp5 = strategies[idx]
+        self.log_round_info(msg)
+        goto_lg1()
...
+        wp4()
+        wp5()

Also applies to: 26-34

🤖 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 9 - 18, The code duplicates
idx-based branching for entry route and later LG1 WP4/WP5 behavior; consolidate
by creating a single strategy mapping keyed by avoider_strategy_index() that
contains the log message and the unified action identifiers for entry and for
WP4/WP5, then replace the inline if/elif branches in the entry (current use of
avoider_strategy_index(), log_round_info, goto_lg1, goto_lg1_skip_Sakiri,
goto_lg1_skip_Hotori) and the WP4/WP5 handlers to look up the strategy and
invoke the mapped actions; ensure a default mapping for idx == -1 and that the
mapping is the single source of truth so future changes only modify that map.
🤖 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.

Outside diff comments:
In `@src/tasks/AutoHeistTask.py`:
- Around line 56-73: The Chinese strings in the _inst_line calls (e.g., the
lines that call _inst_line and _inst_gap in AutoHeistTask.py) use fullwidth
punctuation and trigger Ruff RUF001; fix by either replacing fullwidth
punctuation with halfwidth equivalents in those string literals (e.g., convert
“:”、“,”、“(”、“)” to ":" , "," , "(" , ")") for the lines under the two "路径"
blocks, or if you must preserve the exact copy, append a per-line directive to
ignore the linter (add "# noqa: RUF001" at the end of each offending _inst_line
call) so CI won’t fail—apply this change to the calls invoking _inst_line that
contain the multilingual text.

---

Nitpick comments:
In `@src/heist_path/HeistPathB.py`:
- Around line 9-18: The code duplicates idx-based branching for entry route and
later LG1 WP4/WP5 behavior; consolidate by creating a single strategy mapping
keyed by avoider_strategy_index() that contains the log message and the unified
action identifiers for entry and for WP4/WP5, then replace the inline if/elif
branches in the entry (current use of avoider_strategy_index(), log_round_info,
goto_lg1, goto_lg1_skip_Sakiri, goto_lg1_skip_Hotori) and the WP4/WP5 handlers
to look up the strategy and invoke the mapped actions; ensure a default mapping
for idx == -1 and that the mapping is the single source of truth so future
changes only modify that map.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7ecb5f4a-b43b-4419-979e-cc4537bba35a

📥 Commits

Reviewing files that changed from the base of the PR and between 0c35be5 and 128191b.

📒 Files selected for processing (2)
  • src/heist_path/HeistPathB.py
  • src/tasks/AutoHeistTask.py

更新线路B描述
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)

9-18: ⚡ Quick win

建议把路线选择从裸 -1/0/1 分支改成显式映射。

avoider_strategy_index() 的上游契约是“无避战 / 长按 shift / 长按攻击”,这里却把 0/1 直接解释成 Sakiri/Hotori 专线,并在 WP4/WP5 再写一遍同样分支。现在虽然能工作,但路线正确性被绑死在 avoid_methods 的顺序和“一个策略只对应一个角色”的假设上,后面只要新增或重排策略,就很容易静默跑错线。建议至少抽成一份显式映射,或在进入专线路线前校验当前避战角色是否匹配。

Also applies to: 26-34

🤖 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 9 - 18, The branch logic in
HeistPathB uses magic indices from avoider_strategy_index() (-1/0/1) to pick
routes (goto_lg1, goto_lg1_skip_Sakiri, goto_lg1_skip_Hotori), which couples
route choice to the ordering of avoid_methods; replace the numeric branching
with an explicit mapping (e.g., a dict or enum) from avoider_strategy_index() →
route handler and descriptive name, and before calling a route handler validate
that the currently configured avoider role matches the expected role for that
route (use log_round_info to surface mismatches); apply the same
mapping/validation refactor where the same -1/0/1 branches appear later
(WP4/WP5) so route selection is robust to reordering or new strategies.
🤖 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 168-171: 当前流程里对方向键 "d" 调用 send_key_down("d") 后没有配对的
send_key_up("d"),导致在等待/交互或提前返回分支(wait_and_interact(...)/早退分支)时把 "d" 保持按下,影响后续
w/a/f 的移动。修复方法:在调用 send_key_down("d") 的每个分支后(包括正常路径在 wait_and_interact(...)
之后以及任何早退/错误分支)都插入对应的 send_key_up("d");检查并对另一个按下 "d" 的位置(代码中第二处
send_key_down("d"))做同样处理,确保无论哪条执行路径最终都会执行 send_key_up("d")。

---

Nitpick comments:
In `@src/heist_path/HeistPathB.py`:
- Around line 9-18: The branch logic in HeistPathB uses magic indices from
avoider_strategy_index() (-1/0/1) to pick routes (goto_lg1,
goto_lg1_skip_Sakiri, goto_lg1_skip_Hotori), which couples route choice to the
ordering of avoid_methods; replace the numeric branching with an explicit
mapping (e.g., a dict or enum) from avoider_strategy_index() → route handler and
descriptive name, and before calling a route handler validate that the currently
configured avoider role matches the expected role for that route (use
log_round_info to surface mismatches); apply the same mapping/validation
refactor where the same -1/0/1 branches appear later (WP4/WP5) so route
selection is robust to reordering or new strategies.
🪄 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: 382eccb7-b1ea-4ea9-bdac-8ee81b27410b

📥 Commits

Reviewing files that changed from the base of the PR and between 128191b and 76ba3dc.

📒 Files selected for processing (2)
  • src/heist_path/HeistPathB.py
  • src/tasks/AutoHeistTask.py

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

Quality Gate Failed Quality Gate failed

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

See analysis details on SonarQube Cloud

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

♻️ Duplicate comments (1)
src/heist_path/HeistPathB.py (1)

168-171: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

方向键 d 未释放,会导致后续移动偏移。

此问题在之前的 review 中已提出且仍未解决:

  • Line 168 send_key_down("d") 后没有对应的 send_key_up("d"),在 Line 171 释放 wd 仍处于按下状态
  • Line 182 send_key_down('d') 后,若 Line 188 抛出异常,d 键将保持按下
💡 建议修复
         self.send_key_down("d")
         self.wait_and_interact(direction="d", is_lock=True, time_out=7.64)
         self.sleep(0.10)
+        self.send_key_up("d")
         self.send_key_up("w")
         if self.wait_ocr(x=0.60, y=0.52, to_x=0.70, to_y=0.57, match=re.compile("开门"), time_out=1.14):
             self.send_key_down('d')
             self.sleep(0.05)
             self.wait_and_interact(direction="d", is_lock=False, time_out=3.65)
+            self.send_key_up("d")
             if self.find_interac():
                 is_open_door = self.lobby_open_door_check()
                 if not is_open_door:
                     raise AbortException("timeout for wait_and_interact")

Also applies to: 182-192

🤖 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 168 - 171, The code holds the "d"
key down (send_key_down("d")) without guaranteed release, causing movement
drift; wrap the block that calls send_key_down("d") and subsequent
wait_and_interact(...) in a try/finally where the finally always calls
send_key_up("d"), and add a matching send_key_up("d") immediately after the
successful wait_and_interact call for the earlier occurrence; apply the same
try/finally pattern to the other occurrence around send_key_down('d') (and
ensure you don't accidentally release "w" instead of "d" by referencing the
correct key name in send_key_up).
🧹 Nitpick comments (2)
src/tasks/AutoHeistTask.py (2)

73-73: 💤 Low value

可简化冗余表述。

"浔(必须,设置为长按攻击避战)"可简化为"浔(必须,长按攻击避战)",去掉"设置为"使表述更简洁。

🤖 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/tasks/AutoHeistTask.py` at line 73, Update the redundant instruction
string passed to _inst_line: locate the call _inst_line("  避战角色:
浔(必须,设置为长按攻击避战)", indent=1) and change the inner text to "  避战角色: 浔(必须,长按攻击避战)"
to remove the extra "设置为" wording for a more concise description.

72-72: 💤 Low value

可简化冗余表述。

"随意(战斗角色随意,可塞安魂曲)"中"随意"一词重复出现,可简化为"战斗角色随意,可塞安魂曲"或"战斗角色:随意(可塞安魂曲)"以提升可读性。

🤖 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/tasks/AutoHeistTask.py` at line 72, Update the duplicated wording in the
_inst_line call inside AutoHeistTask (the string "  战斗角色: 随意(战斗角色随意,可塞安魂曲) / 主角
/ 哈尼娅") so it removes the repeated "随意" and reads more concisely (for example
"战斗角色: 随意(可塞安魂曲) / 主角 / 哈尼娅" or "战斗角色: 随意,可塞安魂曲 / 主角 / 哈尼娅"); modify the string
argument passed to _inst_line accordingly to preserve the same meaning but
eliminate redundancy.
🤖 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`:
- Line 188: 当前在 HeistPathB.py 中的 raise AbortException("timeout for
wait_and_interact") 会触发 NameError 因为 AbortException 未导入;在处理 wait_and_interact
超时分支时请改为:一是将 AbortException 提取到一个公共异常模块(例如 common_exceptions 或
exceptions),在该模块定义 AbortException 并在 HeistPathB
中导入以避免循环依赖;二是在不能立即重构时可在抛出前在该函数内部延迟导入原定义(从 AutoHeistTask 导入
AbortException),或改为抛出标准异常(如 RuntimeError)并记录上下文信息;同时确认在 wait_and_interact
超时分支中会先执行 send_key_up("d"),若不会请补上释放按键的清理逻辑以避免按键粘滞。

---

Duplicate comments:
In `@src/heist_path/HeistPathB.py`:
- Around line 168-171: The code holds the "d" key down (send_key_down("d"))
without guaranteed release, causing movement drift; wrap the block that calls
send_key_down("d") and subsequent wait_and_interact(...) in a try/finally where
the finally always calls send_key_up("d"), and add a matching send_key_up("d")
immediately after the successful wait_and_interact call for the earlier
occurrence; apply the same try/finally pattern to the other occurrence around
send_key_down('d') (and ensure you don't accidentally release "w" instead of "d"
by referencing the correct key name in send_key_up).

---

Nitpick comments:
In `@src/tasks/AutoHeistTask.py`:
- Line 73: Update the redundant instruction string passed to _inst_line: locate
the call _inst_line("  避战角色: 浔(必须,设置为长按攻击避战)", indent=1) and change the inner
text to "  避战角色: 浔(必须,长按攻击避战)" to remove the extra "设置为" wording for a more
concise description.
- Line 72: Update the duplicated wording in the _inst_line call inside
AutoHeistTask (the string "  战斗角色: 随意(战斗角色随意,可塞安魂曲) / 主角 / 哈尼娅") so it removes
the repeated "随意" and reads more concisely (for example "战斗角色: 随意(可塞安魂曲) / 主角 /
哈尼娅" or "战斗角色: 随意,可塞安魂曲 / 主角 / 哈尼娅"); modify the string argument passed to
_inst_line accordingly to preserve the same meaning but eliminate redundancy.
🪄 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: d6d662cd-3f71-4247-bf78-5d38fc382ab5

📥 Commits

Reviewing files that changed from the base of the PR and between 76ba3dc and 9365db0.

📒 Files selected for processing (2)
  • src/heist_path/HeistPathB.py
  • src/tasks/AutoHeistTask.py

Comment thread src/heist_path/HeistPathB.py
@BnanZ0 BnanZ0 merged commit d180baf into BnanZ0:main May 31, 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