diff --git a/autowsgr/ops/decisive/handlers.py b/autowsgr/ops/decisive/handlers.py index b307f446..738f280c 100644 --- a/autowsgr/ops/decisive/handlers.py +++ b/autowsgr/ops/decisive/handlers.py @@ -122,7 +122,11 @@ def _handle_enter_map(self) -> None: if entry_status == DecisiveEntryStatus.REFRESH: _log.info('[决战] 检测到「重置关卡」状态,执行章节重置') - self._battle_page.reset_chapter() + reset_success = self._battle_page.reset_chapter() + if not reset_success: + # 重置不成功是因为需要解装 + self._state.phase = DecisivePhase.DOCK_FULL + return # 重置后重新检测入口状态 entry_status = self._battle_page.detect_entry_status() diff --git a/autowsgr/ui/decisive/battle_page.py b/autowsgr/ui/decisive/battle_page.py index 71fbc780..4c7c6f7b 100644 --- a/autowsgr/ui/decisive/battle_page.py +++ b/autowsgr/ui/decisive/battle_page.py @@ -18,6 +18,7 @@ import time from typing import TYPE_CHECKING +from autowsgr.image_resources import Templates from autowsgr.infra.logger import get_logger from autowsgr.types import DecisiveEntryStatus, PageName from autowsgr.ui.utils import click_and_wait_for_page, confirm_operation @@ -409,7 +410,7 @@ def detect_entry_status( # ── 章节重置 ───────────────────────────────────────────────────────── - def reset_chapter(self) -> None: + def reset_chapter(self) -> bool: """使用磁盘重置当前章节。 在决战总览页点击"重置关卡"按钮并确认操作。 @@ -423,6 +424,15 @@ def reset_chapter(self) -> None: _log.info('[决战] 决战页面 → 重置关卡') self._ctrl.click(*CLICK_RESET_CHAPTER) time.sleep(1.0) + screen = self._ctrl.screenshot() + if ImageChecker.template_exists( + screen, + Templates.Build.SHIP_FULL_DEPOT, + confidence=0.8, + ): + _log.warning('[决战] 重置关卡时检测到船坞已满') + return False confirm_operation(self._ctrl, must_confirm=True, timeout=5.0) time.sleep(1.0) # 防止后续 stage 识别出问题 _log.info('[决战] 决战关卡重置完成') + return True