diff --git a/campaign/campaign_main/campaign_6_4.py b/campaign/campaign_main/campaign_6_4.py index fc99d9c1c..acb8855f5 100644 --- a/campaign/campaign_main/campaign_6_4.py +++ b/campaign/campaign_main/campaign_6_4.py @@ -46,7 +46,7 @@ road_boss = RoadGrids([ [A5, B6], [A4, B5, B6], C4, C5, [C3, D4], D3, # A6 - D3 [C5, D3], # D5 - D3 [B1, B2], [B1, C2], [C1, C2], [C2, D1], [C2, D2], # A2 - D3 - [H3, G2], [G3, G4], [F3, G4], [F3, F4], [F2, F3, E4], [E2, F3, E4], E3 # H4 - D3 + [H3, G4], [G3, G4], [F3, G4], [F3, F4], [F2, F3, E4], [E2, F3, E4], E3 # H4 - D3 ]) diff --git a/module/exercise/combat.py b/module/exercise/combat.py index b771560ee..cafed9cd1 100644 --- a/module/exercise/combat.py +++ b/module/exercise/combat.py @@ -10,6 +10,13 @@ class ExerciseCombat(HpDaemon, OpponentChoose, ExerciseEquipment): def _in_exercise(self): return self.appear(NEW_OPPONENT) + def is_combat_executing(self): + """ + Returns: + bool: + """ + return self.appear(PAUSE) and np.max(self.device.image.crop(PAUSE_DOUBLE_CHECK.area)) < 153 + def _combat_preparation(self): logger.info('Combat preparation') while 1: @@ -40,16 +47,17 @@ class ExerciseCombat(HpDaemon, OpponentChoose, ExerciseEquipment): while 1: self.device.screenshot() - # Finish - S or D rank - if self.appear_then_click(BATTLE_STATUS_S): - success = True - end = True - continue - if self.appear_then_click(BATTLE_STATUS_D): - success = True - end = True - logger.info("Exercise LOST") - continue + if not self.is_combat_executing(): + # Finish - S or D rank + if self.appear_then_click(BATTLE_STATUS_S): + success = True + end = True + continue + if self.appear_then_click(BATTLE_STATUS_D): + success = True + end = True + logger.info("Exercise LOST") + continue if self.appear_then_click(GET_ITEMS_1): continue if self.appear_then_click(EXP_INFO_S): diff --git a/module/handler/info_handler.py b/module/handler/info_handler.py index ba84a3e91..1dc784aec 100644 --- a/module/handler/info_handler.py +++ b/module/handler/info_handler.py @@ -43,18 +43,22 @@ class InfoHandler(ModuleBase): """ _popup_offset = (3, 30) - def handle_popup_confirm(self): + def handle_popup_confirm(self, name=''): if self.appear(POPUP_CANCEL, offset=self._popup_offset) \ and self.appear(POPUP_CONFIRM, offset=self._popup_offset, interval=2): + POPUP_CONFIRM.name = POPUP_CONFIRM.name + '_' + name self.device.click(POPUP_CONFIRM) + POPUP_CONFIRM.name = POPUP_CONFIRM.name[:-len(name) - 1] return True else: return False - def handle_popup_cancel(self): + def handle_popup_cancel(self, name=''): if self.appear(POPUP_CONFIRM, offset=self._popup_offset) \ and self.appear(POPUP_CANCEL, offset=self._popup_offset, interval=2): + POPUP_CANCEL.name = POPUP_CANCEL.name + '_' + name self.device.click(POPUP_CANCEL) + POPUP_CANCEL.name = POPUP_CANCEL.name[:-len(name) - 1] return True else: return False @@ -83,7 +87,7 @@ class InfoHandler(ModuleBase): if not self.config.IGNORE_LOW_EMOTION_WARN: return False - return self.handle_popup_confirm() + return self.handle_popup_confirm('IGNORE_LOW_EMOTION') """ Story