Fix: rare bugs

- Fix roadblocks in 6-4
- Fix mis-detect BATTLE_STATUS_D when battle executing
- Add call details to popup
This commit is contained in:
LmeSzinc 2020-06-12 19:23:45 +08:00
parent 24a00f095e
commit a623e7d082
3 changed files with 26 additions and 14 deletions

View File

@ -46,7 +46,7 @@ road_boss = RoadGrids([
[A5, B6], [A4, B5, B6], C4, C5, [C3, D4], D3, # A6 - D3 [A5, B6], [A4, B5, B6], C4, C5, [C3, D4], D3, # A6 - D3
[C5, D3], # D5 - D3 [C5, D3], # D5 - D3
[B1, B2], [B1, C2], [C1, C2], [C2, D1], [C2, D2], # A2 - 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
]) ])

View File

@ -10,6 +10,13 @@ class ExerciseCombat(HpDaemon, OpponentChoose, ExerciseEquipment):
def _in_exercise(self): def _in_exercise(self):
return self.appear(NEW_OPPONENT) 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): def _combat_preparation(self):
logger.info('Combat preparation') logger.info('Combat preparation')
while 1: while 1:
@ -40,6 +47,7 @@ class ExerciseCombat(HpDaemon, OpponentChoose, ExerciseEquipment):
while 1: while 1:
self.device.screenshot() self.device.screenshot()
if not self.is_combat_executing():
# Finish - S or D rank # Finish - S or D rank
if self.appear_then_click(BATTLE_STATUS_S): if self.appear_then_click(BATTLE_STATUS_S):
success = True success = True

View File

@ -43,18 +43,22 @@ class InfoHandler(ModuleBase):
""" """
_popup_offset = (3, 30) _popup_offset = (3, 30)
def handle_popup_confirm(self): def handle_popup_confirm(self, name=''):
if self.appear(POPUP_CANCEL, offset=self._popup_offset) \ if self.appear(POPUP_CANCEL, offset=self._popup_offset) \
and self.appear(POPUP_CONFIRM, offset=self._popup_offset, interval=2): and self.appear(POPUP_CONFIRM, offset=self._popup_offset, interval=2):
POPUP_CONFIRM.name = POPUP_CONFIRM.name + '_' + name
self.device.click(POPUP_CONFIRM) self.device.click(POPUP_CONFIRM)
POPUP_CONFIRM.name = POPUP_CONFIRM.name[:-len(name) - 1]
return True return True
else: else:
return False return False
def handle_popup_cancel(self): def handle_popup_cancel(self, name=''):
if self.appear(POPUP_CONFIRM, offset=self._popup_offset) \ if self.appear(POPUP_CONFIRM, offset=self._popup_offset) \
and self.appear(POPUP_CANCEL, offset=self._popup_offset, interval=2): and self.appear(POPUP_CANCEL, offset=self._popup_offset, interval=2):
POPUP_CANCEL.name = POPUP_CANCEL.name + '_' + name
self.device.click(POPUP_CANCEL) self.device.click(POPUP_CANCEL)
POPUP_CANCEL.name = POPUP_CANCEL.name[:-len(name) - 1]
return True return True
else: else:
return False return False
@ -83,7 +87,7 @@ class InfoHandler(ModuleBase):
if not self.config.IGNORE_LOW_EMOTION_WARN: if not self.config.IGNORE_LOW_EMOTION_WARN:
return False return False
return self.handle_popup_confirm() return self.handle_popup_confirm('IGNORE_LOW_EMOTION')
""" """
Story Story