Optimize: 优化复刻苍红的回响C2和D3

- 修改了绿海时的地图设置覆盖
This commit is contained in:
LmeSzinc 2020-04-25 16:43:41 +08:00
parent f9b2a9358b
commit f5ee202934
8 changed files with 102 additions and 24 deletions

View File

@ -6,15 +6,32 @@ from campaign.event_20200423_cn.c1 import Config
MAP = CampaignMap()
MAP.map_data = '''
-- -- ME -- ME -- MB
ME -- -- ++ ++ ++ --
-- ME __ -- ME ME --
ME -- ++ MS -- -- --
-- -- -- -- -- -- --
-- -- -- ++ ++ ++ --
-- -- -- -- -- -- --
-- -- ++ -- -- -- --
-- -- -- -- -- -- --
SP -- -- -- -- ++ --
SP SP -- -- -- ++ --
SP -- -- -- ME ++ --
SP SP -- ME -- ++ MB
'''
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):
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()

View File

@ -2,7 +2,7 @@ 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
from campaign.event_20200423_cn.c1 import Config
from campaign.event_20200423_cn.c1 import Config as ConfigBase
MAP = CampaignMap()
MAP.map_data = '''
@ -16,5 +16,9 @@ MAP.map_data = '''
'''
class Config(ConfigBase):
FLEET_BOSS = 2
class Campaign(CampaignBase):
MAP = MAP

View File

@ -6,14 +6,24 @@ from campaign.event_20200423_cn.d1 import Config as ConfigBase
MAP = CampaignMap()
MAP.map_data = '''
-- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- ++ ++
++ ++ -- -- ++ ++ -- -- --
-- -- -- -- ++ ++ -- -- SP
MS -- -- ME -- MS -- ME --
-- ME -- -- __ ME -- ++ ++
++ ++ -- ME ++ ++ ME -- ME
MB -- -- -- ++ ++ -- -- 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):
@ -22,3 +32,22 @@ class Config(ConfigBase):
class Campaign(CampaignBase):
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()

View File

@ -272,7 +272,12 @@ def main(ini_name=''):
# ==========活动图==========
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('--活动地图'),
choices=['a1', 'a2', 'a3', 'b1', 'b2', 'b3', 'c1', 'c2', 'c3', 'd1', 'd2', 'd3'],
help='例如 d3')

View File

@ -186,7 +186,7 @@ dic_chi_to_eng = {
'北境序曲': 'event_20200227_cn',
'复刻斯图尔特的硝烟': 'event_20200312_cn',
'微层混合': 'event_20200326_cn',
'复刻苍红的回响': 'event_20200423_cn',
}
dic_eng_to_chi = {v: k for k, v in dic_chi_to_eng.items()}

View File

@ -14,6 +14,7 @@ fleet_lock.add_status('off', check_button=FLEET_UNLOCKED)
class FastForwardHandler(ModuleBase):
map_clear_record = None
is_map_green = False
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):
@ -25,21 +26,15 @@ class FastForwardHandler(ModuleBase):
logger.info('Campaign is not green sea.')
return False
self.is_map_green = True
if not fast_forward.appear(main=self):
self.config.ENABLE_FAST_FORWARD = False
logger.info('No fast forward mode.')
return False
logger.info('Set fast forward.')
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
status = 'on'
else:
# When disable fast forward, MAP_HAS_AMBUSH depends on map settings.
# self.config.MAP_HAS_AMBUSH = True
status = 'off'
status = 'on' if self.config.ENABLE_FAST_FORWARD else 'off'
changed = fast_forward.set(status=status, main=self)
return changed
@ -49,6 +44,7 @@ class FastForwardHandler(ModuleBase):
return False
logger.info('fleet_lock')
self.is_map_green = True
self.config.MAP_HAS_AMBUSH = False
status = 'on' if self.config.ENABLE_MAP_FLEET_LOCK else 'off'
changed = fleet_lock.set(status=status, main=self)

View File

@ -307,6 +307,7 @@ class Fleet(Camera, MapOperation, AmbushHandler):
self.ammo_count = 3
self.map = map_
self.map.reset()
self.handle_map_green_config_cover()
self.map.poor_map_data = self.config.POOR_MAP_DATA
self.hp_init()
self.handle_strategy(index=self.fleet_current_index)
@ -316,6 +317,24 @@ class Fleet(Camera, MapOperation, AmbushHandler):
self.find_path_initial()
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):
for data in self.map._spawn_data_backup:
if data.get('battle') == self.battle_count and 'boss' in expected:

View File

@ -180,6 +180,14 @@ class CampaignMap:
for loca, data in self._parse_text(text):
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):
logger.info(' ' + ' '.join([' ' + chr(x + 64 + 1) for x in range(self.shape[0] + 1)]))
for y in range(self.shape[1] + 1):