Add: Clear enroute items without recording them

This commit is contained in:
LmeSzinc 2023-11-16 20:33:07 +08:00
parent 6714c2028a
commit 461f3884d2
4 changed files with 20 additions and 3 deletions

View File

@ -201,6 +201,10 @@ class MapControl(Combat, AimDetectorMixin):
attacked_item.reset() attacked_item.reset()
direction_interval.reset() direction_interval.reset()
rotation_interval.reset() rotation_interval.reset()
elif 'item' in waypoint.expected_enroute:
if self.handle_map_A():
direction_interval.reset()
rotation_interval.reset()
if attacked_item.started(): if attacked_item.started():
attacked_item.reset() attacked_item.reset()
else: else:

View File

@ -41,15 +41,17 @@ class Waypoint:
# - callable, A function that returns bool, True represents stop # - callable, A function that returns bool, True represents stop
# Or empty list [] for just walking # Or empty list [] for just walking
expected_end: list = field(default_factory=lambda: []) expected_end: list = field(default_factory=lambda: [])
# A list of expected events on the way to waypoint, e.g. ['enemy', 'item']
expected_enroute: list = field(default_factory=lambda: [])
# If triggered any expected event, consider arrive and stop walking # If triggered any expected event, consider arrive and stop walking
early_stop: bool = True early_stop: bool = True
# Confirm timer if arrived but didn't trigger any expected event # Confirm timer if arrived but didn't trigger any expected event
unexpected_confirm: Timer = field(default_factory=lambda: Timer(3, count=15)) unexpected_confirm: Timer = field(default_factory=lambda: Timer(3, count=15))
def __str__(self): # def __str__(self):
return f'Waypoint({self.position})' # return f'Waypoint({self.position})'
__repr__ = __str__ # __repr__ = __str__
def __bool__(self): def __bool__(self):
return True return True

View File

@ -64,6 +64,8 @@ class RouteLoader(UI):
self.route_module = module self.route_module = module
self.route_obj.route_module = module self.route_obj.route_module = module
self.route_obj.plane = self.plane
# before_route() # before_route()
try: try:
before_func_obj = self.route_obj.__getattribute__('before_route') before_func_obj = self.route_obj.__getattribute__('before_route')

View File

@ -138,6 +138,13 @@ class RouteBase(RouteBase_, RogueExit, RogueEvent, RogueReward):
minimap = ClickButton(area, name='MINIMAP') minimap = ClickButton(area, name='MINIMAP')
self.wait_until_stable(minimap, timeout=Timer(1.5, count=5)) self.wait_until_stable(minimap, timeout=Timer(1.5, count=5))
def clear_enemy(self, *waypoints):
waypoints = ensure_waypoints(waypoints)
end_point = waypoints[-1]
if self.plane.is_rogue_combat:
end_point.expected_enroute.append('item')
return super().clear_enemy(*waypoints)
def clear_item(self, *waypoints): def clear_item(self, *waypoints):
""" """
Shorten unexpected timer as items are randomly generated Shorten unexpected timer as items are randomly generated
@ -183,6 +190,8 @@ class RouteBase(RouteBase_, RogueExit, RogueEvent, RogueReward):
end_point.endpoint_threshold = 1.5 end_point.endpoint_threshold = 1.5
end_point.interact_radius = 7 end_point.interact_radius = 7
end_point.expected_end.append(self._domain_event_expected_end) end_point.expected_end.append(self._domain_event_expected_end)
if self.plane.is_rogue_occurrence:
end_point.expected_enroute.append('item')
result = self.goto(*waypoints) result = self.goto(*waypoints)
self.clear_occurrence() self.clear_occurrence()