feat: 式舆防卫战自动配队 - #2599
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:
📝 WalkthroughWalkthrough重构式舆防卫战的预备编队扫描、OCR 目标识别、队伍评分和选队状态机。更新普通及多间模式流程。新增配队选择开发工具、配置界面和战斗机制文档。 Changes式舆防卫战配队选择
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant ShiyuDefenseApp
participant get_team_targets
participant ChoosePredefinedTeam
participant TeamConfig
participant select_teams
participant ShiyuDefenseBattle
ShiyuDefenseApp->>get_team_targets: OCR 识别弱点、抗性和房间完成状态
get_team_targets-->>ShiyuDefenseApp: 返回目标列表
ShiyuDefenseApp->>ChoosePredefinedTeam: 传入目标列表并扫描预备编队
ChoosePredefinedTeam->>TeamConfig: 写入编队名称和前三名代理人
ChoosePredefinedTeam->>select_teams: 计算互斥队伍及总分
select_teams-->>ChoosePredefinedTeam: 返回队伍索引和分数
ChoosePredefinedTeam-->>ShiyuDefenseApp: 返回选队结果
ShiyuDefenseApp->>ShiyuDefenseBattle: 使用当前队伍索引出战
ShiyuDefenseBattle-->>ShiyuDefenseApp: 返回战斗结果并更新房间状态
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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 |
7185cfa to
039948c
Compare
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (5)
docs/game/gameplay/式舆防卫战.md (1)
91-93: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy lift集中维护自动化实现细节,避免文档分叉。
当前扫描、评分、OCR 选队和多间模式状态流转同时写入玩法文档与画面文档,后续代码变更容易造成两处描述不一致。建议将实现流程集中到对应 skill/自动化文档;玩法文档和画面文档只保留必要概述并通过引用链接到唯一来源。
docs/gameplay/式舆防卫战.md#L91-L93: 保留玩法层流程概述,移除详细自动化节点链。docs/game/screens/式舆防卫战.md#L64-L66: 将扫描与评分实现细节改为引用统一的自动化文档。docs/game/screens/式舆防卫战.md#L68-L69: 将 OCR 定位和选中态判定细节集中到统一来源。docs/game/screens/式舆防卫战.md#L131-L131: 将多间模式的实现说明改为引用统一流程文档。依据编码规范:文档分层遵循“方法写 skill、具体内容写 doc”,玩法机制与自动化实现分开,并保持单一事实来源;重复内容应通过引用表达。
🤖 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 `@docs/game/gameplay/式舆防卫战.md` around lines 91 - 93, 自动化实现细节在玩法文档与画面文档重复,需集中维护并避免文档分叉。更新 docs/game/gameplay/式舆防卫战.md:91-93,仅保留玩法层流程概述并移除扫描、评分、OCR 选队及状态流转细节;更新 docs/game/screens/式舆防卫战.md:64-66、68-69、131-131,将对应实现说明分别替换为指向统一 skill/自动化流程文档的引用,确保唯一来源覆盖扫描评分、OCR 选中态判定和多间模式流程。Source: Coding guidelines
src/zzz_od/application/shiyu_defense/shiyu_defense_app.py (1)
306-308: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value
team_idx = -1已冗余。房间完成状态现在由
is_completed表达,multi_room_select也不再看team_idx;再置-1只会让状态含义变模糊(-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 306 - 308, 删除 shiyu_defense_app.py 中完成当前房间的逻辑里对 self.room_teams[self.current_room_idx].team_idx 的 -1 赋值,仅保留 is_completed = True;不要修改 result 返回或其他房间状态处理。src/zzz_od/application/shiyu_defense/shiyu_defense_team_utils.py (3)
161-167: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win
agent_map每次评分都重建。
_get_agents会在回溯的每个候选队上被调用,而AgentEnum→ agent_id 的映射是静态的,建议提到模块级(或用functools.cache)只构建一次。♻️ 建议改动
- def _get_agents(self, team: PredefinedTeamInfo) -> list[Agent]: - agent_map = {agent.value.agent_id: agent.value for agent in AgentEnum} - return [ - agent_map[agent_id] - for agent_id in team.agent_id_list - if agent_id in agent_map - ] + def _get_agents(self, team: PredefinedTeamInfo) -> list[Agent]: + agent_map = _get_agent_map() + return [ + agent_map[agent_id] + for agent_id in team.agent_id_list + if agent_id in agent_map + ]模块级新增:
`@functools.cache` def _get_agent_map() -> dict[str, Agent]: return {agent.value.agent_id: agent.value for agent in AgentEnum}🤖 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_team_utils.py` around lines 161 - 167, 将 AgentEnum 到 agent_id 的静态映射从 _get_agents 中移出,新增模块级缓存辅助函数(如 _get_agent_map,使用 functools.cache)并仅构建一次;让 _get_agents 复用该缓存映射,同时保持现有按 team.agent_id_list 过滤并返回 Agent 的行为不变。
319-333: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low value用
zip替代index()反查。
target_text_list.index(target_text)在两个伤害类型翻译文本相同时会取到错误枚举;直接同时遍历枚举与文本更稳妥。♻️ 建议改动
- for target_text in target_text_list: - if target_text in full_text: - result.append(dmg_type_list[target_text_list.index(target_text)]) + for dmg_type, target_text in zip(dmg_type_list, target_text_list, strict=True): + if target_text in full_text: + result.append(dmg_type)🤖 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_team_utils.py` around lines 319 - 333, Update _extract_dmg_types to iterate over dmg_type_list and target_text_list together with zip, appending the paired DmgTypeEnum when its translated text appears in full_text; remove the target_text_list.index(target_text) reverse lookup.
28-34: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value建议用
ClassVar标注不可变常量。
VOID_HUNTER_AGENT_ID_LIST是可变类属性(Ruff RUF012),语义上是常量且仅做成员判断,改为ClassVar[frozenset[str]]既消除告警又让查找为 O(1)。♻️ 建议改动
- VOID_HUNTER_AGENT_ID_LIST: list[str] = [ - 'yixuan', - 'hoshimi_miyabi', - 'yeshunguang', - 'remielle', - ] - VOID_HUNTER_SCORE_MULTIPLIER: float = 1.2 + VOID_HUNTER_AGENT_ID_SET: ClassVar[frozenset[str]] = frozenset({ + 'yixuan', + 'hoshimi_miyabi', + 'yeshunguang', + 'remielle', + }) + VOID_HUNTER_SCORE_MULTIPLIER: ClassVar[float] = 1.2🤖 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_team_utils.py` around lines 28 - 34, 将 VOID_HUNTER_AGENT_ID_LIST 标注为 ClassVar[frozenset[str]],并将现有列表初始化改为不可变 frozenset;保留所有成员值及成员判断语义,同时确保 VOID_HUNTER_SCORE_MULTIPLIER 不受影响。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`:
- Line 67: 更新 ChoosePredefinedTeam 的扫描规则,明确区分真正的空队与禁用编队:缺少 1P/2P/3P
标记的禁用编队应跳过并继续扫描,只有确认当前卡片是空队时才停止扫描;保留单人、双人队合法及既有自动战斗配置的说明。
In `@src/zzz_od/config/team_config.py`:
- Around line 71-84: Update update_team_by_idx to normalize members through a
shared _to_agent_id_list helper that takes only the first three agent IDs and
pads shorter lists with 'unknown'. Replace the duplicated padding logic in
update_team_members with the same helper, preserving the existing three-member
configuration limit.
In `@src/zzz_od/operation/choose_predefined_team.py`:
- Around line 274-281: Update the deduplication logic in the predefined-team
scanning flow around next_scanned_team_idx and _find_exact_team_name so cards
are identified by page and card position rather than team_name alone. Ensure
duplicate names still consume their own team_idx and remain aligned with the
game list, while preserving the existing skip behavior only for the same
physical card being rescanned.
- Around line 143-170: 为 pending_cancel_button_center 和
pending_select_button_center 的确认轮询增加尝试次数上限,避免持续 OCR 失败或状态未恢复时无限调用
round_wait。超限后调用 round_fail,或改用能让 node_max_retry_times 生效的
round_retry;确保成功确认时仍清理对应 pending 状态并继续原有流程。
---
Nitpick comments:
In `@docs/game/gameplay/式舆防卫战.md`:
- Around line 91-93: 自动化实现细节在玩法文档与画面文档重复,需集中维护并避免文档分叉。更新
docs/game/gameplay/式舆防卫战.md:91-93,仅保留玩法层流程概述并移除扫描、评分、OCR 选队及状态流转细节;更新
docs/game/screens/式舆防卫战.md:64-66、68-69、131-131,将对应实现说明分别替换为指向统一
skill/自动化流程文档的引用,确保唯一来源覆盖扫描评分、OCR 选中态判定和多间模式流程。
In `@src/zzz_od/application/shiyu_defense/shiyu_defense_app.py`:
- Around line 306-308: 删除 shiyu_defense_app.py 中完成当前房间的逻辑里对
self.room_teams[self.current_room_idx].team_idx 的 -1 赋值,仅保留 is_completed =
True;不要修改 result 返回或其他房间状态处理。
In `@src/zzz_od/application/shiyu_defense/shiyu_defense_team_utils.py`:
- Around line 161-167: 将 AgentEnum 到 agent_id 的静态映射从 _get_agents
中移出,新增模块级缓存辅助函数(如 _get_agent_map,使用 functools.cache)并仅构建一次;让 _get_agents
复用该缓存映射,同时保持现有按 team.agent_id_list 过滤并返回 Agent 的行为不变。
- Around line 319-333: Update _extract_dmg_types to iterate over dmg_type_list
and target_text_list together with zip, appending the paired DmgTypeEnum when
its translated text appears in full_text; remove the
target_text_list.index(target_text) reverse lookup.
- Around line 28-34: 将 VOID_HUNTER_AGENT_ID_LIST 标注为
ClassVar[frozenset[str]],并将现有列表初始化改为不可变 frozenset;保留所有成员值及成员判断语义,同时确保
VOID_HUNTER_SCORE_MULTIPLIER 不受影响。
🪄 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: d4d3e692-ec07-43a7-abc4-e41018e73521
📒 Files selected for processing (16)
docs/game/gameplay/式舆防卫战.mddocs/game/screens/式舆防卫战.mdsrc/one_dragon/base/controller/pc_controller_base.pysrc/zzz_od/application/devtools/shiyu_defense_team_test/__init__.pysrc/zzz_od/application/devtools/shiyu_defense_team_test/shiyu_defense_team_test_app.pysrc/zzz_od/application/devtools/shiyu_defense_team_test/shiyu_defense_team_test_app_factory.pysrc/zzz_od/application/devtools/shiyu_defense_team_test/shiyu_defense_team_test_config.pysrc/zzz_od/application/devtools/shiyu_defense_team_test/shiyu_defense_team_test_const.pysrc/zzz_od/application/shiyu_defense/shiyu_defense_app.pysrc/zzz_od/application/shiyu_defense/shiyu_defense_app_setting.pysrc/zzz_od/application/shiyu_defense/shiyu_defense_team_utils.pysrc/zzz_od/config/team_config.pysrc/zzz_od/gui/app_setting/shiyu_defense_setting_interface.pysrc/zzz_od/gui/view/devtools/app_devtools_interface.pysrc/zzz_od/gui/view/devtools/shiyu_defense_team_test_interface.pysrc/zzz_od/operation/choose_predefined_team.py
💤 Files with no reviewable changes (2)
- src/zzz_od/application/shiyu_defense/shiyu_defense_app_setting.py
- src/zzz_od/gui/app_setting/shiyu_defense_setting_interface.py
There was a problem hiding this comment.
♻️ Duplicate comments (1)
src/zzz_od/config/team_config.py (1)
80-83: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win统一两个配置同步入口的三人上限。
这里已将
update_team_by_idx的成员列表截断为 3 人,但update_team_members仍会把全部members写入配置(Line 94-97)。同一个agent_id_list因调用入口不同可能出现不同长度,破坏预备编队的三人约束。建议抽取统一的截断与unknown补齐逻辑,并由两个方法共同复用。🤖 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/config/team_config.py` around lines 80 - 83, 统一 update_team_by_idx 与 update_team_members 的 agent_id_list 生成逻辑:抽取共同的成员处理方法,将 members 截断为最多 3 人,并用 'unknown' 补齐至 3 人。让两个配置同步入口都复用该方法后再调用 self.update_team,确保无论入口如何调用都保持三人上限。
🤖 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.
Duplicate comments:
In `@src/zzz_od/config/team_config.py`:
- Around line 80-83: 统一 update_team_by_idx 与 update_team_members 的 agent_id_list
生成逻辑:抽取共同的成员处理方法,将 members 截断为最多 3 人,并用 'unknown' 补齐至 3 人。让两个配置同步入口都复用该方法后再调用
self.update_team,确保无论入口如何调用都保持三人上限。
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 6251b60c-f442-47db-baa8-563b4e4de4ae
📒 Files selected for processing (3)
docs/game/screens/式舆防卫战.mdsrc/zzz_od/config/team_config.pysrc/zzz_od/operation/choose_predefined_team.py
🚧 Files skipped from review as they are similar to previous changes (1)
- docs/game/screens/式舆防卫战.md
…to-team Co-Authored-By: Claude Code <noreply@anthropic.com> Co-Authored-By: glm-5.2 <noreply@bigmodel.cn>
战斗机制此前无文档(combat.md 是空模板),导致配队评分代码注释缺失、虚狩被直译成虚无猎人、染色分支不对称无依据可考。 - 新增 combat.md:属性克制/异常紊乱/失衡连携三条输出链路、风与流明(维琳娜/蕾米埃尔)的染色机制、职业系统、虚狩概念、自动配队评分依据 - team_utils 注释反哺:虚狩正名、染色分支 WIND/LUMIFLUX 不对称的依据(流明可变属性)、评分权重非真实伤害倍率 Co-Authored-By: Claude Code <noreply@anthropic.com> Co-Authored-By: glm-5.2 <noreply@bigmodel.cn>
| normalized_text == 'SELECTED' | ||
| or normalized_text == 'TEAM' | ||
| or normalized_text.startswith('TEAM') | ||
| or re.fullmatch(r'\d{2}', normalized_text) is not None |
There was a problem hiding this comment.
🟠 \d{2} 会误匹配角色等级 "60"——SELECT 被 OCR 漏读时可能误点队伍(实测确认)
re.fullmatch(r"\d{2}", normalized_text) 原意是兜底识别选中态的队伍编号(TEAM 01/02),但角色等级也是两位数 "60",且落在 _find_selected_button 检测区(x_offset 300-850、y_offset 40-250)内,两者无法区分。
在实时选队截图上验证:_is_selected_text("60") → True;6 张卡 _find_selected_button 全部误判 SELECTED(命中全是 "60"),平时被 _find_select_button 先命中 SELECT 掩盖。一旦 OCR 把 SELECT 漏读(实测日志见过 +$ELECT/+SELEET)→ SELECTED 误判 → 走"取消预选"分支误点卡片 → 等 SELECT 恢复(不会)→ retry×3 → round_fail。
建议去掉这条 \d{2}(选中态靠 TEAM 匹配即可)。代价:OCR 把 TEAM 也漏读时 round_fail(安全失败),而非误点。
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
src/zzz_od/application/shiyu_defense/shiyu_defense_team_utils.py (2)
60-84: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win跳过已完成目标,并保留完成状态。
_search_target()仍会为每个目标分配队伍。src/zzz_od/operation/choose_predefined_team.py将完整的shiyu_target_list传入select_teams()。已完成房间因此会占用chosen_team_idx_set和chosen_agent_id_set,可能使未完成房间无法找到可用组合。
_save_best()重新创建DefensePhaseTeamInfo时也没有复制is_completed。返回结果会丢失该状态。请在递归入口跳过已完成目标,并在保存结果时复制
is_completed。已完成目标应保持team_idx == -1和score == 0,且不计入新组合评分。请增加已完成房间与未完成房间混合的回归测试。建议修复
def _search_target(self, target_idx: int) -> None: if target_idx >= len(self.target_list): self._save_best() return target = self.target_list[target_idx] + if target.is_completed: + target.team_idx = -1 + target.score = 0 + self._search_target(target_idx + 1) + return + for team in self.candidate_team_list: ... result.team_idx = target.team_idx result.score = target.score + result.is_completed = target.is_completedAlso applies to: 86-97
🤖 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_team_utils.py` around lines 60 - 84, Update _search_target() to detect completed targets at the recursive entry, preserve their team_idx == -1 and score == 0 values, and recurse to the next target without adding their teams or agents to the chosen sets or scoring. Update _save_best() to copy each target’s is_completed state when recreating DefensePhaseTeamInfo. Add a regression test covering mixed completed and incomplete rooms, ensuring completed rooms do not block valid team combinations.
254-322: 🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift识别失败必须走失败路径。
多间模式的房间 OCR 或区域识别缺失、解析失败时,当前改动返回未知目标。
src/zzz_od/application/shiyu_defense/shiyu_defense_app.py随后仍会记录目标并返回成功。后续流程可能把team_idx == -1解释为已完成或跳过,导致识别失败的房间被错误完成。请让识别失败分支显式返回失败状态,并在
check_weakness()中处理该状态。不要返回会继续进入选队流程的未知目标。Based on learnings:多间模式的 OCR/区域识别失败必须立即失败或退出,不能落入
team_idx == -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_team_utils.py` around lines 254 - 322, Update get_team_targets_for_multi_room so OCR, missing-area, and parsing failures return an explicit failure result instead of appending unknown DefensePhaseTeamInfo entries; ensure callers can distinguish failure from completed rooms. Update check_weakness in shiyu_defense_app.py to detect and handle that failure immediately, preventing the result from reaching the team-selection or team_idx == -1 completion path.Source: Learnings
🤖 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.
Outside diff comments:
In `@src/zzz_od/application/shiyu_defense/shiyu_defense_team_utils.py`:
- Around line 60-84: Update _search_target() to detect completed targets at the
recursive entry, preserve their team_idx == -1 and score == 0 values, and
recurse to the next target without adding their teams or agents to the chosen
sets or scoring. Update _save_best() to copy each target’s is_completed state
when recreating DefensePhaseTeamInfo. Add a regression test covering mixed
completed and incomplete rooms, ensuring completed rooms do not block valid team
combinations.
- Around line 254-322: Update get_team_targets_for_multi_room so OCR,
missing-area, and parsing failures return an explicit failure result instead of
appending unknown DefensePhaseTeamInfo entries; ensure callers can distinguish
failure from completed rooms. Update check_weakness in shiyu_defense_app.py to
detect and handle that failure immediately, preventing the result from reaching
the team-selection or team_idx == -1 completion path.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 172e7e32-2369-4b0f-bd2d-a009b9d3fbcb
📒 Files selected for processing (3)
docs/game/gameplay/combat.mdsrc/zzz_od/application/shiyu_defense/shiyu_defense_app.pysrc/zzz_od/application/shiyu_defense/shiyu_defense_team_utils.py
🚧 Files skipped from review as they are similar to previous changes (1)
- src/zzz_od/application/shiyu_defense/shiyu_defense_app.py
实测发现的两个 OCR 相关问题: 1. 多间配队候选不足(根因):旧逻辑用1P/2P/3P三标记判满员,3P文字OCR漏读会误判满员队禁用,导致候选不足、select_teams选不出3互斥队。改用核心技X/Y(分母=队伍人数)判满员(X/3为主、1P/2P/3P≥2兜底),并兼容OCR把斜线误识为1的连写(313=3/3)。 2. 进度误判完成:OCR把进度X/Y读成total<current(如2/1)时,choose_node_idx误判全部完成跳过整关。加total<current校验回退run_record。 配套文档:式舆防卫战玩法/画面doc补X/3含义(核心技羁绊非角色数)、进度X/Y(分母=人数),并纠正禁用措辞(防卫战无禁用代理人玩法)。 Co-Authored-By: Claude Code <noreply@anthropic.com> Co-Authored-By: glm-5.2 <noreply@bigmodel.cn>
DoctorReid
left a comment
There was a problem hiding this comment.
本地完成一轮端到端实测(账号1 式舆防卫战剧变节点),已 push 修复(7bd1652,含 49b1f9d 文档):
实测发现并修复 3 处 OCR 相关问题:
- 多间配队候选不足(根因):扫描用 1P/2P/3P 三标记判满员,3P 文字 OCR 漏读会误判满员队禁用 → 候选不足 → select_teams 选不出 3 互斥队。改用核心技 X/Y(分母=队伍人数)判满员(X/3 为主、1P/2P/3P≥2 兜底),兼容斜线误识为 1 的连写(313=3/3)。
- 进度 OCR 误判完成:X/Y 读成 total<current(如 2/1)时 choose_node_idx 误判全部完成跳过整关 → 加 total<current 校验回退 run_record。
- _is_selected_text 的 \d{2} 误匹配等级 60 → 限 0 开头(0\d:选中态编号 01-09,排除等级)。
端到端验证:多间(节点5)扫描候选 11 → select_teams 选 3 满员互斥(简薇耀/仪玄/冰雅狼苍,避开 1 人测试队)→ 3 间战斗 → 领奖 → 回大世界,完整跑通。
另:combat.md 补战斗机制 + team_utils 注释(虚狩正名/染色依据/评分权重)。
建议 author 确认 X/3 判满员的修法,并补选配队单元测试。
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/zzz_od/application/shiyu_defense/shiyu_defense_app.py (1)
202-216: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win在进入选队前拒绝不完整的目标列表。
Line 202 和 Line 218 将识别结果直接传入后续状态机。若多间模式识别返回空列表,
multi_room_select会把节点标记为完成。若普通模式识别返回空列表,流程可能通过空配队选择,并在shiyu_battle访问phase_team_list[0]时失败。多间模式必须验证列表长度为
len(ROOM_NAMES)。普通模式必须验证列表长度为 2。识别失败时返回受控失败或受限重试,不要继续选队。建议修复
self.room_teams = shiyu_defense_team_utils.get_team_targets_for_multi_room( self.ctx, self.last_screenshot, '式舆防卫战-三间选择', len(ROOM_NAMES), ) +if len(self.room_teams) != len(ROOM_NAMES): + return self.round_fail('多间模式房间目标识别失败') self.phase_team_list = shiyu_defense_team_utils.get_team_targets( self.ctx, self.last_screenshot, ) +if len(self.phase_team_list) != 2: + return self.round_fail('普通模式阶段目标识别失败')Based on learnings: 多间模式中的 OCR 或区域识别失败必须进入失败路径,不能被解释为已完成房间。
Also applies to: 218-233
🤖 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 202 - 216, 在多间模式处理逻辑中,校验 get_team_targets_for_multi_room 返回的 self.room_teams 长度必须等于 len(ROOM_NAMES),不满足时进入受控失败或受限重试并禁止调用 round_success。同步检查普通模式识别结果,确保队伍列表长度必须为 2;识别结果不完整时同样停止后续选队流程,避免空列表进入 shiyu_battle。Source: Learnings
🤖 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`:
- Line 67: 同步更新 `docs/game/screens/式舆防卫战.md` 中 `ChoosePredefinedTeam`
的扫描规则描述,使其与 `_scan_team_page` 当前实现一致:仅当 `agent_list` 为空且核心技计数缺失或以 `/0`
结尾时停止扫描;识别到 `X/3` 或至少两个槽位标记时仍允许队伍参与评分。删除或改写“任一标记缺失即不可用”和“无头像即停止”等不符合实现的表述。
---
Outside diff comments:
In `@src/zzz_od/application/shiyu_defense/shiyu_defense_app.py`:
- Around line 202-216: 在多间模式处理逻辑中,校验 get_team_targets_for_multi_room 返回的
self.room_teams 长度必须等于 len(ROOM_NAMES),不满足时进入受控失败或受限重试并禁止调用
round_success。同步检查普通模式识别结果,确保队伍列表长度必须为 2;识别结果不完整时同样停止后续选队流程,避免空列表进入
shiyu_battle。
🪄 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: 1a12b29e-27d9-4d3b-89c6-7ca831ccd715
📒 Files selected for processing (4)
docs/game/gameplay/式舆防卫战.mddocs/game/screens/式舆防卫战.mdsrc/zzz_od/application/shiyu_defense/shiyu_defense_app.pysrc/zzz_od/operation/choose_predefined_team.py
🚧 Files skipped from review as they are similar to previous changes (1)
- docs/game/gameplay/式舆防卫战.md
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/zzz_od/operation/choose_predefined_team.py (1)
279-285: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift不要在队名 OCR 失败时压缩游戏列表下标。
Line 285 会跳过该物理卡片,但不会保留其下标。后续
team_idx由next_scanned_team_idx按已识别卡片数量生成。如果任意非空卡片的队名 OCR 失败,后续队伍的下标会提前。选择阶段会据此计算错误的翻页位置和标题区域,并可能点击错误队伍。
请按
current_scroll_page和卡片行列位置计算物理下标。另一种方案是在当前页存在未识别卡片时重试或失败,不要继续使用压缩后的下标。🤖 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 279 - 285, 更新预备编队扫描流程中处理 team_name 或 team_name_mr OCR 失败的分支,确保未识别但非空的物理卡片仍保留其真实下标,不要让后续队伍通过 next_scanned_team_idx 连续压缩。根据 current_scroll_page 及卡片的 title_x/title_y 行列位置计算并传播物理 team_idx;或者在当前页存在未识别卡片时重试或终止,禁止继续使用压缩后的索引。
🤖 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.
Outside diff comments:
In `@src/zzz_od/operation/choose_predefined_team.py`:
- Around line 279-285: 更新预备编队扫描流程中处理 team_name 或 team_name_mr OCR
失败的分支,确保未识别但非空的物理卡片仍保留其真实下标,不要让后续队伍通过 next_scanned_team_idx 连续压缩。根据
current_scroll_page 及卡片的 title_x/title_y 行列位置计算并传播物理
team_idx;或者在当前页存在未识别卡片时重试或终止,禁止继续使用压缩后的索引。
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 06d7e4d5-d660-410d-a6c4-c8c22226d9d2
📒 Files selected for processing (3)
docs/game/screens/式舆防卫战.mdsrc/zzz_od/config/team_config.pysrc/zzz_od/operation/choose_predefined_team.py
1P 2P 3P不是为了判满员,而是判禁用。
你用的ocr是V5还是V6,我反复测试没出现过一次漏读的 |
|
@joshcai @DoctorReid 请求重新审查,请重点复查 这些提交来自游戏内实测,修复范围包括:
这些修复共同保证实测中的扫描、禁用跳过、滚动定位、选择确认和插件入口稳定可用;日志分级仅是最后一项。 |
|
合并前需要删除测试应用 |
|
已按 review 意见处理,fairy 提交了 d02acc9:
另外,配队选择测试应用已删除(c96a41c1),本地留了备份以便后续取用。 |
|
漏读是v6的,画面好像是2560 × 1440,当时看的确挺稳定漏读,可以其他人测测看 |
已经改用新方法 |

变更内容
预备编队扫描与选择
1P、2P、3P任一标记缺失的队伍视为本期被禁用:不参与自动配队评分,但保留游戏列表序号,避免后续有效队伍翻页和点击错位。SELECT后再选择。提交拆分
feat: 式舆防卫战自动配队feat(devtools): 添加配队选择fix: 让按住滑动更加稳定fix: 使用拖动翻页预备编队chore: 增强预备编队扫描日志fix: 跳过被禁用的预备编队fix: 取消预选的预备编队docs: 补充预备编队选择说明revert: 恢复滚轮灵敏度换算验证
py_compile、git diff --check已通过。Summary by CodeRabbit
close #2652