mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-25 10:01:10 +00:00
Fix: Handle enemy during rotation_set()
This commit is contained in:
parent
9cf388b8e0
commit
348c22cd35
@ -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,15 +73,27 @@ 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()
|
||||||
|
|
||||||
# End
|
# Additional
|
||||||
if self.minimap.is_rotation_near(target, threshold=threshold):
|
if self.is_combat_executing():
|
||||||
logger.info(f'Rotation is now at: {target}')
|
logger.info('Walk result add: enemy')
|
||||||
break
|
result.append('enemy')
|
||||||
|
logger.hr('Combat', level=2)
|
||||||
|
self.combat_execute()
|
||||||
|
if self.walk_additional():
|
||||||
|
continue
|
||||||
|
|
||||||
if interval.reached():
|
if self.is_in_main():
|
||||||
if self.handle_rotation_set(target, threshold=threshold):
|
# End
|
||||||
interval.reset()
|
if self.minimap.is_rotation_near(target, threshold=threshold):
|
||||||
continue
|
logger.info(f'Rotation is now at: {target}')
|
||||||
|
break
|
||||||
|
# Swipe
|
||||||
|
if interval.reached():
|
||||||
|
if self.handle_rotation_set(target, threshold=threshold):
|
||||||
|
interval.reset()
|
||||||
|
continue
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
def walk_additional(self) -> bool:
|
def walk_additional(self) -> bool:
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user