StarRailCopilot/campaign/campaign_main/campaign_7_2_mystery_farming.py

123 lines
3.6 KiB
Python
Raw Normal View History

2020-03-28 17:22:46 +00:00
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('7-2')
MAP.shape = 'H5'
MAP.map_data = '''
ME ++ ME -- ME ME -- SP
MM ++ ++ MM -- -- ME --
ME -- ME MB ME -- ME MM
-- ME -- MM -- ME ++ ++
SP -- ME ME -- ME ++ ++
'''
MAP.weight_data = '''
40 30 30 30 30 30 30 30
20 20 20 20 20 20 20 20
10 10 10 10 10 10 10 10
20 20 20 20 20 20 20 20
30 30 30 30 30 30 30 30
'''
MAP.camera_data = ['D3']
MAP.spawn_data = [
{'battle': 0, 'enemy': 3},
{'battle': 1, 'enemy': 2, 'mystery': 1},
{'battle': 2, 'enemy': 2, 'mystery': 1},
{'battle': 3, 'enemy': 1, 'mystery': 2},
{'battle': 4, 'enemy': 1},
{'battle': 5, 'boss': 1},
]
# MAP.in_map_swipe_preset_data = (-1, 0)
2020-03-28 17:22:46 +00:00
A1, B1, C1, D1, E1, F1, G1, H1, \
A2, B2, C2, D2, E2, F2, G2, H2, \
A3, B3, C3, D3, E3, F3, G3, H3, \
A4, B4, C4, D4, E4, F4, G4, H4, \
A5, B5, C5, D5, E5, F5, G5, H5 = MAP.flatten()
ROAD_MAIN = RoadGrids([A3, [C3, B4, C5], [F1, G2, G3]])
GRIDS_FOR_FASTER = SelectedGrids([A3, C3, E3, G3])
FLEET_2_STEP_ON = SelectedGrids([A3, G3, C3, E3])
class Config:
# FLEET_2 = 0
pass
class Campaign(CampaignBase):
MAP = MAP
def battle_0(self):
if self.config.C72_BOSS_FLEET_STEP_ON_A3:
if self.fleet_2_step_on(FLEET_2_STEP_ON, roadblocks=[ROAD_MAIN]):
return True
ignore = None
if self.fleet_at(A3, fleet=2):
ignore = SelectedGrids([A2])
if self.fleet_at(G3, fleet=2):
ignore = SelectedGrids([H3])
2020-03-28 17:22:46 +00:00
self.clear_all_mystery(nearby=False, ignore=ignore)
else:
self.clear_all_mystery(nearby=False)
2020-03-28 17:22:46 +00:00
grids = ROAD_MAIN.roadblocks().select(is_accessible=True, enemy_scale=3)
if grids:
self.clear_chosen_enemy(grids[0])
return True
if self.clear_roadblocks([ROAD_MAIN]):
return True
grids = ROAD_MAIN.potential_roadblocks().select(is_accessible=True, enemy_scale=3)
if grids:
self.clear_chosen_enemy(grids[0])
return True
if self.clear_potential_roadblocks([ROAD_MAIN]):
return True
if self.clear_enemy(scale=(3,)):
return True
grids = ROAD_MAIN.first_roadblock().select(is_accessible=True, enemy_scale=2)
if grids:
self.clear_chosen_enemy(grids[0])
return True
if self.clear_enemy(scale=(2,)):
return True
if self.clear_grids_for_faster(GRIDS_FOR_FASTER):
return True
return self.battle_default()
battle_1 = battle_0
battle_2 = battle_0
def battle_3(self):
if self.config.C72_BOSS_FLEET_STEP_ON_A3:
ignore = None
if self.fleet_at(A3, fleet=2):
ignore = SelectedGrids([A2])
if self.fleet_at(G3, fleet=2):
ignore = SelectedGrids([H3])
self.clear_all_mystery(nearby=False, ignore=ignore)
if self.fleet_at(A3, fleet=2) and A2.is_mystery:
self.fleet_2.clear_chosen_mystery(A2)
if self.fleet_at(G3, fleet=2) and H3.is_mystery:
self.fleet_2.clear_chosen_mystery(H3)
else:
self.clear_all_mystery(nearby=False)
2020-03-28 17:22:46 +00:00
if self.map.select(is_mystery=True, is_accessible=False):
logger.info('Roadblock blocks mystery.')
if self.fleet_1.clear_roadblocks([ROAD_MAIN]):
return True
if not self.map.select(is_mystery=True):
self.withdraw()