mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-23 09:01:45 +00:00
Optimize: 优化复刻苍红的回响C2和D3
- 修改了绿海时的地图设置覆盖
This commit is contained in:
parent
f9b2a9358b
commit
f5ee202934
@ -6,15 +6,32 @@ from campaign.event_20200423_cn.c1 import Config
|
|||||||
|
|
||||||
MAP = CampaignMap()
|
MAP = CampaignMap()
|
||||||
MAP.map_data = '''
|
MAP.map_data = '''
|
||||||
|
-- -- ME -- ME -- MB
|
||||||
|
ME -- -- ++ ++ ++ --
|
||||||
|
-- ME __ -- ME ME --
|
||||||
|
ME -- ++ MS -- -- --
|
||||||
-- -- -- -- -- -- --
|
-- -- -- -- -- -- --
|
||||||
-- -- -- ++ ++ ++ --
|
SP -- -- -- ME ++ --
|
||||||
-- -- -- -- -- -- --
|
SP SP -- ME -- ++ MB
|
||||||
-- -- ++ -- -- -- --
|
|
||||||
-- -- -- -- -- -- --
|
|
||||||
SP -- -- -- -- ++ --
|
|
||||||
SP SP -- -- -- ++ --
|
|
||||||
'''
|
'''
|
||||||
|
MAP.camera_data = ['D3', 'D5']
|
||||||
|
MAP.spawn_data = [
|
||||||
|
{'battle': 0, 'enemy': 2, 'siren': 1},
|
||||||
|
{'battle': 1, 'enemy': 1},
|
||||||
|
{'battle': 2, 'enemy': 2},
|
||||||
|
{'battle': 3, 'enemy': 1},
|
||||||
|
{'battle': 4, 'enemy': 1, 'boss': 1},
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
class Campaign(CampaignBase):
|
class Campaign(CampaignBase):
|
||||||
MAP = MAP
|
MAP = MAP
|
||||||
|
|
||||||
|
def battle_0(self):
|
||||||
|
if self.clear_siren():
|
||||||
|
return True
|
||||||
|
|
||||||
|
return self.battle_default()
|
||||||
|
|
||||||
|
def battle_4(self):
|
||||||
|
return self.brute_clear_boss()
|
@ -2,7 +2,7 @@ from module.campaign.campaign_base import CampaignBase
|
|||||||
from module.map.map_base import CampaignMap
|
from module.map.map_base import CampaignMap
|
||||||
from module.map.map_grids import SelectedGrids, RoadGrids
|
from module.map.map_grids import SelectedGrids, RoadGrids
|
||||||
from module.logger import logger
|
from module.logger import logger
|
||||||
from campaign.event_20200423_cn.c1 import Config
|
from campaign.event_20200423_cn.c1 import Config as ConfigBase
|
||||||
|
|
||||||
MAP = CampaignMap()
|
MAP = CampaignMap()
|
||||||
MAP.map_data = '''
|
MAP.map_data = '''
|
||||||
@ -16,5 +16,9 @@ MAP.map_data = '''
|
|||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
||||||
|
class Config(ConfigBase):
|
||||||
|
FLEET_BOSS = 2
|
||||||
|
|
||||||
|
|
||||||
class Campaign(CampaignBase):
|
class Campaign(CampaignBase):
|
||||||
MAP = MAP
|
MAP = MAP
|
||||||
|
@ -6,14 +6,24 @@ from campaign.event_20200423_cn.d1 import Config as ConfigBase
|
|||||||
|
|
||||||
MAP = CampaignMap()
|
MAP = CampaignMap()
|
||||||
MAP.map_data = '''
|
MAP.map_data = '''
|
||||||
-- -- -- -- -- -- -- -- --
|
MS -- -- ME -- MS -- ME --
|
||||||
-- -- -- -- -- -- -- ++ ++
|
-- ME -- -- __ ME -- ++ ++
|
||||||
++ ++ -- -- ++ ++ -- -- --
|
++ ++ -- ME ++ ++ ME -- ME
|
||||||
-- -- -- -- ++ ++ -- -- SP
|
MB -- -- -- ++ ++ -- -- SP
|
||||||
++ ++ -- -- -- -- -- -- SP
|
++ ++ -- -- -- -- -- -- SP
|
||||||
-- -- -- -- -- -- -- ++ --
|
ME -- ME ME ME -- -- ++ --
|
||||||
-- -- ++ ++ ++ -- -- -- --
|
-- ME ++ ++ ++ MS ME -- --
|
||||||
'''
|
'''
|
||||||
|
MAP.camera_data = ['D3', 'D5', 'F3', 'F5']
|
||||||
|
MAP.spawn_data = [
|
||||||
|
{'battle': 0, 'enemy': 2, 'siren': 2},
|
||||||
|
{'battle': 1, 'enemy': 1},
|
||||||
|
{'battle': 2, 'enemy': 2, 'siren': 1},
|
||||||
|
{'battle': 3, 'enemy': 1},
|
||||||
|
{'battle': 4, 'enemy': 2},
|
||||||
|
{'battle': 5, 'enemy': 1},
|
||||||
|
{'battle': 6, 'boss': 1},
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
class Config(ConfigBase):
|
class Config(ConfigBase):
|
||||||
@ -22,3 +32,22 @@ class Config(ConfigBase):
|
|||||||
|
|
||||||
class Campaign(CampaignBase):
|
class Campaign(CampaignBase):
|
||||||
MAP = MAP
|
MAP = MAP
|
||||||
|
|
||||||
|
def battle_0(self):
|
||||||
|
if self.clear_siren():
|
||||||
|
return True
|
||||||
|
if self.clear_enemy(scale=(2, 3)):
|
||||||
|
return True
|
||||||
|
|
||||||
|
return self.battle_default()
|
||||||
|
|
||||||
|
def battle_5(self):
|
||||||
|
if self.clear_enemy(scale=(1,)):
|
||||||
|
return True
|
||||||
|
if self.clear_enemy(scale=(2,)):
|
||||||
|
return True
|
||||||
|
|
||||||
|
return self.battle_default()
|
||||||
|
|
||||||
|
def battle_6(self):
|
||||||
|
return self.fleet_2.clear_boss()
|
||||||
|
@ -272,7 +272,12 @@ def main(ini_name=''):
|
|||||||
# ==========活动图==========
|
# ==========活动图==========
|
||||||
event_parser = subs.add_parser('活动图')
|
event_parser = subs.add_parser('活动图')
|
||||||
|
|
||||||
event = event_parser.add_argument_group('选择关卡', '')
|
description = """
|
||||||
|
支持复刻苍红的回响, C2和D3有单独优化
|
||||||
|
出击未优化关卡或地图未达到安全海域时, 使用开荒模式运行(较慢)
|
||||||
|
"""
|
||||||
|
event = event_parser.add_argument_group(
|
||||||
|
'选择关卡', '\n'.join([line.strip() for line in description.strip().split('\n')]))
|
||||||
event.add_argument('--活动地图', default=default('--活动地图'),
|
event.add_argument('--活动地图', default=default('--活动地图'),
|
||||||
choices=['a1', 'a2', 'a3', 'b1', 'b2', 'b3', 'c1', 'c2', 'c3', 'd1', 'd2', 'd3'],
|
choices=['a1', 'a2', 'a3', 'b1', 'b2', 'b3', 'c1', 'c2', 'c3', 'd1', 'd2', 'd3'],
|
||||||
help='例如 d3')
|
help='例如 d3')
|
||||||
|
@ -186,7 +186,7 @@ dic_chi_to_eng = {
|
|||||||
'北境序曲': 'event_20200227_cn',
|
'北境序曲': 'event_20200227_cn',
|
||||||
'复刻斯图尔特的硝烟': 'event_20200312_cn',
|
'复刻斯图尔特的硝烟': 'event_20200312_cn',
|
||||||
'微层混合': 'event_20200326_cn',
|
'微层混合': 'event_20200326_cn',
|
||||||
|
'复刻苍红的回响': 'event_20200423_cn',
|
||||||
}
|
}
|
||||||
dic_eng_to_chi = {v: k for k, v in dic_chi_to_eng.items()}
|
dic_eng_to_chi = {v: k for k, v in dic_chi_to_eng.items()}
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@ fleet_lock.add_status('off', check_button=FLEET_UNLOCKED)
|
|||||||
|
|
||||||
class FastForwardHandler(ModuleBase):
|
class FastForwardHandler(ModuleBase):
|
||||||
map_clear_record = None
|
map_clear_record = None
|
||||||
|
is_map_green = False
|
||||||
|
|
||||||
def handle_fast_forward(self):
|
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):
|
if not self.appear(MAP_STAR_1) or not self.appear(MAP_STAR_2) or not self.appear(MAP_STAR_3):
|
||||||
@ -25,21 +26,15 @@ class FastForwardHandler(ModuleBase):
|
|||||||
logger.info('Campaign is not green sea.')
|
logger.info('Campaign is not green sea.')
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
self.is_map_green = True
|
||||||
|
|
||||||
if not fast_forward.appear(main=self):
|
if not fast_forward.appear(main=self):
|
||||||
self.config.ENABLE_FAST_FORWARD = False
|
self.config.ENABLE_FAST_FORWARD = False
|
||||||
logger.info('No fast forward mode.')
|
logger.info('No fast forward mode.')
|
||||||
return False
|
return False
|
||||||
|
|
||||||
logger.info('Set fast forward.')
|
logger.info('Set fast forward.')
|
||||||
self.config.MAP_HAS_FLEET_STEP = False
|
status = 'on' if self.config.ENABLE_FAST_FORWARD else 'off'
|
||||||
self.config.MAP_HAS_MOVABLE_ENEMY = False
|
|
||||||
if self.config.ENABLE_FAST_FORWARD:
|
|
||||||
self.config.MAP_HAS_AMBUSH = False
|
|
||||||
status = 'on'
|
|
||||||
else:
|
|
||||||
# When disable fast forward, MAP_HAS_AMBUSH depends on map settings.
|
|
||||||
# self.config.MAP_HAS_AMBUSH = True
|
|
||||||
status = 'off'
|
|
||||||
changed = fast_forward.set(status=status, main=self)
|
changed = fast_forward.set(status=status, main=self)
|
||||||
return changed
|
return changed
|
||||||
|
|
||||||
@ -49,6 +44,7 @@ class FastForwardHandler(ModuleBase):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
logger.info('fleet_lock')
|
logger.info('fleet_lock')
|
||||||
|
self.is_map_green = True
|
||||||
self.config.MAP_HAS_AMBUSH = False
|
self.config.MAP_HAS_AMBUSH = False
|
||||||
status = 'on' if self.config.ENABLE_MAP_FLEET_LOCK else 'off'
|
status = 'on' if self.config.ENABLE_MAP_FLEET_LOCK else 'off'
|
||||||
changed = fleet_lock.set(status=status, main=self)
|
changed = fleet_lock.set(status=status, main=self)
|
||||||
|
@ -307,6 +307,7 @@ class Fleet(Camera, MapOperation, AmbushHandler):
|
|||||||
self.ammo_count = 3
|
self.ammo_count = 3
|
||||||
self.map = map_
|
self.map = map_
|
||||||
self.map.reset()
|
self.map.reset()
|
||||||
|
self.handle_map_green_config_cover()
|
||||||
self.map.poor_map_data = self.config.POOR_MAP_DATA
|
self.map.poor_map_data = self.config.POOR_MAP_DATA
|
||||||
self.hp_init()
|
self.hp_init()
|
||||||
self.handle_strategy(index=self.fleet_current_index)
|
self.handle_strategy(index=self.fleet_current_index)
|
||||||
@ -316,6 +317,24 @@ class Fleet(Camera, MapOperation, AmbushHandler):
|
|||||||
self.find_path_initial()
|
self.find_path_initial()
|
||||||
self.map.show_cost()
|
self.map.show_cost()
|
||||||
|
|
||||||
|
def handle_map_green_config_cover(self):
|
||||||
|
if not self.is_map_green:
|
||||||
|
return False
|
||||||
|
|
||||||
|
logger.info('Map is green sea.')
|
||||||
|
self.config.MAP_HAS_FLEET_STEP = False
|
||||||
|
self.config.MAP_HAS_MOVABLE_ENEMY = False
|
||||||
|
if self.config.ENABLE_FAST_FORWARD:
|
||||||
|
self.config.MAP_HAS_AMBUSH = False
|
||||||
|
else:
|
||||||
|
# When disable fast forward, MAP_HAS_AMBUSH depends on map settings.
|
||||||
|
# self.config.MAP_HAS_AMBUSH = True
|
||||||
|
pass
|
||||||
|
if self.config.POOR_MAP_DATA and self.map.is_map_data_poor:
|
||||||
|
self.config.POOR_MAP_DATA = False
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
def _expected_combat_end(self, expected):
|
def _expected_combat_end(self, expected):
|
||||||
for data in self.map._spawn_data_backup:
|
for data in self.map._spawn_data_backup:
|
||||||
if data.get('battle') == self.battle_count and 'boss' in expected:
|
if data.get('battle') == self.battle_count and 'boss' in expected:
|
||||||
|
@ -180,6 +180,14 @@ class CampaignMap:
|
|||||||
for loca, data in self._parse_text(text):
|
for loca, data in self._parse_text(text):
|
||||||
self[loca].weight = float(data)
|
self[loca].weight = float(data)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def is_map_data_poor(self):
|
||||||
|
if not self.select(may_enemy=True) or not self.select(may_boss=True) or not self.select(is_spawn_point=True):
|
||||||
|
return False
|
||||||
|
if not len(self._spawn_data_backup):
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
def show_cost(self):
|
def show_cost(self):
|
||||||
logger.info(' ' + ' '.join([' ' + chr(x + 64 + 1) for x in range(self.shape[0] + 1)]))
|
logger.info(' ' + ' '.join([' ' + chr(x + 64 + 1) for x in range(self.shape[0] + 1)]))
|
||||||
for y in range(self.shape[1] + 1):
|
for y in range(self.shape[1] + 1):
|
||||||
|
Loading…
Reference in New Issue
Block a user