Skip to content

feat: 防卫战重置点击确认兜底 - #2437

Merged
ShadowLemoon merged 1 commit into
OneDragon-Anything:mainfrom
kawayiYokami:feat/shiyu-defense-confirm-fallback
Jul 5, 2026
Merged

feat: 防卫战重置点击确认兜底#2437
ShadowLemoon merged 1 commit into
OneDragon-Anything:mainfrom
kawayiYokami:feat/shiyu-defense-confirm-fallback

Conversation

@kawayiYokami

@kawayiYokami kawayiYokami commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

变更说明

  • 在式舆防卫战多间模式的弱点识别前,先检测并处理确认弹窗
  • 点击重置后由下一轮优先处理确认,避免弹窗阻塞后续识别

验证

  • 已完成代码审查
  • 未进行本地游戏实机验证

Summary by CodeRabbit

  • Bug Fixes
    • 优化了多间模式下的界面操作流程,进入相关界面时会先处理确认步骤,减少卡在确认弹窗的情况。
    • 调整了重置后的等待时间,让重置操作后更稳定,降低后续操作失败的概率。

@coderabbitai

coderabbitai Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

在 ShiyuDefenseApp 的多间模式弱点识别流程中新增“三间选择”界面确认按钮检测与点击处理逻辑,并调整需重置分支中“重置全部”操作,移除后续多余的确认点击,同时将等待时长从 0.3 秒调整为 1 秒。

Changes

速刃防线多间模式流程调整

Layer / File(s) Summary
三间选择确认检测与重置流程调整
src/zzz_od/application/shiyu_defense/shiyu_defense_app.py
新增对“三间选择”界面确认按钮的检测处理逻辑(点击成功等待、失败重试);重置全部分支中移除多余的确认点击,并将等待时间从 0.3 秒调整为 1 秒。

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
    participant App as ShiyuDefenseApp
    participant Screen as 三间选择界面
    participant Reset as 重置全部流程

    App->>Screen: 检测“确认”按钮
    alt 检测到确认
        App->>Screen: 点击“确认”
        alt 点击成功
            Screen-->>App: 等待
        else 点击失败
            App->>Screen: 重试点击
        end
    else 未检测到
        App->>App: 继续既有弱点识别流程
    end

    App->>Reset: 执行“重置全部”(need_reset 为真)
    Reset-->>App: 等待1秒(原0.3秒)
Loading

Estimated review time: ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题准确概括了防卫战多间模式中重置后点击确认的兜底处理,和本次改动一致。
✨ 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.

@kawayiYokami kawayiYokami changed the title feat: 点击确认兜底 feat: 防卫战重置点击确认兜底 Jul 4, 2026

@coderabbitai coderabbitai 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.

🧹 Nitpick comments (2)
src/zzz_od/application/shiyu_defense/shiyu_defense_app.py (2)

199-200: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

“重置全部”点击成功时同样存在重复等待。

与上面同一模式:Line 199 的 success_wait=1 在点击成功时已内部 sleep(1),Line 200 的 round_retry('已重置', wait=1) 又外层 sleep(1),点击成功场景下共计约 2 秒。此次将 success_wait 从 0.3 调整为 1(PR 目标之一),使该重复等待从原先的额外 0.3 秒放大到额外 1 秒,代价被放大了。建议去掉 success_wait=1,仅保留外层 wait=1

🐛 建议修复
             if need_reset:
-                self.round_by_click_area('式舆防卫战-三间选择', '重置全部', success_wait=1)
+                self.round_by_click_area('式舆防卫战-三间选择', '重置全部')
                 return self.round_retry('已重置', wait=1)
🤖 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/zzz_od/application/shiyu_defense/shiyu_defense_app.py` around lines 199 -
200, The “重置全部” click path in shiyu_defense_app should not double-sleep on
success. In the sequence using self.round_by_click_area(...) followed by
self.round_retry('已重置', wait=1), remove the success_wait=1 from
round_by_click_area so the click-success case only uses the outer round_retry
wait. Keep the retry flow unchanged and make sure the behavior matches the same
pattern used elsewhere in Shiyu defense click handling.

176-182: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

确认点击成功后存在重复等待,实际延迟约为预期的两倍。

round_by_click_area(..., success_wait=1) 在点击成功时内部已通过 round_success(wait=1) 触发 time.sleep(1);随后 Line 180 又调用 self.round_wait('点击确认', wait=1) 再次 sleep(1),导致点击成功后总共等待约 2 秒而非预期的 1 秒。对比同文件其他位置(如 Line 141-146)的写法:调用 round_by_find_and_click_area 时不传 success_wait,仅在外层显式 wait=1,只等待一次。建议二选一,去掉内部 success_wait 或去掉外层显式 wait

🐛 建议修复:去除重复等待
             result = self.round_by_find_area(self.last_screenshot, '式舆防卫战-三间选择', '确认')
             if result.is_success:
-                click = self.round_by_click_area('式舆防卫战-三间选择', '确认', success_wait=1)
+                click = self.round_by_click_area('式舆防卫战-三间选择', '确认')
                 if click.is_success:
                     return self.round_wait('点击确认', wait=1)
                 return self.round_retry('点击确认失败', wait=1)
🤖 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/zzz_od/application/shiyu_defense/shiyu_defense_app.py` around lines 176 -
182, In shiyu_defense_app.py, the confirmation flow in the area-selection branch
is waiting twice after a successful click: `round_by_click_area(...,
success_wait=1)` already sleeps via `round_success`, and `round_wait('点击确认',
wait=1)` adds another delay. Update the `round_by_find_area` /
`round_by_click_area` / `round_wait` sequence so only one wait is applied,
matching the pattern used elsewhere in this class (e.g. the
`round_by_find_and_click_area` flow). Either remove the `success_wait` argument
from `round_by_click_area` or remove the outer `round_wait` call, but keep the
behavior consistent and single-delay only.
🤖 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.

Nitpick comments:
In `@src/zzz_od/application/shiyu_defense/shiyu_defense_app.py`:
- Around line 199-200: The “重置全部” click path in shiyu_defense_app should not
double-sleep on success. In the sequence using self.round_by_click_area(...)
followed by self.round_retry('已重置', wait=1), remove the success_wait=1 from
round_by_click_area so the click-success case only uses the outer round_retry
wait. Keep the retry flow unchanged and make sure the behavior matches the same
pattern used elsewhere in Shiyu defense click handling.
- Around line 176-182: In shiyu_defense_app.py, the confirmation flow in the
area-selection branch is waiting twice after a successful click:
`round_by_click_area(..., success_wait=1)` already sleeps via `round_success`,
and `round_wait('点击确认', wait=1)` adds another delay. Update the
`round_by_find_area` / `round_by_click_area` / `round_wait` sequence so only one
wait is applied, matching the pattern used elsewhere in this class (e.g. the
`round_by_find_and_click_area` flow). Either remove the `success_wait` argument
from `round_by_click_area` or remove the outer `round_wait` call, but keep the
behavior consistent and single-delay only.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 98744fdb-69d1-4525-afcb-ee513aa7634b

📥 Commits

Reviewing files that changed from the base of the PR and between 6488ff2 and b81d6c2.

📒 Files selected for processing (1)
  • src/zzz_od/application/shiyu_defense/shiyu_defense_app.py

@ShadowLemoon
ShadowLemoon merged commit ab1285d into OneDragon-Anything:main Jul 5, 2026
8 checks passed
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Jul 8, 2026
@kawayiYokami
kawayiYokami deleted the feat/shiyu-defense-confirm-fallback branch July 11, 2026 16:33
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants