Fix: Entered herta shop on the way to exit

This commit is contained in:
LmeSzinc 2023-10-04 10:47:36 +08:00
parent 9b6b9edde8
commit c217fb0fb9
2 changed files with 8 additions and 4 deletions

View File

@ -16,6 +16,8 @@ from tasks.map.resource.const import diff_to_180_180
class MapControl(Combat, AimDetectorMixin): class MapControl(Combat, AimDetectorMixin):
waypoint: Waypoint
@cached_property @cached_property
def minimap(self) -> Minimap: def minimap(self) -> Minimap:
return Minimap() return Minimap()
@ -116,6 +118,7 @@ class MapControl(Combat, AimDetectorMixin):
""" """
logger.hr('Goto', level=2) logger.hr('Goto', level=2)
logger.info(f'Goto {waypoint}') logger.info(f'Goto {waypoint}')
self.waypoint = waypoint
self.device.stuck_record_clear() self.device.stuck_record_clear()
self.device.click_record_clear() self.device.click_record_clear()
@ -203,7 +206,7 @@ class MapControl(Combat, AimDetectorMixin):
return result return result
# Arrive # Arrive
if near :=self.minimap.is_position_near(waypoint.position, threshold=waypoint.get_threshold(end_opt)): if near := self.minimap.is_position_near(waypoint.position, threshold=waypoint.get_threshold(end_opt)):
near_queue.append(near) near_queue.append(near)
if not waypoint.expected_end or waypoint.match_results(result): if not waypoint.expected_end or waypoint.match_results(result):
logger.info(f'Arrive waypoint: {waypoint}') logger.info(f'Arrive waypoint: {waypoint}')
@ -214,7 +217,6 @@ class MapControl(Combat, AimDetectorMixin):
return result return result
else: else:
near_queue.append(near) near_queue.append(near)
logger.info(near_queue)
if np.mean(near_queue) < 0.6: if np.mean(near_queue) < 0.6:
waypoint.unexpected_confirm.reset() waypoint.unexpected_confirm.reset()

View File

@ -191,8 +191,9 @@ class RouteBase(RouteBase_, RogueUI, RogueExit):
if self.handle_popup_confirm(): if self.handle_popup_confirm():
return False return False
if self.handle_combat_interact(): if self.minimap.position_diff(self.waypoint.position) < 7:
return False if self.handle_combat_interact():
return False
return False return False
@ -244,6 +245,7 @@ class RouteBase(RouteBase_, RogueUI, RogueExit):
end_point = waypoints[-1] end_point = waypoints[-1]
end_point.end_rotation = end_rotation end_point.end_rotation = end_rotation
end_point.endpoint_threshold = 1.5 end_point.endpoint_threshold = 1.5
end_point.end_rotation_threshold = 10
result = self.goto(*waypoints) result = self.goto(*waypoints)
# TODO: Domain exit detection # TODO: Domain exit detection