肉鸽选助战
This commit is contained in:
parent
1e565fc683
commit
91c0ba537f
1 changed files with 15 additions and 6 deletions
|
@ -1,3 +1,5 @@
|
|||
from typing import Literal
|
||||
|
||||
import cv2
|
||||
from scipy.signal import argrelmin
|
||||
from skimage.metrics import structural_similarity
|
||||
|
@ -31,14 +33,13 @@ skill_pos = (
|
|||
class ChooseSupportSolver(SceneGraphSolver):
|
||||
solver_name = "选择助战干员"
|
||||
|
||||
def run(
|
||||
self,
|
||||
opers: list = [],
|
||||
):
|
||||
def run(self, opers: list = [], mode: Literal["normal", "rogue"] = "normal"):
|
||||
"""
|
||||
Args:
|
||||
opers: 包含name和skill,若传入多个干员会选择其中练度最高的
|
||||
mode: 模式选择,normal为普通选助战,rogue为肉鸽选助战
|
||||
"""
|
||||
self.mode = mode
|
||||
self.opers_skill = {}
|
||||
if len(opers) == 0:
|
||||
return True
|
||||
|
@ -68,10 +69,11 @@ class ChooseSupportSolver(SceneGraphSolver):
|
|||
return not cmatch(img, res, 70)
|
||||
|
||||
def get_oper_pos(self):
|
||||
y = 908 if self.mode == "normal" else 917
|
||||
if not self.swiped:
|
||||
img = cropimg(config.recog.gray, ((0, 908), (1839, 983)))
|
||||
img = cropimg(config.recog.gray, ((0, y), (1920, y + 75)))
|
||||
else:
|
||||
img = cropimg(config.recog.gray, ((1600, 908), (1920, 983)))
|
||||
img = cropimg(config.recog.gray, ((1600, y), (1920, y + 75)))
|
||||
res = loadres("fight/choose", True)
|
||||
result = cv2.matchTemplate(img, res, cv2.TM_SQDIFF_NORMED)[0]
|
||||
threshold = 0.1
|
||||
|
@ -189,6 +191,10 @@ class ChooseSupportSolver(SceneGraphSolver):
|
|||
self.ctap("fight/use", 3)
|
||||
self.success = True
|
||||
|
||||
elif scene == Scene.ROGUE_USE_SUPPORT:
|
||||
self.tap("rogue/recruit/use_support")
|
||||
self.success = True
|
||||
|
||||
elif scene == Scene.OPERATOR_SELECT:
|
||||
if self.success:
|
||||
return True
|
||||
|
@ -207,6 +213,9 @@ class ChooseSupportSolver(SceneGraphSolver):
|
|||
else:
|
||||
self.tap("sss/choose/choose_support")
|
||||
|
||||
elif scene == Scene.ROGUE_RECRUIT_AGENT_SELECT:
|
||||
self.ctap("rogue/recruit/choose_support", 3)
|
||||
|
||||
elif scene in self.waiting_scene:
|
||||
self.waiting_solver()
|
||||
else:
|
||||
|
|
Loading…
Add table
Reference in a new issue