Skip to content

fix: 修复预备编队未选择时流程提前成功 - #2658

Open
pumpkinperson996 wants to merge 4 commits into
OneDragon-Anything:mainfrom
pumpkinperson996:codex/fix-predefined-team-selection
Open

fix: 修复预备编队未选择时流程提前成功#2658
pumpkinperson996 wants to merge 4 commits into
OneDragon-Anything:mainfrom
pumpkinperson996:codex/fix-predefined-team-selection

Conversation

@pumpkinperson996

@pumpkinperson996 pumpkinperson996 commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

问题

在“预备编队”界面尚未选中队伍时,右下角“预备出战”处于灰色禁用状态。原有共享画面区域仍可能把灰色按钮或相邻的“出战”文字识别成可点击的“预备出战”,使选队流程在错误状态下继续,最终卡在选人界面。

关联 #2652 中的选人界面卡住问题。该 issue 同时提到的版本号显示不属于本次改动范围,因此本 PR 不自动关闭整个 issue。

根因

“预备出战”由 实战模拟室 / 预备出战 画面区域统一识别:

  1. lcs_percent: 0.5 允许“出战”部分匹配“预备出战”。
  2. color_range: null 没有限制文字颜色,灰色禁用按钮也可能被识别。
  3. 当前选队实现和 feat: 式舆防卫战自动配队 #2599 的新选队实现都会通过 round_by_find_area / round_by_find_and_click_area 读取这个共享区域,因此识别条件必须在 screen_info 中统一修复。

修复方式

  • 将“预备出战”的文字匹配比例改为 1.0,只接受完整文字。
  • 将文字颜色限制为 RGB [240, 240, 240][255, 255, 255],只把接近纯白的启用状态视为可用。
  • 同步更新源画面配置、合并画面配置、画面文档和充电计划说明。
  • 不修改即将被替换的旧 ChoosePredefinedTeam 状态机;修复集中在共享画面区域,因此当前实现和 feat: 式舆防卫战自动配队 #2599 新实现都会生效。

验证

  • 当前分支:预备编队定向测试 6 项通过。
  • feat: 式舆防卫战自动配队 #2599 最终提交 c96a41c:仅应用本 PR 的共享画面配置后,同一组 6 项测试全部通过。
  • 测试覆盖实际 ChoosePredefinedTeam 节点、灰色禁用状态、白色启用状态、部分相似文字,以及 FixtureController 驱动的完整多帧选队流程。
  • Ruff 检查通过。
  • git diff --check 通过。
  • 主仓远端 test-check 通过。

配套测试

@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 26eed340-a399-4ca1-8ba5-1d1ec658cdc0

📥 Commits

Reviewing files that changed from the base of the PR and between 2901ac3 and a69aef0.

📒 Files selected for processing (4)
  • assets/game_data/screen_info/_od_merged.yml
  • assets/game_data/screen_info/combat_simulation.yml
  • docs/develop/zzz/application/charge_plan.md
  • docs/game/screens/预备编队.md
🚧 Files skipped from review as they are similar to previous changes (3)
  • docs/develop/zzz/application/charge_plan.md
  • assets/game_data/screen_info/_od_merged.yml
  • assets/game_data/screen_info/combat_simulation.yml

📝 Walkthrough

修复

  • 修复未选择预备编队时流程提前成功的问题。
  • 将“预备出战”文字识别改为完整匹配。
  • 将可点击文字颜色限制为接近纯白。

变更

  • 更新源画面配置和合并画面配置。
  • 更新预备编队画面文档。
  • 更新充电计划说明。

Walkthrough

本次更新提高“预备出战”的 OCR 匹配要求,并限制文字颜色范围。文档同步更新预备编队的页面状态、选择流程、识别快照和迁移规则。

Changes

预备编队识别与选择

Layer / File(s) Summary
按钮识别配置
assets/game_data/screen_info/_od_merged.yml, assets/game_data/screen_info/combat_simulation.yml
将“预备出战”的 lcs_percent 设置为 1.0,并增加浅灰至白色的 color_range
预备编队选择流程
docs/develop/zzz/application/charge_plan.md, docs/game/screens/预备编队.md
要求完整匹配白色“预备出战”文本,并补充页面布局、按钮状态、进入列表、选择队伍、点击按钮和返回流程。
预备编队文档同步
docs/game/screens/预备编队.md
更新页面状态、识别快照、PredefinedTeamChecker 流程、多玩法入口、核心技数量 OCR 规则和区域迁移要求。

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

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed 标题准确概括了修复预备编队未选择时流程提前成功这一主要变更。
Description check ✅ Passed 描述说明了问题根因、配置修复范围、验证结果及与相关 issue 的关系,与变更内容一致。
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.
✨ 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.

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between 3907abe and 1919d13.

📒 Files selected for processing (5)
  • assets/game_data/screen_info/_od_merged.yml
  • assets/game_data/screen_info/combat_simulation.yml
  • docs/develop/zzz/application/charge_plan.md
  • docs/game/screens/预备编队.md
  • src/zzz_od/operation/choose_predefined_team.py

Comment thread docs/game/screens/预备编队.md Outdated
@kawayiYokami

Copy link
Copy Markdown
Contributor

#2599

现在有全新的编队选择方法。
旧的方法这几天就会被抛弃,你看看新的选择方法是否需要此优化?

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6fc4737 and c9a0a3d.

📒 Files selected for processing (2)
  • docs/develop/zzz/application/charge_plan.md
  • docs/game/screens/预备编队.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/develop/zzz/application/charge_plan.md

Comment thread docs/game/screens/预备编队.md
Comment thread docs/game/screens/预备编队.md
@pumpkinperson996

Copy link
Copy Markdown
Contributor Author

@kawayiYokami 需要,已经按新方法调整。#2599 的 choose_team 和 click_confirm 仍通过共享的「实战模拟室 / 预备出战」区域识别和点击,因此原来的 lcs_percent: 0.5 与无颜色限制同样会影响新方法。现在本 PR 只修改共享 screen_info 和对应文档,不再改即将废弃的旧状态机。同一组 6 项测试已分别在当前实现和 #2599 最终提交 c96a41c 上通过。

@pumpkinperson996
pumpkinperson996 force-pushed the codex/fix-predefined-team-selection branch from 8c17c0e to a69aef0 Compare August 4, 2026 20:48
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

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.

@luming-ger

Copy link
Copy Markdown
屏幕截图 2026-08-15 180616 屏幕截图 2026-08-15 180605 我的是2.5.1版本,仍然会出现误识别导致使选队流程在错误状态下继续,最终卡在选人界面

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