Repository navigation
fix(GeneralBattle): 地域鬼王准备阶段自动开战导致切预设死循环 - #1988
Closed
Enough1122 wants to merge 1 commit into
Closed
Enough1122 wants to merge 1 commit into
Enough1122 wants to merge 1 commit into
Conversation
地鬼(极)点挑战后准备界面只活 2~3 秒就会自动开战,而完整切预设要 4 秒以上; 一旦开战,新版阵容预设面板不会出现确认按钮,_bw_preset_default 的无上限循环 就只剩 O_PRESET/O_PRESET_FULL 的 OCR 空转,直到卡死检测报 GameStuckError → restart ×3 → human takeover(10-29 10:57、10-30 12:06/12:09 都是这个形态)。 - battle_wait: 预设 hook 第一个循环加 6s 超时 + 战斗中逃生,直接放弃切阵容而不是空转 - battle_wait: 新增宽松战斗判定 BATTLE_SOFT_THRESHOLD(0.52),准备阶段已开战时直接结束 (I_BATTLE_INFO 在真战斗里只有 0.57~0.63,原 0.8 阈值判不出来) - battle_wait: 战斗中持续续 BATTLE_STATUS_S,避免战斗超过 60s 无点击被误报卡死 - battle_wait: 预设确认循环超时后 break(原来只 warning,确认按钮点不掉会无限循环) - AreaBoss: 挑战按钮连点守卫,看到准备界面或已开战就交给 battle_wait,避免二次点击提前开战 实机验证:MuMu 上单跑一次 AreaBoss,三只地鬼全部正常结算(386s,TASK_END_OK), 无 Wait too long / GameStuckError。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes #1061
地域鬼王(极)点「挑战」后,准备界面只存活约 2.4~3 秒就会自动开战(全程不点任何按钮也会开打),而完整切预设需要 4 秒以上,永远赶不上。开战后预设面板不会出现确认按钮,
_bw_preset_default里第一个while 1没有出口,只剩O_PRESET/O_PRESET_FULL的 OCR 空转,直到 60 秒后被卡死检测抛GameStuckError: Wait too long,重启三次后人工接管。#1061 的日志就是这个形态:Preset is enable之后刷 60 秒[PRESET] [],然后Wait too long。另外两处放大因素:
start_fight()会连点两次「挑战」,第二次正好落在准备界面的「准备」鼓上(I_FIRE的搜索区1075,463,150,158覆盖该位置),进一步提前开战;handle_control_check()→stuck_record_clear(),把detect_record和长等待计时器一起清掉,于是正常战斗里超过 60 秒没有点击也会误报卡死。改动(2 文件 +60/−4)
battle_wait.py:新增BATTLE_SOFT_THRESHOLD = 0.52、is_in_battle_soft()、keep_battle_long_wait()。I_BATTLE_INFO在真战斗里实测只有 0.570.63(原 0.8 阈值判不出来),准备/详情界面 0.310.43,0.52 落在两者之间;准备阶段判定还要求看不到I_PREPARE_HIGHLIGHT,避免其它任务的准备界面被误判。_bw_preset_default:第一个循环加 6 秒超时和战斗中逃生,两种情况都放弃切阵容并禁用本 hook,而不是无限空转。break(原来只 warning,确认按钮点不掉时会死循环)。battle_wait_with_strategy主循环:战斗中续BATTLE_STATUS_S,长等待保护不再被点击清掉。AreaBoss/script_task.py:start_fight()增加守卫,看到准备界面或已进战斗就停手交给battle_wait。验证
Wait too long/GameStuckError,Win battle×3、Get all reward×3,任务正常TaskEnd。降级路径生效一次:Battle already started, give up switching preset→Prepare stage finish→ 战斗照常打完。is_in_battle_soft=False,战斗帧True,结算帧False,准备界面不会被误判成战斗。说明
地鬼(极)准备界面只有 2~3 秒,切预设在这个窗口里做不到,所以现在优先保证不卡死、放弃切阵容照打。若要给地鬼真正切上阵容,需要单独做一套快速流程(新版阵容预设面板的确认按钮只在选中预设行后出现),不在本 PR 范围。
Sourcery 总结
防止战斗自动开始时 AreaBoss 的准备和预设处理陷入死锁,同时确保能够可靠地监控长时间战斗。
错误修复:
改进:
Original summary in English
Summary by Sourcery
Prevent AreaBoss preparation and preset handling from deadlocking when battles start automatically, while maintaining reliable long-battle monitoring.
Bug Fixes:
Enhancements: