mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-23 00:52:22 +00:00
Add: 增加处理被精英抓住
- 修复原地寻路报warning - 修复到达误判
This commit is contained in:
parent
87608f2879
commit
eb2a58d7f5
@ -30,6 +30,8 @@ class CampaignBase(Map):
|
||||
def execute_a_battle(self):
|
||||
logger.hr(f'{self.FUNCTION_NAME_BASE}{self.battle_count}', level=2)
|
||||
logger.info('Running with poor map data.')
|
||||
if self.fleet_2_break_siren_caught():
|
||||
return True
|
||||
self.clear_all_mystery()
|
||||
|
||||
if self.battle_count >= 3:
|
||||
@ -50,6 +52,8 @@ class CampaignBase(Map):
|
||||
def execute_a_battle(self):
|
||||
logger.hr(f'{self.FUNCTION_NAME_BASE}{self.battle_count}', level=2)
|
||||
logger.info('Using function: clear_all')
|
||||
if self.fleet_2_break_siren_caught():
|
||||
return True
|
||||
self.clear_all_mystery()
|
||||
|
||||
if self.battle_count >= 3:
|
||||
|
@ -158,7 +158,9 @@ class Fleet(Camera, MapOperation, AmbushHandler):
|
||||
raise MapWalkError('walk_out_of_step')
|
||||
|
||||
# Arrive
|
||||
if self.is_in_map() and (grid.predict_fleet() or grid.predict_current_fleet()):
|
||||
if self.is_in_map() and \
|
||||
(grid.predict_fleet() or
|
||||
(walk_timeout.reached() and grid.predict_current_fleet())):
|
||||
if not arrive_timer.started():
|
||||
logger.info(f'Arrive {location2node(location)}')
|
||||
arrive_timer.start()
|
||||
|
@ -47,6 +47,7 @@ class GridInfo:
|
||||
|
||||
is_cleared = False
|
||||
is_ambush_save = False
|
||||
is_caught_by_siren = False
|
||||
cost = 9999
|
||||
connection = None
|
||||
weight = 1
|
||||
@ -90,6 +91,7 @@ class GridInfo:
|
||||
dic = {
|
||||
'FL': 'is_current_fleet',
|
||||
'Fl': 'is_fleet',
|
||||
'Fc': 'is_caught_by_siren',
|
||||
'MY': 'is_mystery',
|
||||
'AM': 'is_ammo',
|
||||
'==': 'is_cleared'
|
||||
@ -178,6 +180,8 @@ class GridInfo:
|
||||
self.is_fleet = info.is_fleet
|
||||
if info.is_current_fleet:
|
||||
self.is_current_fleet = True
|
||||
if info.is_caught_by_siren:
|
||||
self.is_caught_by_siren = True
|
||||
return False
|
||||
|
||||
def wipe_out(self):
|
||||
|
@ -68,7 +68,8 @@ class GridPredictor:
|
||||
if not self.is_enemy and not self.is_mystery:
|
||||
if self.predict_dynamic_red_border():
|
||||
self.enemy_type = 'Siren_unknown'
|
||||
# self.caught_by_siren = self.predict_siren_caught()
|
||||
if self.config.MAP_HAS_MOVABLE_ENEMY:
|
||||
self.is_caught_by_siren = self.predict_siren_caught()
|
||||
|
||||
if self.enemy_type:
|
||||
self.is_enemy = True
|
||||
|
@ -364,3 +364,25 @@ class Map(Fleet):
|
||||
self.fleet_1.clear_roadblocks(roadblocks)
|
||||
self.fleet_1.clear_all_mystery()
|
||||
return True
|
||||
|
||||
def fleet_2_break_siren_caught(self):
|
||||
if not self.config.MAP_HAS_SIREN or not self.config.MAP_HAS_MOVABLE_ENEMY:
|
||||
return False
|
||||
if not self.map.select(is_caught_by_siren=True):
|
||||
logger.info('No fleet caught by siren.')
|
||||
return False
|
||||
if not self.fleet_2_location or not self.map[self.fleet_2_location].is_caught_by_siren:
|
||||
logger.warning('Appear caught by siren, but not fleet_2.')
|
||||
for grid in self.map:
|
||||
grid.is_caught_by_siren = False
|
||||
return False
|
||||
|
||||
logger.info(f'Break siren caught, fleet_2: {self.fleet_2_location}')
|
||||
self.fleet_2.switch_to()
|
||||
self.ensure_edge_insight(reverse=True)
|
||||
self.clear_chosen_enemy(self.map[self.fleet_2_location])
|
||||
self.fleet_1.switch_to()
|
||||
for grid in self.map:
|
||||
grid.is_caught_by_siren = False
|
||||
return True
|
||||
|
||||
|
@ -253,6 +253,8 @@ class CampaignMap:
|
||||
MAP_7_2._find_path(node2location('H2'))
|
||||
[(2, 2), (3, 2), (4, 2), (5, 2), (6, 2), (6, 1), (7, 1)] # ['C3', 'D3', 'E3', 'F3', 'G3', 'G2', 'H2']
|
||||
"""
|
||||
if self[location].cost == 0:
|
||||
return [location]
|
||||
if self[location].connection is None:
|
||||
return None
|
||||
res = [location]
|
||||
|
Loading…
Reference in New Issue
Block a user