From acf73f5c17b96c743846130ba8b06a0e36121ab0 Mon Sep 17 00:00:00 2001 From: LmeSzinc Date: Thu, 7 May 2020 19:55:06 +0800 Subject: [PATCH] =?UTF-8?q?Fix:=20=E4=BF=AE=E5=A4=8D=E5=A4=9C=E5=B9=95?= =?UTF-8?q?=E4=B8=8B=E7=9A=84=E5=BD=92=E9=80=94SP2=E7=9A=84BOSS=E5=88=B7?= =?UTF-8?q?=E6=96=B0=E7=82=B9=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修复brute_clear_boss找不到BOSS时卡住的问题 --- campaign/campaign_main/campaign_7_1.py | 21 +++++++++++++++++++-- campaign/event_20200507_cn/sp2.py | 2 +- campaign/event_20200507_cn/sp3.py | 5 +++++ module/map/map.py | 18 +++++++++++------- 4 files changed, 36 insertions(+), 10 deletions(-) diff --git a/campaign/campaign_main/campaign_7_1.py b/campaign/campaign_main/campaign_7_1.py index d78a87c9c..a2ed136c6 100644 --- a/campaign/campaign_main/campaign_7_1.py +++ b/campaign/campaign_main/campaign_7_1.py @@ -16,8 +16,25 @@ MAP.camera_data = ['D2', 'E2'] class Config: SUBMARINE = 0 POOR_MAP_DATA = True - INTERNAL_LINES_HOUGHLINES_THRESHOLD = 40 - EDGE_LINES_HOUGHLINES_THRESHOLD = 40 + + INTERNAL_LINES_HOUGHLINES_THRESHOLD = 30 + EDGE_LINES_HOUGHLINES_THRESHOLD = 30 + MID_DIFF_RANGE_H = (140 - 3, 140 + 3) + MID_DIFF_RANGE_V = (143 - 3, 143 + 3) + + INTERNAL_LINES_FIND_PEAKS_PARAMETERS = { + 'height': (150, 255 - 24), + 'width': (0.5, 20), + 'prominence': 10, + 'distance': 35, + 'wlen': 100, + } + EDGE_LINES_FIND_PEAKS_PARAMETERS = { + 'height': (255 - 24, 255), + 'prominence': 10, + 'distance': 50, + 'wlen': 1000 + } class Campaign(CampaignBase): diff --git a/campaign/event_20200507_cn/sp2.py b/campaign/event_20200507_cn/sp2.py index f1a9cb513..e1bc4c758 100644 --- a/campaign/event_20200507_cn/sp2.py +++ b/campaign/event_20200507_cn/sp2.py @@ -10,7 +10,7 @@ MAP.map_data = ''' -- -- ++ ++ -- ME -- ++ ++ ME -- ME ME ++ ++ ME -- ME -- ME -- ME ME -- MB -- MB -- -- -- -- -- -- - ++ -- MB -- MB __ ME ++ ++ ME ++ + ++ -- MB MB -- __ ME ++ ++ ME ++ SP -- ME -- ME -- -- ++ ME -- ME SP SP ++ ++ ++ ME -- -- -- -- ME ''' diff --git a/campaign/event_20200507_cn/sp3.py b/campaign/event_20200507_cn/sp3.py index b080c8e9a..0c6da7c7d 100644 --- a/campaign/event_20200507_cn/sp3.py +++ b/campaign/event_20200507_cn/sp3.py @@ -35,6 +35,11 @@ class Campaign(CampaignBase): MAP = MAP def battle_0(self): + if self.clear_enemy(scale=(2,)): + return True + if self.clear_enemy(scale=(1,)): + return True + return self.battle_default() def battle_5(self): diff --git a/module/map/map.py b/module/map/map.py index 24d5edd41..04a548df7 100644 --- a/module/map/map.py +++ b/module/map/map.py @@ -240,9 +240,7 @@ class Map(Fleet): self.clear_chosen_enemy(grids[0]) logger.warning('BOSS not detected, trying all boss spawn point.') - self.clear_potential_boss() - - return False + return self.clear_potential_boss() def clear_potential_boss(self): """ @@ -250,13 +248,19 @@ class Map(Fleet): """ grids = self.map.select(may_boss=True, is_accessible=True) logger.info('May boss: %s' % self.map.select(may_boss=True)) + battle_count = self.battle_count for grid in grids: - logger.hr('Clear BOSS') + logger.hr('Clear potential BOSS') grids = grids.sort(cost=True, weight=True) logger.info('Grid: %s' % str(grid)) self.clear_chosen_enemy(grid) - logger.info('Boss guessing incorrect.') + if self.battle_count >= battle_count: + return True + else: + logger.info('Boss guessing incorrect.') + + return False def brute_clear_boss(self): """ @@ -278,8 +282,8 @@ class Map(Fleet): else: return self.fleet_boss.clear_boss() else: - logger.warning('No boss found.') - return False + logger.warning('BOSS not detected, trying all boss spawn point.') + return self.clear_potential_boss() def brute_fleet_meet(self): """