mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-23 00:52:22 +00:00
Add: 适配穹顶下的圣咏曲B1D1
- 修复精英舰队挡住弹药图标导致无法到达的问题 - 修复丢失预测导致的log报错 - 增加载入精英模板 - 修复碰磁BOSS
This commit is contained in:
parent
a2ad24048e
commit
87608f2879
BIN
assets/template/TEMPLATE_SIREN_Algerie.png
Normal file
BIN
assets/template/TEMPLATE_SIREN_Algerie.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.8 KiB |
BIN
assets/template/TEMPLATE_SIREN_LaGalissonniere.png
Normal file
BIN
assets/template/TEMPLATE_SIREN_LaGalissonniere.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.6 KiB |
53
campaign/event_20200521_cn/b1.py
Normal file
53
campaign/event_20200521_cn/b1.py
Normal file
@ -0,0 +1,53 @@
|
||||
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.map_data = '''
|
||||
-- -- ++ ++ -- --
|
||||
-- -- ++ ++ -- --
|
||||
++ -- -- -- -- --
|
||||
-- -- -- -- ++ --
|
||||
-- -- -- -- -- --
|
||||
++ ++ -- -- -- --
|
||||
++ -- -- -- ++ --
|
||||
-- -- -- -- -- --
|
||||
-- -- -- -- -- --
|
||||
'''
|
||||
MAP.camera_data = ['C3', 'C5', 'C7']
|
||||
|
||||
|
||||
class Config:
|
||||
SUBMARINE = 0
|
||||
FLEET_BOSS = 1
|
||||
|
||||
POOR_MAP_DATA = True
|
||||
MAP_HAS_AMBUSH = False
|
||||
MAP_HAS_FLEET_STEP = True
|
||||
MAP_HAS_MOVABLE_ENEMY = True
|
||||
MAP_HAS_SIREN = True
|
||||
MAP_HAS_DYNAMIC_RED_BORDER = False
|
||||
MAP_HAS_MAP_STORY = True
|
||||
MAP_SIREN_TEMPLATE = ['Algerie', 'LaGalissonniere']
|
||||
MAP_SIREN_COUNT = 2
|
||||
|
||||
TRUST_EDGE_LINES = False
|
||||
COINCIDENT_POINT_ENCOURAGE_DISTANCE = 1.5
|
||||
INTERNAL_LINES_FIND_PEAKS_PARAMETERS = {
|
||||
'height': (100, 235),
|
||||
'width': 1,
|
||||
'prominence': 10,
|
||||
'distance': 35,
|
||||
}
|
||||
EDGE_LINES_FIND_PEAKS_PARAMETERS = {
|
||||
'height': (255 - 80, 255),
|
||||
'prominence': 2,
|
||||
'distance': 50,
|
||||
'wlen': 1000
|
||||
}
|
||||
|
||||
|
||||
class Campaign(CampaignBase):
|
||||
MAP = MAP
|
81
campaign/event_20200521_cn/d1.py
Normal file
81
campaign/event_20200521_cn/d1.py
Normal file
@ -0,0 +1,81 @@
|
||||
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.map_data = '''
|
||||
-- ME ++ ++ -- ME
|
||||
ME ME ++ ++ ME ME
|
||||
++ -- MB MB -- --
|
||||
ME -- ME ME ++ ME
|
||||
ME MS -- -- ME ME
|
||||
++ ++ MS -- MS ME
|
||||
++ MS -- ME ++ ME
|
||||
ME -- SP -- ME --
|
||||
ME -- SP SP -- ME
|
||||
'''
|
||||
MAP.weight_data = """
|
||||
50 50 50 50 50 50
|
||||
40 40 40 40 40 40
|
||||
40 40 10 10 40 40
|
||||
30 20 20 20 30 50
|
||||
30 20 20 20 30 50
|
||||
30 30 20 20 30 50
|
||||
30 20 20 20 30 50
|
||||
50 20 20 20 30 50
|
||||
50 20 20 20 20 50
|
||||
"""
|
||||
MAP.camera_data = ['C3', 'C5', 'C7']
|
||||
MAP.spawn_data = [
|
||||
{'battle': 0, 'enemy': 2, 'siren': 2},
|
||||
{'battle': 1, 'enemy': 1},
|
||||
{'battle': 2, 'enemy': 2},
|
||||
{'battle': 3, 'enemy': 1},
|
||||
{'battle': 4, 'enemy': 2},
|
||||
{'battle': 5, 'enemy': 1, 'boss': 1},
|
||||
]
|
||||
|
||||
|
||||
class Config:
|
||||
SUBMARINE = 0
|
||||
FLEET_BOSS = 2
|
||||
|
||||
POOR_MAP_DATA = True
|
||||
MAP_HAS_AMBUSH = False
|
||||
MAP_HAS_FLEET_STEP = True
|
||||
MAP_HAS_MOVABLE_ENEMY = True
|
||||
MAP_HAS_SIREN = True
|
||||
MAP_HAS_DYNAMIC_RED_BORDER = False
|
||||
MAP_HAS_MAP_STORY = True
|
||||
MAP_SIREN_TEMPLATE = ['Algerie', 'LaGalissonniere']
|
||||
MAP_SIREN_COUNT = 2
|
||||
|
||||
TRUST_EDGE_LINES = False
|
||||
COINCIDENT_POINT_ENCOURAGE_DISTANCE = 1.5
|
||||
INTERNAL_LINES_FIND_PEAKS_PARAMETERS = {
|
||||
'height': (100, 235),
|
||||
'width': 1,
|
||||
'prominence': 10,
|
||||
'distance': 35,
|
||||
}
|
||||
EDGE_LINES_FIND_PEAKS_PARAMETERS = {
|
||||
'height': (255 - 80, 255),
|
||||
'prominence': 2,
|
||||
'distance': 50,
|
||||
'wlen': 1000
|
||||
}
|
||||
|
||||
|
||||
class Campaign(CampaignBase):
|
||||
MAP = MAP
|
||||
|
||||
def battle_0(self):
|
||||
if self.clear_siren():
|
||||
return True
|
||||
|
||||
return self.battle_default()
|
||||
|
||||
def battle_5(self):
|
||||
return self.fleet_2.brute_clear_boss()
|
@ -203,6 +203,7 @@ class AzurLaneConfig:
|
||||
MAP_HAS_DYNAMIC_RED_BORDER = False
|
||||
MAP_HAS_MAP_STORY = False # event_20200521_cn(穹顶下的圣咏曲) adds after-combat story.
|
||||
MAP_SIREN_MOVE_WAIT = 1.5 # The enemy moving takes about 1.2 ~ 1.5s.
|
||||
MAP_SIREN_TEMPLATE = ['1', '2', '3']
|
||||
MAP_SIREN_COUNT = 0
|
||||
MAP_MYSTERY_HAS_CARRIER = False
|
||||
MAP_GRID_CENTER_TOLERANCE = 0.1
|
||||
|
@ -158,7 +158,7 @@ class Fleet(Camera, MapOperation, AmbushHandler):
|
||||
raise MapWalkError('walk_out_of_step')
|
||||
|
||||
# Arrive
|
||||
if self.is_in_map() and grid.predict_fleet():
|
||||
if self.is_in_map() and (grid.predict_fleet() or grid.predict_current_fleet()):
|
||||
if not arrive_timer.started():
|
||||
logger.info(f'Arrive {location2node(location)}')
|
||||
arrive_timer.start()
|
||||
|
@ -82,10 +82,10 @@ class GridInfo:
|
||||
return key
|
||||
|
||||
if self.is_siren:
|
||||
return ''.join([text[0] for text in self.enemy_type.split('_')]).upper()
|
||||
return ''.join([text[0] for text in self.enemy_type.split('_')]).upper() if self.enemy_type else 'SU'
|
||||
|
||||
if self.is_enemy:
|
||||
return '%s%s' % (self.enemy_scale, self.enemy_type[0].upper())
|
||||
return '%s%s' % (self.enemy_scale, self.enemy_type[0].upper()) if self.enemy_type else '0E'
|
||||
|
||||
dic = {
|
||||
'FL': 'is_current_fleet',
|
||||
@ -142,13 +142,15 @@ class GridInfo:
|
||||
flag &= not self.is_cleared
|
||||
if flag:
|
||||
self.__setattr__('is_' + item, True)
|
||||
# self.is_enemy = True
|
||||
# self.enemy_scale = 0
|
||||
self.enemy_type = info.enemy_type
|
||||
return True
|
||||
else:
|
||||
logger.info(f'Wrong Prediction. Grid: {self}, Attr: is_{item}')
|
||||
|
||||
if info.is_enemy:
|
||||
flag = not info.is_fleet and not self.is_fleet
|
||||
flag = not info.is_fleet and not self.is_fleet and not self.is_siren
|
||||
if not is_carrier_scan:
|
||||
if not ignore_may:
|
||||
flag &= self.may_enemy
|
||||
|
@ -12,14 +12,15 @@ class GridPredictor:
|
||||
ENEMY_PERSPECTIVE_IMAGE_SIZE = (50, 50)
|
||||
RED_BORDER_IGNORE_TOP = 10
|
||||
DIC_ENEMY_TYPE = {
|
||||
'Siren_1': TEMPLATE_SIREN_1,
|
||||
'Siren_2': TEMPLATE_SIREN_2,
|
||||
'Siren_3': TEMPLATE_SIREN_3,
|
||||
# 'Siren_1': TEMPLATE_SIREN_1,
|
||||
# 'Siren_2': TEMPLATE_SIREN_2,
|
||||
# 'Siren_3': TEMPLATE_SIREN_3,
|
||||
'Light': TEMPLATE_ENEMY_LIGHT,
|
||||
'Main': TEMPLATE_ENEMY_MAIN,
|
||||
'Carrier': TEMPLATE_ENEMY_CARRIER,
|
||||
'Treasure': TEMPLATE_ENEMY_TREASURE,
|
||||
}
|
||||
SIREN_TEMPLATE_LOADED = False
|
||||
|
||||
def __init__(self, location, image, corner, config):
|
||||
"""
|
||||
@ -254,6 +255,11 @@ class GridPredictor:
|
||||
|
||||
def predict_enemy_type(self):
|
||||
image = self.get_relative_image((-1, -1, 1, 0), output_shape=(120, 60))
|
||||
if not self.SIREN_TEMPLATE_LOADED:
|
||||
for name in self.config.MAP_SIREN_TEMPLATE:
|
||||
self.DIC_ENEMY_TYPE[f'Siren_{name}'] = globals().get(f'TEMPLATE_SIREN_{name}')
|
||||
self.SIREN_TEMPLATE_LOADED = True
|
||||
|
||||
for name, template in self.DIC_ENEMY_TYPE.items():
|
||||
if not self.config.MAP_HAS_SIREN and name.startswith('Siren'):
|
||||
continue
|
||||
|
@ -255,7 +255,8 @@ class Map(Fleet):
|
||||
grids = grids.sort(cost=True, weight=True)
|
||||
logger.info('Grid: %s' % str(grid))
|
||||
self.clear_chosen_enemy(grid)
|
||||
if self.battle_count >= battle_count:
|
||||
if self.battle_count > battle_count:
|
||||
logger.info('Boss guessing correct.')
|
||||
return True
|
||||
else:
|
||||
logger.info('Boss guessing incorrect.')
|
||||
|
@ -164,7 +164,7 @@ class CampaignMap:
|
||||
spawn = {'battle': 0, 'enemy': 0, 'mystery': 0, 'siren': 0, 'boss': 0}
|
||||
for data in data_list:
|
||||
spawn['battle'] = data['battle']
|
||||
spawn['enemy'] += data.get('enemy', 0) + data.get('siren', 0)
|
||||
spawn['enemy'] += data.get('enemy', 0)
|
||||
spawn['mystery'] += data.get('mystery', 0)
|
||||
spawn['siren'] += data.get('siren', 0)
|
||||
spawn['boss'] += data.get('boss', 0)
|
||||
@ -343,7 +343,7 @@ class CampaignMap:
|
||||
except IndexError:
|
||||
missing = self.spawn_data[-1].copy()
|
||||
may = {'enemy': 0, 'mystery': 0, 'siren': 0, 'boss': 0, 'carrier': 0}
|
||||
missing['enemy'] -= battle_count
|
||||
missing['enemy'] -= battle_count - siren_count
|
||||
missing['mystery'] -= mystery_count
|
||||
missing['siren'] -= siren_count
|
||||
missing['carrier'] = carrier_count - self.select(is_enemy=True, may_enemy=False).count
|
||||
|
@ -23,5 +23,7 @@ TEMPLATE_MAP_WALK_OUT_OF_STEP = Template(file='./assets/template/TEMPLATE_MAP_WA
|
||||
TEMPLATE_SIREN_1 = Template(file='./assets/template/TEMPLATE_SIREN_1.png')
|
||||
TEMPLATE_SIREN_2 = Template(file='./assets/template/TEMPLATE_SIREN_2.png')
|
||||
TEMPLATE_SIREN_3 = Template(file='./assets/template/TEMPLATE_SIREN_3.png')
|
||||
TEMPLATE_SIREN_Algerie = Template(file='./assets/template/TEMPLATE_SIREN_Algerie.png')
|
||||
TEMPLATE_SIREN_LaGalissonniere = Template(file='./assets/template/TEMPLATE_SIREN_LaGalissonniere.png')
|
||||
TEMPLATE_STAGE_CLEAR = Template(file='./assets/template/TEMPLATE_STAGE_CLEAR.png')
|
||||
TEMPLATE_STAGE_PERCENT = Template(file='./assets/template/TEMPLATE_STAGE_PERCENT.png')
|
||||
|
Loading…
Reference in New Issue
Block a user