Conversation
概览该变更在屏幕截图调用链中引入了 变更
代码审查工作量估计🎯 3 (中等) | ⏱️ ~22 分钟 需要额外关注的区域:
诗
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 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: 0
🧹 Nitpick comments (1)
src/sr_od/challenge_mission/use_trailblaze_power.py (1)
1-1: 等待战斗结果节点改动合理,顺便建议清理无用的screen导入
_wait_battle_result上把screenshot_before_round=False与内部self.screenshot(dont_move_mouse=True)搭配使用,语义和 EchoOfWar / WaitBattleResult 中的等待节点保持一致,避免了重复截图和强制移动鼠标,符合预期。- 顶部
from PIL.ImageChops import screen未被使用,并且与函数内的局部变量screen同名,Ruff 报 F811(“Redefinition of unusedscreen”);建议直接删除该导入,既消除告警也减少读者困惑。可以按如下方式调整 import 部分:
-from PIL.ImageChops import screen -from typing import Optional, Callable, ClassVar +from typing import Optional, Callable, ClassVarAlso applies to: 180-202
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
src/one_dragon/base/controller/controller_base.py(2 hunks)src/one_dragon/base/operation/operation.py(2 hunks)src/sr_od/app/echo_of_war/challenge_ehco_of_war.py(1 hunks)src/sr_od/challenge_mission/use_trailblaze_power.py(1 hunks)src/sr_od/context/sr_pc_controller.py(1 hunks)src/sr_od/operations/battle/wait_battle_result.py(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-10-13T12:07:30.874Z
Learnt from: JoshCai233
Repo: OneDragon-Anything/StarRailOneDragon PR: 521
File: src/sr_od/app/sim_uni/sim_uni_app.py:61-87
Timestamp: 2025-10-13T12:07:30.874Z
Learning: 在 `_check_points_reward()` 中,`OperationRoundResult` 的语义与常规不同:`FAIL` 表示"奖励未完成,需要继续执行自动化",而 `SUCCESS` 和 `RETRY` 表示"提前返回,跳过自动化"。这是因为调用方使用 `if result != FAIL: return` 来判断是否跳过后续的自动化脚本执行。
Applied to files:
src/sr_od/app/echo_of_war/challenge_ehco_of_war.pysrc/sr_od/challenge_mission/use_trailblaze_power.py
🧬 Code graph analysis (4)
src/sr_od/context/sr_pc_controller.py (2)
src/one_dragon/base/controller/controller_base.py (1)
before_screenshot(75-79)src/one_dragon/base/controller/pc_controller_base.py (1)
mouse_move(204-210)
src/one_dragon/base/controller/controller_base.py (2)
src/one_dragon/base/operation/operation.py (1)
screenshot(624-634)src/sr_od/context/sr_pc_controller.py (1)
before_screenshot(43-45)
src/sr_od/challenge_mission/use_trailblaze_power.py (3)
src/one_dragon/base/operation/operation_node.py (1)
operation_node(72-100)src/one_dragon/base/operation/operation.py (2)
name(44-48)screenshot(624-634)src/sr_od/app/echo_of_war/challenge_ehco_of_war.py (1)
_wait_battle_result(150-168)
src/one_dragon/base/operation/operation.py (1)
src/one_dragon/base/controller/controller_base.py (1)
screenshot(53-73)
🪛 Ruff (0.14.7)
src/sr_od/challenge_mission/use_trailblaze_power.py
186-186: Redefinition of unused screen from line 1
(F811)
🔇 Additional comments (5)
src/one_dragon/base/operation/operation.py (1)
624-634: Operation.screenshot 扩展参数设计合理这里增加
dont_move_mouse并通过关键字透传到ctx.controller.screenshot,对现有仅位置参数调用是向后兼容的;上层等待战斗结果节点用dont_move_mouse=True也能正确生效。后续如再新增调用点,建议也统一用关键字参数,避免误把其他布尔值位置上传给dont_move_mouse。src/sr_od/app/echo_of_war/challenge_ehco_of_war.py (1)
149-150: 等待战斗结果节点的截图行为调整是合理的将
screenshot_before_round=False配合节点内部的self.screenshot(dont_move_mouse=True),避免了每轮自动多截一张图,也避免在战斗结算期间强行移动鼠标;对battle_screen_state.get_tp_battle_screen_state的逻辑没有改变,只是截图时机和鼠标行为更可控,符合“等待战斗结束时不强制移动鼠标”的需求。Also applies to: 155-168
src/sr_od/operations/battle/wait_battle_result.py (1)
17-20: WaitBattleResult 的截图策略与其他等待节点保持一致
wait节点现在禁用了自动轮前截图,改为在函数内部调用self.screenshot(dont_move_mouse=True),和其他等待战斗结果的节点风格统一,同时避免在长时间等待期间反复移动鼠标。try_attack分支仍然在识别到大世界画面后主动操作,与本次改动没有冲突。src/sr_od/context/sr_pc_controller.py (1)
43-46: before_screenshot 的新参数实现与基类对齐这里的实现很好地利用了新加的
dont_move_mouse:默认仍然把鼠标移动到fill_uid_black遮挡区域,保持旧行为不变;在需要时(如等待战斗结果)可以通过dont_move_mouse=True完全跳过鼠标移动。与基类签名一致,便于后续扩展其它平台控制器时复用这一约定。src/one_dragon/base/controller/controller_base.py (1)
53-57: Verify all subclass overrides ofbefore_screenshothave the updated signatureThe
screenshotmethod now passesdont_move_mouseas a keyword argument tobefore_screenshot. Any subclass that overridesbefore_screenshotwithout accepting this parameter will raiseTypeErrorat runtime. Ensure all implementations includedef before_screenshot(self, dont_move_mouse: bool = False)or compatible signature.
在等待副本自动战斗结束时,游戏不需要操作鼠标,脚本只需要检测战斗结束标志即可,但是鼠标会每秒一次地移动到崩铁的左下角,用户需要按下脚本暂停键才能使用鼠标的正常功能
|
额,我还想着绝龙也强制抢鼠标,防止用户在运行时非法临时修改一条龙配置呢,跟隔壁原神一样 |
|
Summary by CodeRabbit
发布说明
✏️ Tip: You can customize this high-level summary in your review settings.