连战优化
Some checks failed
ci/woodpecker/push/check_format Pipeline failed

This commit is contained in:
zhbaor 2025-05-07 10:13:27 +08:00
parent 9a325a6f0e
commit ca5001a376
7 changed files with 44 additions and 18 deletions

BIN
mower/resources/operation/+.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
mower/resources/operation/x3.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
mower/resources/operation/x4.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
mower/resources/x1.png (Stored with Git LFS)

Binary file not shown.

View file

@ -59,13 +59,9 @@ class OperationSolver(BaseSolver):
self.drop_list: list[dict[str, int]] = [] # 掉落列表 self.drop_list: list[dict[str, int]] = [] # 掉落列表
self.drop_recog_complete = False # 本轮作战识别是否完成 self.drop_recog_complete = False # 本轮作战识别是否完成
return super().run()
def number(self, scope: tp.Scope, height: Optional[int] = None): self.auto_repeat = False # 更改连战次数
rect_limits = [{"w": 5, "h": 5, "char": ""}] return super().run()
return config.recog.num.number_int(
"secret_front", scope, height, rect_limits=rect_limits
)
def drop_recog(self): def drop_recog(self):
result = [] result = []
@ -134,22 +130,42 @@ class OperationSolver(BaseSolver):
def ope_start(self): def ope_start(self):
self.operation_start_time = datetime.now() self.operation_start_time = datetime.now()
self.drop_recog_complete = False self.drop_recog_complete = False
self.auto_repeat = True
self.ctap("ope_start", 3) self.ctap("ope_start", 3)
def repeat_scope(self) -> tuple[int, tp.Location]:
"""选择不用吃药的最高连战次数
Returns:
tuple[int, tp.Location]: 连战次数和点击区域/坐标
"""
y = 291
for i in range(6, 0, -1):
scope = (1445, y), (1555, y + 90)
y += 93
if self.find("operation/+", scope=scope):
continue
return i, scope
return 1, (1501, 802)
def transition(self): def transition(self):
if (scene := self.scene()) == Scene.OPERATOR_BEFORE: if (scene := self.scene()) == Scene.OPERATOR_BEFORE:
if self.check_timeout(): if self.check_timeout():
return True return True
if self.animation(): if self.animation():
return return
if config.recog.gray[907][1600] < 127: # 代理指挥 if config.recog.gray[907][1600] < 127:
self.ctap((1776, 908), 3) if self.ctap((1776, 908), 3):
logger.info("启用代理指挥")
return return
if self.number(((1520, 890), (1545, 930)), 28) > 1: if self.find("operation/x3") or self.find("operation/x4"):
if pos := self.find("x1"): repeat_times, pos = self.repeat_scope()
self.ctap(pos, 3) if self.ctap(pos, 3):
else: logger.info(f"选择连战次数:{repeat_times}")
self.ctap((1500, 910), 3) self.auto_repeat = False
return
if self.auto_repeat:
self.ctap((1501, 891), 3)
return return
self.ope_start() self.ope_start()
elif scene == Scene.OPERATOR_SELECT: elif scene == Scene.OPERATOR_SELECT:

View file

@ -107,6 +107,8 @@ color = {
"ope_recover_originite_on": (1514, 124), "ope_recover_originite_on": (1514, 124),
"ope_recover_potion_on": (1046, 127), "ope_recover_potion_on": (1046, 127),
"open_recruitment": (192, 143), "open_recruitment": (192, 143),
"operation/x3": (1477, 601),
"operation/x4": (1478, 509),
"operator/filter_hide": (1831, 48), "operator/filter_hide": (1831, 48),
"operator/filter_show": (1823, 46), "operator/filter_show": (1823, 46),
"operator/trust": (38, 600), "operator/trust": (38, 600),
@ -245,10 +247,10 @@ color = {
"sss/switch_to_ex": (1255, 942), "sss/switch_to_ex": (1255, 942),
"sss/switch_to_normal": (1255, 934), "sss/switch_to_normal": (1255, 934),
"start_story": (1392, 623), "start_story": (1392, 623),
"x1": (1477, 784),
} }
template_matching = { template_matching = {
"operation/+": None,
"activity": None, "activity": None,
"announcement_close": ((960, 0), (1920, 540)), "announcement_close": ((960, 0), (1920, 540)),
"arrange_check_in": ((30, 300), (175, 700)), "arrange_check_in": ((30, 300), (175, 700)),

View file

@ -323,6 +323,9 @@ Res = Literal[
"ope_select_start_empty", "ope_select_start_empty",
"ope_start", "ope_start",
"open_recruitment", "open_recruitment",
"operation/+",
"operation/x3",
"operation/x4",
"operator/CASTER", "operator/CASTER",
"operator/MEDIC", "operator/MEDIC",
"operator/PIONEER", "operator/PIONEER",
@ -729,5 +732,4 @@ Res = Literal[
"user", "user",
"user_on", "user_on",
"visit_limit", "visit_limit",
"x1",
] ]