StarRailCopilot/campaign/campaign_main/campaign_1_1.py
LmeSzinc 6b56215d71 Fix: 修复地图特效导致的章节名识别错误和进图等待
- 章节名识别错误时有20次重试的机会
- 进图时不再使用章节图标识别
- 更改了exception文件的位置
2020-04-25 17:10:22 +08:00

53 lines
1.3 KiB
Python

from module.campaign.campaign_base import CampaignBase
from module.map.map_base import CampaignMap
from module.map.map_grids import SelectedGrids, RoadGrids
from module.logger import logger
MAP = CampaignMap()
MAP.shape = 'G1'
MAP.map_data = '''
SP -- -- -- -- ME MB
'''
MAP.spawn_data = [
{'battle': 0, 'enemy': 1},
{'battle': 1, 'boss': 1},
]
A1, B1, C1, D1, E1, F1, G1, \
= MAP.flatten()
class Config:
FLEET_2 = 0
SUBMARINE = 0
INTERNAL_LINES_FIND_PEAKS_PARAMETERS = {
'height': (120, 255 - 40),
'width': (1.5, 10),
'prominence': 10,
'distance': 35,
}
EDGE_LINES_FIND_PEAKS_PARAMETERS = {
'height': (255 - 40, 255),
'prominence': 10,
'distance': 50,
'wlen': 1000
}
INTERNAL_LINES_HOUGHLINES_THRESHOLD = 40
EDGE_LINES_HOUGHLINES_THRESHOLD = 40
class Campaign(CampaignBase):
MAP = MAP
def battle_0(self):
return self.battle_default()
def battle_1(self):
return self.clear_boss()
def handle_boss_appear_refocus(self):
for data in self.map.spawn_data:
if data.get('battle') == self.battle_count and data.get('boss', 0):
self.map_swipe((-3, 0))
return super().handle_boss_appear_refocus()