From 784a8715144e960611f54dcb803e04834c3cc6e1 Mon Sep 17 00:00:00 2001 From: sui-feng-cb <2518179942@qq.com> Date: Sun, 21 Jun 2026 02:40:44 +0800 Subject: [PATCH] Fix: handle low emotion combat withdraw after sinking --- module/combat/auto_search_combat.py | 12 +++++++++++- module/combat/combat.py | 11 ++++++++++- module/raid/combat.py | 8 +------- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/module/combat/auto_search_combat.py b/module/combat/auto_search_combat.py index a55b900ab..36d97edd4 100644 --- a/module/combat/auto_search_combat.py +++ b/module/combat/auto_search_combat.py @@ -355,6 +355,7 @@ class AutoSearchCombat(MapOperation, Combat, CampaignStatus): confirm_timer = Timer(10) confirm_timer.start() + exp_confirm_timer = Timer(1, count=2) for _ in self.loop(): if self.handle_submarine_call(submarine_mode, call=force_call): @@ -397,6 +398,13 @@ class AutoSearchCombat(MapOperation, Combat, CampaignStatus): self.device.click(OPTS_INFO_D) confirm_timer.reset() continue + if self.appear(EXP_INFO_C) or self.appear(EXP_INFO_D): + if exp_confirm_timer.reached(): + self._sinking = True + break + continue + else: + exp_confirm_timer.reset() if self.appear(BATTLE_STATUS_S) or self.appear(BATTLE_STATUS_A) or self.appear(BATTLE_STATUS_B) \ or self.appear(EXP_INFO_S) or self.appear(EXP_INFO_A) or self.appear(EXP_INFO_B) \ or self.appear(GET_MISSION) or self.is_auto_search_running(): @@ -467,9 +475,11 @@ class AutoSearchCombat(MapOperation, Combat, CampaignStatus): continue if self.handle_popup_confirm('combat_status'): continue - if self.handle_exp_info(): + if self.handle_exp_info(handle_fail=True): exp_info = True continue + if self.appear_then_click(OPTS_INFO_D, offset=(30, 30), interval=2): + continue def auto_search_combat(self, emotion_reduce=None, fleet_index=1, battle=None): """ diff --git a/module/combat/combat.py b/module/combat/combat.py index 72e69d960..40f76a324 100644 --- a/module/combat/combat.py +++ b/module/combat/combat.py @@ -487,8 +487,10 @@ class Combat(Level, HPBalancer, Retirement, SubmarineCall, CombatAuto, CombatMan return False - def handle_exp_info(self): + def handle_exp_info(self, handle_fail=False): """ + Args: + handle_fail (bool): if handle EXP_INFO_C and EXP_INFO_D Returns: bool: """ @@ -503,6 +505,13 @@ class Combat(Level, HPBalancer, Retirement, SubmarineCall, CombatAuto, CombatMan if self.appear_then_click(EXP_INFO_B): self.device.sleep((0.25, 0.5)) return True + if handle_fail: + if self.appear_then_click(EXP_INFO_C): + self.device.sleep((0.25, 0.5)) + return True + if self.appear_then_click(EXP_INFO_D): + self.device.sleep((0.25, 0.5)) + return True return False diff --git a/module/raid/combat.py b/module/raid/combat.py index 7d36f7fb7..2c76f4f0c 100644 --- a/module/raid/combat.py +++ b/module/raid/combat.py @@ -47,13 +47,7 @@ class RaidCombat(Combat): """ if self.is_combat_executing(): return False - if super().handle_exp_info(): - return True - if self.appear_then_click(EXP_INFO_C): - self.device.sleep((0.25, 0.5)) - return True - if self.appear_then_click(EXP_INFO_D): - self.device.sleep((0.25, 0.5)) + if super().handle_exp_info(handle_fail=True): return True if self.appear_then_click(EXP_INFO_CF): self.device.sleep((0.25, 0.5))