diff --git a/module/campaign/campaign_ocr.py b/module/campaign/campaign_ocr.py index e5fa445b0..0af1809d9 100644 --- a/module/campaign/campaign_ocr.py +++ b/module/campaign/campaign_ocr.py @@ -45,6 +45,9 @@ def separate_name(name): elif name[0] in 'abcdef': return name[0], name[-1] + logger.warning(f'Unknown stage name: {name}') + return name[0], name[1:] + class CampaignOcr: stage = {} @@ -137,7 +140,7 @@ class CampaignOcr: self.stage = {} buttons = self.extract_campaign_name_image(image) - ocr = Ocr(buttons, lang='stage') + ocr = Ocr(buttons, lang='stage', letter=(255, 255, 255), back=(102, 102, 102), threshold=180) result = ocr.ocr(image) if not isinstance(result, list): result = [result] diff --git a/module/config/config.py b/module/config/config.py index a90b1f242..21f2d7ab0 100644 --- a/module/config/config.py +++ b/module/config/config.py @@ -198,7 +198,7 @@ class AzurLaneConfig: MAP_HAS_MOVABLE_ENEMY = False MAP_HAS_SIREN = False MAP_HAS_DYNAMIC_RED_BORDER = False - MAP_SIREN_MOVE_WAIT = 1.8 # The enemy moving takes about 1.5 ~ 1.8s. + MAP_SIREN_MOVE_WAIT = 1.5 # The enemy moving takes about 1.2 ~ 1.5s. MAP_SIREN_COUNT = 0 MAP_MYSTERY_HAS_CARRIER = False MAP_GRID_CENTER_TOLERANCE = 0.1 diff --git a/module/handler/enemy_searching.py b/module/handler/enemy_searching.py index 0cecf7fad..46658d933 100644 --- a/module/handler/enemy_searching.py +++ b/module/handler/enemy_searching.py @@ -9,6 +9,7 @@ from module.map.exception import CampaignEnd class EnemySearchingHandler(InfoBarHandler): MAP_ENEMY_SEARCHING_OVERLAY_TRANSPARENCY_THRESHOLD = 0.5 # Usually (0.70, 0.80). MAP_ENEMY_SEARCHING_TIMEOUT_SECOND = 4.5 + in_stage_timer = Timer(1) def enemy_searching_color_initial(self): MAP_ENEMY_SEARCHING.load_color(self.device.image) @@ -23,11 +24,12 @@ class EnemySearchingHandler(InfoBarHandler): def handle_in_stage(self): if self.is_in_stage(): - logger.info('In stage.') - # self.device.sleep(0.5) - self.ensure_no_info_bar(timeout=1.2) - raise CampaignEnd('In stage.') + if self.in_stage_timer.reached(): + logger.info('In stage.') + self.ensure_no_info_bar(timeout=1.2) + raise CampaignEnd('In stage.') else: + self.in_stage_timer.reset() return False def is_in_stage(self): diff --git a/module/handler/fast_forward.py b/module/handler/fast_forward.py index 94c423311..eeaa2584b 100644 --- a/module/handler/fast_forward.py +++ b/module/handler/fast_forward.py @@ -17,15 +17,16 @@ class FastForwardHandler(ModuleBase): def handle_fast_forward(self): if not self.appear(MAP_STAR_1) or not self.appear(MAP_STAR_2) or not self.appear(MAP_STAR_3): + self.config.ENABLE_FAST_FORWARD = False logger.info('Campaign is not 3-star cleared.') return False if not self.appear(MAP_GREEN): + self.config.ENABLE_FAST_FORWARD = False logger.info('Campaign is not green sea.') return False if not fast_forward.appear(main=self): self.config.ENABLE_FAST_FORWARD = False - self.config.MAP_HAS_AMBUSH = True logger.info('No fast forward mode.') return False diff --git a/module/map/fleet.py b/module/map/fleet.py index 68b011692..c6fe7663b 100644 --- a/module/map/fleet.py +++ b/module/map/fleet.py @@ -100,7 +100,7 @@ class Fleet(Camera, MapOperation, AmbushHandler): arrived = False # Wait to confirm fleet arrived. It does't appear immediately if fleet in combat . add = self.config.MAP_SIREN_MOVE_WAIT * self.config.MAP_SIREN_COUNT \ - if not self.config.ENABLE_FAST_FORWARD else 0 + if self.config.MAP_HAS_MOVABLE_ENEMY and not self.config.ENABLE_FAST_FORWARD else 0 arrive_timer = Timer(0.3 + add) arrive_unexpected_timer = Timer(1.5 + add) # Wait after ambushed.