mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-25 10:01:10 +00:00
Add: Clear enroute items without recording them
This commit is contained in:
parent
6714c2028a
commit
461f3884d2
@ -201,6 +201,10 @@ class MapControl(Combat, AimDetectorMixin):
|
||||
attacked_item.reset()
|
||||
direction_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():
|
||||
attacked_item.reset()
|
||||
else:
|
||||
|
@ -41,15 +41,17 @@ class Waypoint:
|
||||
# - callable, A function that returns bool, True represents stop
|
||||
# Or empty list [] for just walking
|
||||
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
|
||||
early_stop: bool = True
|
||||
# Confirm timer if arrived but didn't trigger any expected event
|
||||
unexpected_confirm: Timer = field(default_factory=lambda: Timer(3, count=15))
|
||||
|
||||
def __str__(self):
|
||||
return f'Waypoint({self.position})'
|
||||
# def __str__(self):
|
||||
# return f'Waypoint({self.position})'
|
||||
|
||||
__repr__ = __str__
|
||||
# __repr__ = __str__
|
||||
|
||||
def __bool__(self):
|
||||
return True
|
||||
|
@ -64,6 +64,8 @@ class RouteLoader(UI):
|
||||
self.route_module = module
|
||||
self.route_obj.route_module = module
|
||||
|
||||
self.route_obj.plane = self.plane
|
||||
|
||||
# before_route()
|
||||
try:
|
||||
before_func_obj = self.route_obj.__getattribute__('before_route')
|
||||
|
@ -138,6 +138,13 @@ class RouteBase(RouteBase_, RogueExit, RogueEvent, RogueReward):
|
||||
minimap = ClickButton(area, name='MINIMAP')
|
||||
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):
|
||||
"""
|
||||
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.interact_radius = 7
|
||||
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)
|
||||
self.clear_occurrence()
|
||||
|
Loading…
Reference in New Issue
Block a user