StarRailCopilot/campaign/campaign_main/campaign_7_2_mystery_farming.py

93 lines
3.0 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
from campaign.campaign_main.campaign_7_2 import Config, MAP
2020-03-28 17:22:46 +00:00
# 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 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()