Conversation
Walkthrough更新了战斗界面“再来一次”按钮点击区域,并在遗器提取操作中新增公有实例属性 Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
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: 2
🤖 Fix all issues with AI agents
In @src/sr_od/app/div_uni/operations/ornamenet_extraction.py:
- Around line 34-35: The field self.completed_times is incorrectly initialized
to -1 and misdocumented; change its initial value to 0 and update the docstring
to reflect its actual meaning ("本次战斗实际完成的挑战次数" or similar). Update the
declaration of self.completed_times (the symbol completed_times in
ornamenet_extraction.py) from -1 to 0 so subsequent logic (e.g., increments that
affect battle_fail_times, battle_success_times and get_reward_callback) no
longer underflow, and replace the current comment that mirrors run_times with a
concise description of its meaning.
- Around line 176-181: The bug is that completed_times is only set in
click_challenge_times() and not recalculated when a retry path returns to
wait_battle_result(), causing battle_success_times to overshoot run_times;
update logic so completed_times is recalculated before each battle attempt or
before incrementing counters (e.g., in wait_battle_result() or right when
handling ScreenState.BATTLE_SUCCESS/BATTLE_FAIL in round_by_op_result()) by
computing completed_times = min(remaining = run_times - (battle_success_times +
battle_fail_times), originally_requested_times) or cap the increment applied to
battle_success_times/battle_fail_times to not exceed run_times, ensuring
completed_times and the increments never push totals past run_times.
🧹 Nitpick comments (1)
src/sr_od/app/div_uni/operations/ornamenet_extraction.py (1)
123-123: 建议在 else 分支中显式设置 completed_times。虽然将初始值改为 1 可以解决问题,但为了代码清晰性和防御性编程,建议在
run_times == 1的情况下也显式设置completed_times = 1。♻️ 建议的改进
log.info('本次挑战次数 %d', self.run_times) if self.run_times > 1: self.completed_times = min(6, self.run_times) op = ChooseChallengeTimes(self.ctx, min(6, self.run_times), mission_type='饰品提取') return self.round_by_op_result(op.execute()) else: + self.completed_times = 1 return self.round_success()
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
assets/game_data/screen_info/battle.ymlsrc/sr_od/app/div_uni/operations/ornamenet_extraction.py
🧰 Additional context used
🧠 Learnings (2)
📚 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/div_uni/operations/ornamenet_extraction.py
📚 Learning: 2025-12-21T03:02:25.697Z
Learnt from: JoshCai233
Repo: OneDragon-Anything/StarRailOneDragon PR: 521
File: src/script_chainer/win_exe/script_runner.py:96-102
Timestamp: 2025-12-21T03:02:25.697Z
Learning: In Python code across the project (e.g., src/script_chainer/win_exe/script_runner.py), prefer using the project's log module for logging to files instead of using print statements for console output. Print does not write to log files, so replace prints with logger calls (e.g., log.info, log.debug, log.error) and ensure proper logging configuration is in place.
Applied to files:
src/sr_od/app/div_uni/operations/ornamenet_extraction.py
🧬 Code graph analysis (1)
src/sr_od/app/div_uni/operations/ornamenet_extraction.py (1)
src/one_dragon/base/operation/operation.py (2)
round_by_op_result(766-787)status(51-55)
🔇 Additional comments (1)
assets/game_data/screen_info/battle.yml (1)
52-53: 坐标扩展合理,有助于提高按钮识别率。"再来一次按钮"的点击区域从 [1330, 960] 扩展到 [1400, 1000],这与PR目标中修复识别失败的问题相符。扩大的区域应该能够更好地覆盖多次挑战模式下的按钮显示范围。
bec8f2f to
fb56377
Compare
Summary by CodeRabbit
Bug Fixes
New Features
✏️ Tip: You can customize this high-level summary in your review settings.