Fix: 修复

- 优化章节名OCR, 防止地图特效影响识别
- 修复等待精英移动
- 修复回到出击界面
This commit is contained in:
LmeSzinc 2020-04-24 17:57:40 +08:00
parent bea05d396e
commit 604cdf4005
5 changed files with 14 additions and 8 deletions

View File

@ -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]

View File

@ -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

View File

@ -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):

View File

@ -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

View File

@ -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.