Skip to content

feat: 支持战斗中切换后援队伍&诺姆战斗模板 - #2364

Merged
ShadowLemoon merged 8 commits into
OneDragon-Anything:mainfrom
kawayiYokami:main
Jun 21, 2026
Merged

feat: 支持战斗中切换后援队伍&诺姆战斗模板#2364
ShadowLemoon merged 8 commits into
OneDragon-Anything:mainfrom
kawayiYokami:main

Conversation

@kawayiYokami

@kawayiYokami kawayiYokami commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

发布说明

  • New Features
    • 新增战斗中“切换后援”按钮识别与按键触发(就绪状态写入;停止时同步松开)。
    • 新增角色“诺姆(NORMA)”,补齐预热识别与自动战斗操作/连段示例。
    • 扩展“诺姆”在自动守护、站场与强攻速切中的支援、闪避与连携换人衔接,并完善切到下一角色流程。
  • Bug Fixes
    • 增强识别可靠性:当某帧未识别到任何角色时自动切换为强制全量重新识别。
  • Documentation
    • 更新自动战斗补充说明:完善“切换后援”检测与按钮匹配写入规则。

@coderabbitai

coderabbitai Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 8343b3ad-7df2-4211-b9e8-4806df6e489e

📥 Commits

Reviewing files that changed from the base of the PR and between 8d4950b and e8dcc89.

📒 Files selected for processing (1)
  • src/zzz_od/config/game_config.py

📝 Walkthrough

Walkthrough

本 PR 新增"切换后援"按键(默认 R)的完整识别与执行链路,包括枚举、配置、屏幕区域、模板匹配检测及原子操作;同时引入诺姆角色数据及其六套操作模板与速切状态处理器;并为角色循环切换模式下的零识别帧场景新增全量重识别兜底逻辑。

Changes

切换后援 & 诺姆角色自动战斗

Layer / File(s) Summary
状态枚举、按键配置与控制器方法
src/zzz_od/auto_battle/auto_battle_state.py, src/zzz_od/config/game_config.py, src/zzz_od/controller/zzz_pc_controller.py, src/zzz_od/game_data/agent.py
BattleStateEnum 新增 BTN_SWITCH_BACKUPSTATUS_SWITCH_BACKUP_READYGameKeyAction 新增 SWITCH_BACKUP 及键鼠/Xbox/DS4 默认键位;ZPcController 新增 switch_backup 方法;AgentEnum 新增 NORMA 成员。
屏幕区域定义与模板配置
assets/game_data/screen_info/battle.yml, assets/game_data/screen_info/_od_merged.yml, assets/template/agent_state/norma_3_1/config.yml
battle.yml 及合并配置新增按键-切换后援与按键-切换后援标记两个识别区域;新增诺姆状态模板 norma_3_1/config.ymlcommission_assistant 中两个区域补全匹配参数字段结构。
切换后援检测与执行(AutoBattleContext)
src/zzz_od/auto_battle/auto_battle_context.py
新增互斥锁、间隔与计时字段;check_switch_backuparea_btn_switch_backup 区域做节流模板匹配并写入状态;switch_backup 执行按键并发送 overlay 事件;check_battle_state 并行任务中加入 check_switch_backupstop_context 释放时调用 switch_backup(release=True)
角色零识别帧全量重识别兜底
src/zzz_od/auto_battle/auto_battle_agent_context.py
TeamInfo 新增 request_check_all_agents()check_agent_related 在识别结果全为空时触发该方法并重置计时;新增 _should_force_check_all_agents() 判断逻辑。
AtomicBtnCommon 分派切换后援
src/zzz_od/auto_battle/atomic_op/btn_common.py
分派链新增 BTN_SWITCH_BACKUPctx.switch_backup;调整 Callable 导入来源;循环变量重命名为 _i
诺姆操作模板配置
config/auto_battle_operation/诺姆-*.sample.yml
新增强化特殊攻击、支援攻击、普通攻击合轴、终结技、连携攻击、长按普攻六套操作样例,每份定义设置状态 + 按键 + 等待序列。
诺姆速切模板与战斗状态处理器集成
config/auto_battle_state_handler/速切模板-诺姆.sample.yml, config/auto_battle_state_handler/速切模板-全角色.sample.yml, config/auto_battle_state_handler/速切模板-耀嘉音.sample.yml, config/auto_battle_state_handler/轮换-合轴-全角色.sample.yml, config/auto_battle/全配队通用.sample.yml, config/auto_battle/全配队通用.merged.yml, config/auto_battle/击破站场-强攻速切.merged.yml, config/auto_battle/强攻站场-击破支援速切.merged.yml, config/auto_battle/自动守护.merged.yml
新增速切模板-诺姆完整处理器;速切模板-全角色引入诺姆模板;耀嘉音模板追加切换下一个角色;轮换合轴加入诺姆特殊技可用分支;全配队通用 sample/merged 新增切换后援可用场景触发器;三份 merged 配置新增前台-诺姆 完整处理分支,覆盖终结技强制释放、黄光切人、红光闪避、连携换人、诺姆预热等多种状态衔接与按键输出。
自动战斗补充说明文档
docs/develop/zzz/auto_battle.md
新增角色识别兜底策略及切换后援按键检测与执行规则的说明。

Sequence Diagram(s)

sequenceDiagram
  participant 战斗状态检测
  participant 切换后援检测
  participant 屏幕区域截取
  participant 状态记录
  participant 原子操作
  participant 控制器

  rect rgba(135, 206, 235, 0.5)
    Note over 战斗状态检测,状态记录: 周期性检测切换后援按键可用性
    战斗状态检测->>切换后援检测: check_battle_state 并行提交
    切换后援检测->>切换后援检测: 非阻塞锁 + 节流判断
    切换后援检测->>屏幕区域截取: 截取 area_btn_switch_backup
    屏幕区域截取-->>切换后援检测: 模板匹配结果
    切换后援检测->>状态记录: 写入 STATUS_SWITCH_BACKUP_READY
  end

  rect rgba(144, 238, 144, 0.5)
    Note over 原子操作,控制器: 原子操作执行切换后援动作
    原子操作->>战斗状态检测: ctx.switch_backup(press/release)
    战斗状态检测->>控制器: controller.switch_backup
    战斗状态检测->>状态记录: 写入 BTN_SWITCH_BACKUP
    战斗状态检测->>战斗状态检测: 发送 overlay 动作事件
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested reviewers

  • Usagi-wusaqi

Poem

🐰 兔兔跳进战场里,
后援切换 R 键按,
诺姆加入小队伍,
合轴终结一气呵成~
零识别帧不再慌,
全量重查来兜底,
✨ 一龙出击无死角!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 73.91% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Pull request标题清晰准确地概括了两个核心改动:支持战斗中切换后援队伍和诺姆战斗模板,与changeset中新增的配置、模板和代码完全对应。
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 and usage tips.

@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

🧹 Nitpick comments (1)
src/zzz_od/auto_battle/auto_battle_context.py (1)

302-302: ⚡ Quick win

为新增方法补充返回类型注解

switch_backup 是新增方法,建议补上 -> None 以满足当前类型标注规则。

💡 建议修复
-    def switch_backup(self, press: bool = False, press_time: float | None = None, release: bool = False):
+    def switch_backup(self, press: bool = False, press_time: float | None = None, release: bool = False) -> None:
As per coding guidelines, `**/*.py`: “All functions and methods must include type hints (Type Hints)”.
🤖 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/auto_battle/auto_battle_context.py` at line 302, The switch_backup
method is missing a return type annotation, which violates the coding guidelines
requiring all functions and methods to include type hints. Add the return type
annotation -> None to the method signature of switch_backup to indicate that
this method does not return a value.

Source: Coding guidelines

🤖 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 `@src/zzz_od/auto_battle/auto_battle_agent_context.py`:
- Around line 398-412: Update the type annotations in the
_should_force_check_all_agents method signature to use modern Python 3.11+
built-in generic types. Replace the capital-letter versions List and Tuple with
their lowercase equivalents list and tuple respectively. The parameter
screen_agent_list should be annotated with list[tuple[Agent | None, str | None]]
instead of List[Tuple[Agent | None, str | None]].

In `@src/zzz_od/auto_battle/auto_battle_context.py`:
- Around line 302-314: The switch_backup method now supports press and release
operations, but the shutdown or stop procedure is missing a corresponding call
to release the backup key. When the backup key is pressed during long-press
operation and the system stops, the key remains in a pressed state causing input
stability issues. Locate the stop or shutdown process (around line 1008 area in
the file) and add a call to switch_backup(release=True) to ensure the backup key
is properly released during system shutdown, completing the full lifecycle of
the key press operation.

---

Nitpick comments:
In `@src/zzz_od/auto_battle/auto_battle_context.py`:
- Line 302: The switch_backup method is missing a return type annotation, which
violates the coding guidelines requiring all functions and methods to include
type hints. Add the return type annotation -> None to the method signature of
switch_backup to indicate that this method does not return a value.
🪄 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

Run ID: 775ca990-ab48-4ae3-9533-71efe661cee9

📥 Commits

Reviewing files that changed from the base of the PR and between ace2ccb and 9234ae9.

⛔ Files ignored due to path filters (18)
  • assets/template/agent_state/norma_3_1/mask.png is excluded by !**/*.png
  • assets/template/agent_state/norma_3_1/raw.png is excluded by !**/*.png
  • assets/template/battle/avatar_1_norma/mask.png is excluded by !**/*.png
  • assets/template/battle/avatar_1_norma/raw.png is excluded by !**/*.png
  • assets/template/battle/avatar_2_norma/mask.png is excluded by !**/*.png
  • assets/template/battle/avatar_2_norma/raw.png is excluded by !**/*.png
  • assets/template/battle/avatar_chain_norma/mask.png is excluded by !**/*.png
  • assets/template/battle/avatar_chain_norma/raw.png is excluded by !**/*.png
  • assets/template/battle/avatar_quick_norma/mask.png is excluded by !**/*.png
  • assets/template/battle/avatar_quick_norma/raw.png is excluded by !**/*.png
  • assets/template/battle/btn_switch_backup_1/mask.png is excluded by !**/*.png
  • assets/template/battle/btn_switch_backup_1/raw.png is excluded by !**/*.png
  • assets/template/battle/btn_switch_backup_2/mask.png is excluded by !**/*.png
  • assets/template/battle/btn_switch_backup_2/raw.png is excluded by !**/*.png
  • assets/template/hollow/avatar_norma/mask.png is excluded by !**/*.png
  • assets/template/hollow/avatar_norma/raw.png is excluded by !**/*.png
  • assets/template/predefined_team/avatar_norma/mask.png is excluded by !**/*.png
  • assets/template/predefined_team/avatar_norma/raw.png is excluded by !**/*.png
📒 Files selected for processing (23)
  • assets/game_data/screen_info/_od_merged.yml
  • assets/game_data/screen_info/battle.yml
  • assets/template/agent_state/norma_3_1/config.yml
  • config/auto_battle/全配队通用.merged.yml
  • config/auto_battle/全配队通用.sample.yml
  • config/auto_battle_operation/诺姆-强化特殊攻击.sample.yml
  • config/auto_battle_operation/诺姆-支援攻击.sample.yml
  • config/auto_battle_operation/诺姆-普通攻击合轴.sample.yml
  • config/auto_battle_operation/诺姆-终结技.sample.yml
  • config/auto_battle_operation/诺姆-连携攻击.sample.yml
  • config/auto_battle_operation/诺姆-长按普攻.sample.yml
  • config/auto_battle_state_handler/轮换-合轴-全角色.sample.yml
  • config/auto_battle_state_handler/速切模板-全角色.sample.yml
  • config/auto_battle_state_handler/速切模板-耀嘉音.sample.yml
  • config/auto_battle_state_handler/速切模板-诺姆.sample.yml
  • docs/develop/zzz/auto_battle.md
  • src/zzz_od/auto_battle/atomic_op/btn_common.py
  • src/zzz_od/auto_battle/auto_battle_agent_context.py
  • src/zzz_od/auto_battle/auto_battle_context.py
  • src/zzz_od/auto_battle/auto_battle_state.py
  • src/zzz_od/config/game_config.py
  • src/zzz_od/controller/zzz_pc_controller.py
  • src/zzz_od/game_data/agent.py

Comment on lines +398 to +412
def _should_force_check_all_agents(self, screen_agent_list: List[Tuple[Agent | None, str | None]]) -> bool:
"""
当前处于战斗画面,但一个角色都识别不到时,下一次强制重新全量识别。
这样可以兼容战斗内队伍循环切换的新模式,同时避免常驻全量识别带来的性能压力。
"""
if self.team_info.should_check_all_agents:
return False

for agent, _ in screen_agent_list:
if agent is not None:
return False

log.debug('当前识别不到任何角色,下一次截图强制重新识别所有角色')
return True

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.

🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

使用现代类型注解语法

根据代码规范,src/**/*.py 文件应使用 Python 3.11+ 的内置泛型类型注解。第 398 行的函数签名使用了 List[Tuple[...]],应改为 list[tuple[...]]

♻️ 建议的修改
-    def _should_force_check_all_agents(self, screen_agent_list: List[Tuple[Agent | None, str | None]]) -> bool:
+    def _should_force_check_all_agents(self, screen_agent_list: list[tuple[Agent | None, str | None]]) -> bool:
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
def _should_force_check_all_agents(self, screen_agent_list: List[Tuple[Agent | None, str | None]]) -> bool:
"""
当前处于战斗画面但一个角色都识别不到时下一次强制重新全量识别
这样可以兼容战斗内队伍循环切换的新模式同时避免常驻全量识别带来的性能压力
"""
if self.team_info.should_check_all_agents:
return False
for agent, _ in screen_agent_list:
if agent is not None:
return False
log.debug('当前识别不到任何角色,下一次截图强制重新识别所有角色')
return True
def _should_force_check_all_agents(self, screen_agent_list: list[tuple[Agent | None, str | None]]) -> bool:
"""
当前处于战斗画面但一个角色都识别不到时下一次强制重新全量识别
这样可以兼容战斗内队伍循环切换的新模式同时避免常驻全量识别带来的性能压力
"""
if self.team_info.should_check_all_agents:
return False
for agent, _ in screen_agent_list:
if agent is not None:
return False
log.debug('当前识别不到任何角色,下一次截图强制重新识别所有角色')
return True
🧰 Tools
🪛 Ruff (0.15.17)

[warning] 400-400: Docstring contains ambiguous (FULLWIDTH COMMA). Did you mean , (COMMA)?

(RUF002)


[warning] 400-400: Docstring contains ambiguous (FULLWIDTH COMMA). Did you mean , (COMMA)?

(RUF002)


[warning] 401-401: Docstring contains ambiguous (FULLWIDTH COMMA). Did you mean , (COMMA)?

(RUF002)


[warning] 410-410: String contains ambiguous (FULLWIDTH COMMA). Did you mean , (COMMA)?

(RUF001)

🤖 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/auto_battle/auto_battle_agent_context.py` around lines 398 - 412,
Update the type annotations in the _should_force_check_all_agents method
signature to use modern Python 3.11+ built-in generic types. Replace the
capital-letter versions List and Tuple with their lowercase equivalents list and
tuple respectively. The parameter screen_agent_list should be annotated with
list[tuple[Agent | None, str | None]] instead of List[Tuple[Agent | None, str |
None]].

Source: Coding guidelines

Comment thread src/zzz_od/auto_battle/auto_battle_context.py
Comment on lines +398 to +402
def _should_force_check_all_agents(self, screen_agent_list: List[Tuple[Agent | None, str | None]]) -> bool:
"""
当前处于战斗画面,但一个角色都识别不到时,下一次强制重新全量识别。
这样可以兼容战斗内队伍循环切换的新模式,同时避免常驻全量识别带来的性能压力。
"""

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

终结技、连携期间也识别不到吧,会不会加大性能压力

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这部分识别压力几乎就跟没有差不多,动画期间一直识别不会有影响

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

终结技期间不属于战斗画面

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

战斗画面是有攻击键的

@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: 6

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
config/auto_battle/击破站场-强攻速切.merged.yml (1)

5131-5135: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

切人前先松开前进键。

Line 5131 按下了 按键-移动-前-按下,Line 5135 直接切到下一个角色;如果不先松开,后续角色会继承前进输入,影响后续自动战斗节奏。

建议修复
           - "op_name": "按键-特殊攻击"
             "post_delay": 0.1
             "repeat": 3
+          - "op_name": "按键-移动-前-松开"
           - "op_name": "按键-切换角色-下一个"
🤖 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 `@config/auto_battle/击破站场-强攻速切.merged.yml` around lines 5131 - 5135, The
forward movement key (按键-移动-前-按下) is pressed down but never released before
switching to the next character (按键-切换角色-下一个). This causes the next character to
inherit the ongoing forward input, disrupting the battle sequence. Add a key
release operation for the forward movement (按键-移动-前-按起) between the special
attack repeat operations and the character switch operation to ensure the input
is properly released before the character transition occurs.
config/auto_battle/强攻站场-击破支援速切.merged.yml (1)

4200-4204: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

切人前先释放前进键。

Line 4204 和 Line 13681 新增切人时,前面仍保持 按键-移动-前-按下,没有对应 按键-移动-前-松开;切到下一名角色后可能继续带着前进输入。

建议修复
       - "op_name": "按键-特殊攻击"
         "post_delay": 0.1
         "repeat": 3
+      - "op_name": "按键-移动-前-松开"
       - "op_name": "按键-切换角色-下一个"

请在两处耀嘉音分支中同步添加释放操作。

Also applies to: 13677-13681

🤖 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 `@config/auto_battle/强攻站场-击破支援速切.merged.yml` around lines 4200 - 4204, The
forward movement key press (按键-移动-前-按下) is not being released before switching
to the next character (按键-切换角色-下一个) at lines around 4204 and 13681, which causes
the forward movement input to persist after the character switch. Add the
corresponding release action (按键-移动-前-松开) immediately before the character
switch operation in both locations to ensure the movement input is properly
cleared when switching characters.
config/auto_battle/自动守护.merged.yml (1)

4160-4164: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

切人前先释放前进键。

这里先执行了 按键-移动-前-按下,新增的 按键-切换角色-下一个 会在没有对应 按键-移动-前-松开 的情况下切走,容易让下一个角色继承前进按住状态。

建议修复
         - "op_name": "按键-特殊攻击"
           "post_delay": 0.1
           "repeat": 3
+        - "op_name": "按键-移动-前-松开"
         - "op_name": "按键-切换角色-下一个"
🤖 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 `@config/auto_battle/自动守护.merged.yml` around lines 4160 - 4164, The current
sequence presses the forward movement key with "按键-移动-前-按下" but never releases
it before switching characters with "按键-切换角色-下一个". This causes the next
character to inherit the held forward key state. Add a "按键-移动-前-松开" operation
between the "按键-特殊攻击" operation (with its post_delay and repeat settings) and
the "按键-切换角色-下一个" operation to properly release the forward movement key before
switching characters.
🤖 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 `@config/auto_battle/全配队通用.merged.yml`:
- Around line 2047-2056: The interval value of 0.1 seconds for the "切换后援可用"
action is too frequent compared to the upstream state throttling of the
"按键可用-切换后援" trigger which operates at second-level intervals, causing the
"按键-切换后援" operation to potentially execute multiple times within the same state
window. Fix this by increasing the interval value on line 2053 from 0.1 to at
least 1.0 seconds to align with the upstream state update frequency, or
alternatively add an additional debounce condition (such as checking if a recent
switch action was already performed) in the states condition to prevent repeated
rapid triggers.

In `@config/auto_battle/击破站场-强攻速切.merged.yml`:
- Line 10575: The states field on line 10575 uses square bracket syntax [诺姆-预热,
80, 100] which attempts to match by time window, but when matching 诺姆-预热 as a
character resource value, it should use curly brace syntax for numeric ranges
instead. Change the states field from the square bracket syntax to use curly
braces with the numeric interval {80, 100} to properly trigger the heating
branch logic as intended.
- Around line 10541-10575: The operations sequences are missing corresponding
release actions for their press operations. In the special attack sequence
starting around line 10544, after the last "等待秒数" operation with 0.5 seconds,
add a "按键-特殊攻击-松开" operation to release the key. In the normal attack sequence
starting around line 10561, after the last "等待秒数" operation with 0.5 seconds and
before the final "设置状态" operation for "自定义-合轴时间", add a "按键-普通攻击-松开" operation
to release the key. This ensures that each press operation has a corresponding
release operation before the branch ends, preventing the pressed state from
carrying over to subsequent handlers.

In `@config/auto_battle/强攻站场-击破支援速切.merged.yml`:
- Around line 9609-9644: The special skill available condition `[诺姆-特殊技可用]` is
currently ordered before the warm-up exit condition `[诺姆-预热, 80, 100]`, causing
the special skill branch to execute and prevent the `自定义-合轴时间` state from being
set. Reorder the two operations blocks so that the condition with `[诺姆-预热, 80,
100]` appears before the condition with `[诺姆-特殊技可用]` to ensure the warm-up exit
branch takes priority when the warm-up is full. Make this reordering change in
both locations: around line 9625 and around line 19102.
- Around line 9610-9644: The special attack and normal attack branches are using
press-type key operations (`按键-特殊攻击-按下` and `按键-普通攻击-按下`) without corresponding
release operations (`松开`). This causes the key state to persist into the next
handler, affecting subsequent actions. Add a release operation (`按键-特殊攻击-松开` or
`按键-普通攻击-松开`) after each corresponding press operation in both the special
attack sequence and the normal attack sequence. Apply the same fix to the
duplicate branch mentioned at lines 19087-19121. Alternatively, if the intent is
to tap repeatedly rather than hold, replace the press operations with the
non-press versions that do not include the `-按下` suffix.

In `@config/auto_battle/自动守护.merged.yml`:
- Around line 9602-9604: Replace the string reference "诺姆-预热" in the states
configuration value with appropriate numerical values for range judgment instead
of using the constant name. The current configuration is being parsed as a time
window (80~100 seconds) when the constant reference is encountered, causing the
warm-up branch logic to not trigger as expected. Update the states field at
lines 9602-9604 to use direct numerical values that properly represent the
intended range judgment for the "自定义-合轴时间" state.

---

Outside diff comments:
In `@config/auto_battle/击破站场-强攻速切.merged.yml`:
- Around line 5131-5135: The forward movement key (按键-移动-前-按下) is pressed down
but never released before switching to the next character (按键-切换角色-下一个). This
causes the next character to inherit the ongoing forward input, disrupting the
battle sequence. Add a key release operation for the forward movement
(按键-移动-前-按起) between the special attack repeat operations and the character
switch operation to ensure the input is properly released before the character
transition occurs.

In `@config/auto_battle/强攻站场-击破支援速切.merged.yml`:
- Around line 4200-4204: The forward movement key press (按键-移动-前-按下) is not
being released before switching to the next character (按键-切换角色-下一个) at lines
around 4204 and 13681, which causes the forward movement input to persist after
the character switch. Add the corresponding release action (按键-移动-前-松开)
immediately before the character switch operation in both locations to ensure
the movement input is properly cleared when switching characters.

In `@config/auto_battle/自动守护.merged.yml`:
- Around line 4160-4164: The current sequence presses the forward movement key
with "按键-移动-前-按下" but never releases it before switching characters with
"按键-切换角色-下一个". This causes the next character to inherit the held forward key
state. Add a "按键-移动-前-松开" operation between the "按键-特殊攻击" operation (with its
post_delay and repeat settings) and the "按键-切换角色-下一个" operation to properly
release the forward movement key before switching characters.
🪄 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

Run ID: ffff7d8d-9190-44e1-ae71-2a7a2a50e54d

📥 Commits

Reviewing files that changed from the base of the PR and between 9234ae9 and eebcec1.

📒 Files selected for processing (5)
  • config/auto_battle/全配队通用.merged.yml
  • config/auto_battle/击破站场-强攻速切.merged.yml
  • config/auto_battle/强攻站场-击破支援速切.merged.yml
  • config/auto_battle/自动守护.merged.yml
  • src/zzz_od/auto_battle/auto_battle_context.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/zzz_od/auto_battle/auto_battle_context.py

Comment on lines +2047 to +2056
- "debug_name": "切换后援可用"
"operations":
- "op_name": "按键-切换后援"
- "op_name": "等待秒数"
"seconds": 0.1
"states": "![自定义-终结技被强制释放, 0, 1]"
"interval": 0.1
"priority": 70
"triggers":
- "按键可用-切换后援"

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.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

切换后援触发频率与状态刷新节流不一致,可能导致连发切换。

Line 2053 将 interval 设为 0.1,但该触发器依赖的 按键可用-切换后援 状态在上游是按秒级节流更新;在同一状态窗口内会重复执行 按键-切换后援,容易出现多次误切。建议把执行节流对齐到 >=1 秒,或增加“最近已切换后援”防抖条件。

建议修改
-  "interval": 0.1
+  "interval": 1.0
-    "states": "![自定义-终结技被强制释放, 0, 1]"
+    "states": "![自定义-终结技被强制释放, 0, 1] & ![按键-切换后援, 0, 0.8]"
🤖 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 `@config/auto_battle/全配队通用.merged.yml` around lines 2047 - 2056, The interval
value of 0.1 seconds for the "切换后援可用" action is too frequent compared to the
upstream state throttling of the "按键可用-切换后援" trigger which operates at
second-level intervals, causing the "按键-切换后援" operation to potentially execute
multiple times within the same state window. Fix this by increasing the interval
value on line 2053 from 0.1 to at least 1.0 seconds to align with the upstream
state update frequency, or alternatively add an additional debounce condition
(such as checking if a recent switch action was already performed) in the states
condition to prevent repeated rapid triggers.

Comment on lines +10541 to +10575
- "op_name": "设置状态"
"seconds": 2.5
"state": "自定义-动作不打断"
- "op_name": "按键-特殊攻击-按下"
- "op_name": "等待秒数"
"seconds": 0.5
- "op_name": "按键-特殊攻击-按下"
- "op_name": "等待秒数"
"seconds": 0.5
- "op_name": "按键-特殊攻击-按下"
- "op_name": "等待秒数"
"seconds": 0.5
- "op_name": "按键-特殊攻击-按下"
- "op_name": "等待秒数"
"seconds": 0.5
"states": "[诺姆-特殊技可用]"
- "operations":
- "op_name": "设置状态"
"seconds": 2
"state": "自定义-动作不打断"
- "op_name": "按键-普通攻击-按下"
- "op_name": "等待秒数"
"seconds": 0.5
- "op_name": "按键-普通攻击-按下"
- "op_name": "等待秒数"
"seconds": 0.5
- "op_name": "按键-普通攻击-按下"
- "op_name": "等待秒数"
"seconds": 0.5
- "op_name": "按键-普通攻击-按下"
- "op_name": "等待秒数"
"seconds": 0.5
- "op_name": "设置状态"
"state": "自定义-合轴时间"
"states": "[诺姆-预热, 80, 100]"

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.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

补齐 按下 操作的释放动作。

Line 10544-10555 和 Line 10561-10570 都使用了 *-按下,但分支结束前没有对应 *-松开;后续 handler 可能在特殊攻击/普通攻击仍保持按下状态时执行。

建议修复
           - "op_name": "按键-特殊攻击-按下"
           - "op_name": "等待秒数"
             "seconds": 0.5
+          - "op_name": "按键-特殊攻击-松开"
           "states": "[诺姆-特殊技可用]"
@@
           - "op_name": "设置状态"
             "state": "自定义-合轴时间"
+          - "op_name": "按键-普通攻击-松开"
-          "states": "[诺姆-预热, 80, 100]"
+          "states": "[诺姆-预热]{80, 100}"
🤖 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 `@config/auto_battle/击破站场-强攻速切.merged.yml` around lines 10541 - 10575, The
operations sequences are missing corresponding release actions for their press
operations. In the special attack sequence starting around line 10544, after the
last "等待秒数" operation with 0.5 seconds, add a "按键-特殊攻击-松开" operation to release
the key. In the normal attack sequence starting around line 10561, after the
last "等待秒数" operation with 0.5 seconds and before the final "设置状态" operation for
"自定义-合轴时间", add a "按键-普通攻击-松开" operation to release the key. This ensures that
each press operation has a corresponding release operation before the branch
ends, preventing the pressed state from carrying over to subsequent handlers.

"seconds": 0.5
- "op_name": "设置状态"
"state": "自定义-合轴时间"
"states": "[诺姆-预热, 80, 100]"

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.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

使用数值区间语法匹配 诺姆-预热

Line 10575 现在写成 [诺姆-预热, 80, 100],这会按状态时间窗口匹配;诺姆-预热 作为角色资源值时应使用 {80, 100},否则预热分支基本不会按预期触发。

建议修复
-          "states": "[诺姆-预热, 80, 100]"
+          "states": "[诺姆-预热]{80, 100}"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"states": "[诺姆-预热, 80, 100]"
"states": "[诺姆-预热]{80, 100}"
🤖 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 `@config/auto_battle/击破站场-强攻速切.merged.yml` at line 10575, The states field on
line 10575 uses square bracket syntax [诺姆-预热, 80, 100] which attempts to match
by time window, but when matching 诺姆-预热 as a character resource value, it should
use curly brace syntax for numeric ranges instead. Change the states field from
the square bracket syntax to use curly braces with the numeric interval {80,
100} to properly trigger the heating branch logic as intended.

Comment on lines +9609 to +9644
- "operations":
- "op_name": "设置状态"
"seconds": 2.5
"state": "自定义-动作不打断"
- "op_name": "按键-特殊攻击-按下"
- "op_name": "等待秒数"
"seconds": 0.5
- "op_name": "按键-特殊攻击-按下"
- "op_name": "等待秒数"
"seconds": 0.5
- "op_name": "按键-特殊攻击-按下"
- "op_name": "等待秒数"
"seconds": 0.5
- "op_name": "按键-特殊攻击-按下"
- "op_name": "等待秒数"
"seconds": 0.5
"states": "[诺姆-特殊技可用]"
- "operations":
- "op_name": "设置状态"
"seconds": 2
"state": "自定义-动作不打断"
- "op_name": "按键-普通攻击-按下"
- "op_name": "等待秒数"
"seconds": 0.5
- "op_name": "按键-普通攻击-按下"
- "op_name": "等待秒数"
"seconds": 0.5
- "op_name": "按键-普通攻击-按下"
- "op_name": "等待秒数"
"seconds": 0.5
- "op_name": "按键-普通攻击-按下"
- "op_name": "等待秒数"
"seconds": 0.5
- "op_name": "设置状态"
"state": "自定义-合轴时间"
"states": "[诺姆-预热, 80, 100]"

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.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

避免特殊技分支吞掉诺姆预热退出分支。

Line 9625/Line 19102 的 [诺姆-特殊技可用] 排在 [诺姆-预热, 80, 100] 前面;预热已满且特殊技仍可用时,会优先进入特殊技分支,导致后面的 自定义-合轴时间 分支无法触发。

建议修复
-      "states": "[诺姆-特殊技可用]"
+      "states": "[诺姆-特殊技可用] & ![诺姆-预热, 80, 100]"

请在 Line 9625 和 Line 19102 两处同步修改;或者把 诺姆-预热 分支整体移到特殊技分支之前。

Also applies to: 19086-19121

🤖 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 `@config/auto_battle/强攻站场-击破支援速切.merged.yml` around lines 9609 - 9644, The
special skill available condition `[诺姆-特殊技可用]` is currently ordered before the
warm-up exit condition `[诺姆-预热, 80, 100]`, causing the special skill branch to
execute and prevent the `自定义-合轴时间` state from being set. Reorder the two
operations blocks so that the condition with `[诺姆-预热, 80, 100]` appears before
the condition with `[诺姆-特殊技可用]` to ensure the warm-up exit branch takes priority
when the warm-up is full. Make this reordering change in both locations: around
line 9625 and around line 19102.

Comment on lines +9610 to +9644
- "op_name": "设置状态"
"seconds": 2.5
"state": "自定义-动作不打断"
- "op_name": "按键-特殊攻击-按下"
- "op_name": "等待秒数"
"seconds": 0.5
- "op_name": "按键-特殊攻击-按下"
- "op_name": "等待秒数"
"seconds": 0.5
- "op_name": "按键-特殊攻击-按下"
- "op_name": "等待秒数"
"seconds": 0.5
- "op_name": "按键-特殊攻击-按下"
- "op_name": "等待秒数"
"seconds": 0.5
"states": "[诺姆-特殊技可用]"
- "operations":
- "op_name": "设置状态"
"seconds": 2
"state": "自定义-动作不打断"
- "op_name": "按键-普通攻击-按下"
- "op_name": "等待秒数"
"seconds": 0.5
- "op_name": "按键-普通攻击-按下"
- "op_name": "等待秒数"
"seconds": 0.5
- "op_name": "按键-普通攻击-按下"
- "op_name": "等待秒数"
"seconds": 0.5
- "op_name": "按键-普通攻击-按下"
- "op_name": "等待秒数"
"seconds": 0.5
- "op_name": "设置状态"
"state": "自定义-合轴时间"
"states": "[诺姆-预热, 80, 100]"

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.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

补齐按下类按键的释放操作。

诺姆的特殊攻击和预热普攻分支都使用了 按键-*-按下,但分支结束前没有 按键-*-松开;按键状态可能残留到下一个 handler,影响后续普攻/切人。

建议修复
       - "op_name": "按键-特殊攻击-按下"
       - "op_name": "等待秒数"
         "seconds": 0.5
+      - "op_name": "按键-特殊攻击-松开"
       "states": "[诺姆-特殊技可用]"
       - "op_name": "按键-普通攻击-按下"
       - "op_name": "等待秒数"
         "seconds": 0.5
+      - "op_name": "按键-普通攻击-松开"
       - "op_name": "设置状态"
         "state": "自定义-合轴时间"

同样需要在 Line 19087-19121 的重复分支中同步补齐;如果这里想表达的是连点而不是长按,也可以改用不带 按下按键-特殊攻击 / 按键-普通攻击

Also applies to: 19087-19121

🤖 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 `@config/auto_battle/强攻站场-击破支援速切.merged.yml` around lines 9610 - 9644, The
special attack and normal attack branches are using press-type key operations
(`按键-特殊攻击-按下` and `按键-普通攻击-按下`) without corresponding release operations (`松开`).
This causes the key state to persist into the next handler, affecting subsequent
actions. Add a release operation (`按键-特殊攻击-松开` or `按键-普通攻击-松开`) after each
corresponding press operation in both the special attack sequence and the normal
attack sequence. Apply the same fix to the duplicate branch mentioned at lines
19087-19121. Alternatively, if the intent is to tap repeatedly rather than hold,
replace the press operations with the non-press versions that do not include the
`-按下` suffix.

Comment on lines +9602 to +9604
- "op_name": "设置状态"
"state": "自定义-合轴时间"
"states": "[诺姆-预热, 80, 100]"

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.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

把“诺姆-预热”改为数值范围判断。

诺姆-预热src/zzz_od/game_data/agent.py:535-539FOREGROUND_COLOR_RANGE_LENGTH,且 max_length=100;当前 [诺姆-预热, 80, 100] 会被解析成状态存在 80~100 秒的时间窗口,预热分支基本不会按预期触发。

建议修复
-        "states": "[诺姆-预热, 80, 100]"
+        "states": "[诺姆-预热]{80, 100}"
🤖 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 `@config/auto_battle/自动守护.merged.yml` around lines 9602 - 9604, Replace the
string reference "诺姆-预热" in the states configuration value with appropriate
numerical values for range judgment instead of using the constant name. The
current configuration is being parsed as a time window (80~100 seconds) when the
constant reference is encountered, causing the warm-up branch logic to not
trigger as expected. Update the states field at lines 9602-9604 to use direct
numerical values that properly represent the intended range judgment for the
"自定义-合轴时间" state.

Comment thread src/zzz_od/config/game_config.py Outdated
Comment on lines +83 to +101
@@ -95,6 +98,7 @@ class GameKeyAction(Enum):
'dodge': Ds4ButtonEnum.CROSS.value.value,
'switch_next': Ds4ButtonEnum.R1.value.value,
'switch_prev': Ds4ButtonEnum.L1.value.value,
'switch_backup': Ds4ButtonEnum.TOUCHPAD.value.value,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这俩按键默认值是不是不对,我记得应该不是back

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我没手柄,你改

@ShadowLemoon
ShadowLemoon merged commit 09800eb into OneDragon-Anything:main Jun 21, 2026
7 of 8 checks passed
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Jun 24, 2026
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