Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion autowsgr/ops/decisive/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
12 changes: 11 additions & 1 deletion autowsgr/ui/decisive/battle_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -409,7 +410,7 @@ def detect_entry_status(

# ── 章节重置 ─────────────────────────────────────────────────────────

def reset_chapter(self) -> None:
def reset_chapter(self) -> bool:
"""使用磁盘重置当前章节。

在决战总览页点击"重置关卡"按钮并确认操作。
Expand All @@ -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