fix: 修复预备编队未选择时流程提前成功 - #2658
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 Walkthrough修复
变更
Walkthrough本次更新提高“预备出战”的 OCR 匹配要求,并限制文字颜色范围。文档同步更新预备编队的页面状态、选择流程、识别快照和迁移规则。 Changes预备编队识别与选择
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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: 1
🧹 Nitpick comments (1)
src/zzz_od/operation/choose_predefined_team.py (1)
18-20: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value避免使用可变的类属性保存颜色范围。
PREDEFINED_DEPLOY_COLOR_RANGE是多实例共享的list[list[int]]。如果后续代码对它原地修改,会影响所有ChoosePredefinedTeam实例;__init__.pyi/Ruff 也会报 RUF012。只读取该参数时,使用tuple[tuple[int, int, int], tuple[int, int, int]]更合适。🤖 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/operation/choose_predefined_team.py` around lines 18 - 20, 将 ChoosePredefinedTeam 中的 PREDEFINED_DEPLOY_COLOR_RANGE 从可变的 list[list[int]] 类属性改为不可变的 tuple[tuple[int, int, int], tuple[int, int, int]],并使用对应的元组值保存颜色范围;同步确保所有读取该属性的代码兼容元组结构,避免原地修改。Source: Linters/SAST tools
🤖 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 `@docs/game/screens/预备编队.md`:
- Around line 34-39:
将文档中“非精确匹配”的表述改为“复用「实战模拟室」中的「预备出战」区域定义”,以区分区域复用与文字识别精度。同步更新相关位置(包括选队说明),明确 OCR
文字必须完整匹配「预备出战」,并与 lcs_percent: 1.0 及已有白色文字条件保持一致。
---
Nitpick comments:
In `@src/zzz_od/operation/choose_predefined_team.py`:
- Around line 18-20: 将 ChoosePredefinedTeam 中的 PREDEFINED_DEPLOY_COLOR_RANGE
从可变的 list[list[int]] 类属性改为不可变的 tuple[tuple[int, int, int], tuple[int, int,
int]],并使用对应的元组值保存颜色范围;同步确保所有读取该属性的代码兼容元组结构,避免原地修改。
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 88cee401-27d0-4570-b292-49418c367d6c
📒 Files selected for processing (5)
assets/game_data/screen_info/_od_merged.ymlassets/game_data/screen_info/combat_simulation.ymldocs/develop/zzz/application/charge_plan.mddocs/game/screens/预备编队.mdsrc/zzz_od/operation/choose_predefined_team.py
|
现在有全新的编队选择方法。 |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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 `@docs/game/screens/预备编队.md`:
- Around line 40-45: 更新“自动化流程”第 3
步,明确点击白色「预备出战」后持续检测页面状态,并在「预备编队」入口消失、返回战斗配队页后才判定操作成功;保留现有队伍选择和点击流程描述。
- Around line 34-39: 在“识别特征”段落首次使用 OCR
处补充其中文定义“光学字符识别”,并说明其用于读取界面上的文字;加入读取「预备出战」文字的具体示例,同时保留现有关于完整匹配和文字颜色的判断规则。
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 5143e95e-5774-467e-b87d-0ed327bd890f
📒 Files selected for processing (2)
docs/develop/zzz/application/charge_plan.mddocs/game/screens/预备编队.md
🚧 Files skipped from review as they are similar to previous changes (1)
- docs/develop/zzz/application/charge_plan.md
|
@kawayiYokami 需要,已经按新方法调整。#2599 的 choose_team 和 click_confirm 仍通过共享的「实战模拟室 / 预备出战」区域识别和点击,因此原来的 lcs_percent: 0.5 与无颜色限制同样会影响新方法。现在本 PR 只修改共享 screen_info 和对应文档,不再改即将废弃的旧状态机。同一组 6 项测试已分别在当前实现和 #2599 最终提交 c96a41c 上通过。 |
8c17c0e to
a69aef0
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |


问题
在“预备编队”界面尚未选中队伍时,右下角“预备出战”处于灰色禁用状态。原有共享画面区域仍可能把灰色按钮或相邻的“出战”文字识别成可点击的“预备出战”,使选队流程在错误状态下继续,最终卡在选人界面。
关联 #2652 中的选人界面卡住问题。该 issue 同时提到的版本号显示不属于本次改动范围,因此本 PR 不自动关闭整个 issue。
根因
“预备出战”由
实战模拟室 / 预备出战画面区域统一识别:lcs_percent: 0.5允许“出战”部分匹配“预备出战”。color_range: null没有限制文字颜色,灰色禁用按钮也可能被识别。round_by_find_area/round_by_find_and_click_area读取这个共享区域,因此识别条件必须在screen_info中统一修复。修复方式
1.0,只接受完整文字。[240, 240, 240]至[255, 255, 255],只把接近纯白的启用状态视为可用。ChoosePredefinedTeam状态机;修复集中在共享画面区域,因此当前实现和 feat: 式舆防卫战自动配队 #2599 新实现都会生效。验证
c96a41c:仅应用本 PR 的共享画面配置后,同一组 6 项测试全部通过。ChoosePredefinedTeam节点、灰色禁用状态、白色启用状态、部分相似文字,以及FixtureController驱动的完整多帧选队流程。git diff --check通过。test-check通过。配套测试