mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-22 00:35:34 +00:00
Merge remote-tracking branch 'origin/bug_fix' into dev
This commit is contained in:
commit
80274ae4c9
@ -25,7 +25,8 @@ class Route(RouteBase, ForgottenHallUI):
|
|||||||
logger.hr('Forgotten hall stage 1')
|
logger.hr('Forgotten hall stage 1')
|
||||||
self.stage_goto(KEYWORDS_DUNGEON_LIST.The_Last_Vestiges_of_Towering_Citadel,
|
self.stage_goto(KEYWORDS_DUNGEON_LIST.The_Last_Vestiges_of_Towering_Citadel,
|
||||||
KEYWORDS_FORGOTTEN_HALL_STAGE.Stage_1)
|
KEYWORDS_FORGOTTEN_HALL_STAGE.Stage_1)
|
||||||
self.team_choose_first_4()
|
if not self.team_is_prepared():
|
||||||
|
self.team_choose_first_4()
|
||||||
self.enter_forgotten_hall_dungeon()
|
self.enter_forgotten_hall_dungeon()
|
||||||
|
|
||||||
self.map_init(plane=Jarilo_BackwaterPass, position=(369.4, 643.4))
|
self.map_init(plane=Jarilo_BackwaterPass, position=(369.4, 643.4))
|
||||||
|
@ -27,7 +27,7 @@ class SupportCharacter:
|
|||||||
_image_cache = {}
|
_image_cache = {}
|
||||||
_crop_area = COMBAT_SUPPORT_LIST_GRID.matched_button.area
|
_crop_area = COMBAT_SUPPORT_LIST_GRID.matched_button.area
|
||||||
|
|
||||||
def __init__(self, name, screenshot, similarity=0.85):
|
def __init__(self, name, screenshot, similarity=0.75):
|
||||||
self.name = name
|
self.name = name
|
||||||
self.image = self._scale_character()
|
self.image = self._scale_character()
|
||||||
self.screenshot = crop(screenshot, SupportCharacter._crop_area)
|
self.screenshot = crop(screenshot, SupportCharacter._crop_area)
|
||||||
|
@ -56,7 +56,8 @@ class UseTechniqueUI(MapControlJoystick, ForgottenHallUI):
|
|||||||
logger.hr('Use techniques', level=2)
|
logger.hr('Use techniques', level=2)
|
||||||
self.stage_goto(KEYWORDS_DUNGEON_LIST.The_Last_Vestiges_of_Towering_Citadel,
|
self.stage_goto(KEYWORDS_DUNGEON_LIST.The_Last_Vestiges_of_Towering_Citadel,
|
||||||
KEYWORDS_FORGOTTEN_HALL_STAGE.Stage_1)
|
KEYWORDS_FORGOTTEN_HALL_STAGE.Stage_1)
|
||||||
self.team_choose_first()
|
if not self.team_is_prepared():
|
||||||
|
self.team_choose_first_4()
|
||||||
self.enter_forgotten_hall_dungeon()
|
self.enter_forgotten_hall_dungeon()
|
||||||
self._use_technique(count, skip_first_screenshot=skip_first_screenshot)
|
self._use_technique(count, skip_first_screenshot=skip_first_screenshot)
|
||||||
self.exit_dungeon()
|
self.exit_dungeon()
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import cv2
|
import cv2
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
|
from module.base.timer import Timer
|
||||||
from module.base.utils import color_similarity_2d, get_color
|
from module.base.utils import color_similarity_2d, get_color
|
||||||
from module.logger import logger
|
from module.logger import logger
|
||||||
from tasks.base.ui import UI
|
from tasks.base.ui import UI
|
||||||
@ -72,3 +73,24 @@ class ForgottenHallTeam(UI):
|
|||||||
self.device.click(character)
|
self.device.click(character)
|
||||||
# Casual sleep, game may not respond that fast
|
# Casual sleep, game may not respond that fast
|
||||||
self.device.sleep((0.1, 0.2))
|
self.device.sleep((0.1, 0.2))
|
||||||
|
|
||||||
|
def team_is_prepared(self, skip_first_screenshot=True) -> bool:
|
||||||
|
"""
|
||||||
|
Pages:
|
||||||
|
in: ENTRANCE_CHECKED, ENTER_FORGOTTEN_HALL_DUNGEON
|
||||||
|
"""
|
||||||
|
characters = [CHARACTER_1, CHARACTER_2, CHARACTER_3, CHARACTER_4]
|
||||||
|
timeout = Timer(1, count=5).start()
|
||||||
|
while 1:
|
||||||
|
if skip_first_screenshot:
|
||||||
|
skip_first_screenshot = False
|
||||||
|
else:
|
||||||
|
self.device.screenshot()
|
||||||
|
|
||||||
|
if timeout.reached():
|
||||||
|
logger.info('Team not prepared')
|
||||||
|
return False
|
||||||
|
chosen_list = [self.is_character_chosen(c) for c in characters]
|
||||||
|
if all(chosen_list):
|
||||||
|
logger.info("Team already prepared")
|
||||||
|
return True
|
||||||
|
@ -233,7 +233,7 @@ class Aim:
|
|||||||
self.draw_item = cv2.multiply(draw, 4)
|
self.draw_item = cv2.multiply(draw, 4)
|
||||||
|
|
||||||
# Find peaks
|
# Find peaks
|
||||||
points = inrange(draw, lower=12)
|
points = inrange(draw, lower=10)
|
||||||
points = Points(points).group(threshold=10)
|
points = Points(points).group(threshold=10)
|
||||||
if points.shape[0] > 3:
|
if points.shape[0] > 3:
|
||||||
logger.warning(f'AimDetector.predict_item() too many peaks: {points.shape}')
|
logger.warning(f'AimDetector.predict_item() too many peaks: {points.shape}')
|
||||||
|
Loading…
Reference in New Issue
Block a user