StarRailCopilot/tasks/combat/interact.py

29 lines
824 B
Python
Raw Normal View History

2023-10-02 18:25:22 +00:00
from module.base.utils import color_similar, get_color
2023-06-16 19:15:26 +00:00
from tasks.base.ui import UI
2023-10-02 18:25:22 +00:00
from tasks.combat.assets.assets_combat_interact import DUNGEON_COMBAT_INTERACT, MAP_LOADING
from tasks.map.assets.assets_map_control import A_BUTTON
2023-06-16 19:15:26 +00:00
class CombatInteract(UI):
def handle_combat_interact(self, interval=2):
2023-06-16 19:15:26 +00:00
"""
Returns:
bool: If clicked.
"""
if self.appear_then_click(DUNGEON_COMBAT_INTERACT, interval=interval):
2023-06-16 19:15:26 +00:00
return True
return False
2023-10-02 18:25:22 +00:00
def is_map_loading(self):
if self.appear(MAP_LOADING, similarity=0.75):
return True
return False
def is_map_loading_black(self):
color = get_color(self.device.image, A_BUTTON.area)
if color_similar(color, (0, 0, 0)):
return True
return False