Fix: Handle enemy during rotation_set()

This commit is contained in:
LmeSzinc 2024-05-07 23:03:40 +08:00
parent 9cf388b8e0
commit 348c22cd35

View File

@ -59,8 +59,11 @@ class MapControl(Combat, AimDetectorMixin):
skip_first_screenshot: skip_first_screenshot:
Returns: Returns:
bool: If swiped rotation list[str]: A list of walk result
Enemy may attack character during rotation_set, function returns walk result
""" """
logger.hr('Rotation set')
result = []
interval = Timer(1, count=2) interval = Timer(1, count=2)
while 1: while 1:
if skip_first_screenshot: if skip_first_screenshot:
@ -70,16 +73,28 @@ class MapControl(Combat, AimDetectorMixin):
self.minimap.update_rotation(self.device.image) self.minimap.update_rotation(self.device.image)
self.minimap.log_minimap() self.minimap.log_minimap()
# Additional
if self.is_combat_executing():
logger.info('Walk result add: enemy')
result.append('enemy')
logger.hr('Combat', level=2)
self.combat_execute()
if self.walk_additional():
continue
if self.is_in_main():
# End # End
if self.minimap.is_rotation_near(target, threshold=threshold): if self.minimap.is_rotation_near(target, threshold=threshold):
logger.info(f'Rotation is now at: {target}') logger.info(f'Rotation is now at: {target}')
break break
# Swipe
if interval.reached(): if interval.reached():
if self.handle_rotation_set(target, threshold=threshold): if self.handle_rotation_set(target, threshold=threshold):
interval.reset() interval.reset()
continue continue
return result
def walk_additional(self) -> bool: def walk_additional(self) -> bool:
""" """
Handle popups during walk Handle popups during walk