卫戍协议操作与识别改进、适配原型协议

This commit is contained in:
zhbaor 2024-11-19 12:54:57 +08:00
parent 6df5160a9f
commit c77a72ebd3
14 changed files with 57 additions and 30 deletions

View file

@ -739,6 +739,10 @@
"label": "SP_ANIMATION",
"comment": "卫戍协议动画"
},
"1809": {
"label": "SP_WASTE_CONFIRM",
"comment": "卫戍协议浪费金币确认"
},
"9998": {
"label": "LOADING",
"comment": "场景跳转时的等待界面"

BIN
mower/resources/double_confirm/stronghold_protocol_waste.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
mower/resources/stronghold_protocol/money0.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
mower/resources/stronghold_protocol/money2.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
mower/resources/stronghold_protocol/round1.png (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -11,16 +11,24 @@ from mower.utils.vector import va
class StrongholdProtocol(SceneGraphSolver, FightMixin):
solver_name = "卫戍协议"
def run(self):
return super().run()
def read_money(self) -> bool:
if self.find("stronghold_protocol/money3"):
money = 3
elif self.find("stronghold_protocol/money5"):
money = 5
else:
return False
self.sleep()
return self.find(f"stronghold_protocol/money{money}") == money
def transition(self):
if (scene := self.scene()) == Scene.TERMINAL_MAIN:
self.terminal_entry("stronghold_protocol/entry.jpg")
elif scene == Scene.SP_MAIN:
if pos := self.find("stronghold_protocol/stop"):
self.tap(pos)
return
if not self.find("stronghold_protocol/round1"):
self.tap(pos)
return
self.tap((1664, 911))
elif scene == Scene.SP_DEFENCE:
if pos := self.find("stronghold_protocol/start"):
@ -51,19 +59,22 @@ class StrongholdProtocol(SceneGraphSolver, FightMixin):
if pos := self.find("stronghold_protocol/buy3"):
self.tap(pos)
return
if self.find("stronghold_protocol/empty"):
self.tap((407, 540))
if self.find("stronghold_protocol/money0") or self.find(
"stronghold_protocol/money2"
):
self.tap((1827, 93)) # 开始作战
return
self.tap((407, 540)) # 购买干员
return
# 放置干员
pos = (1058, 746) if self.find("stronghold_protocol/block") else (1475, 524)
while True:
for _ in range(3):
self.swipe_ext([(1602, 989), pos], [500], 100, 0.3)
if self.drag_success():
self.swipe_ext([pos, va(pos, (300, 0))], [200], 100)
break
self.swipe_ext([pos, va(pos, (300, 0))], [200], 100, 0.1)
# 开始作战
self.tap((1827, 93))
else:
self.scene_graph_step(Scene.TERMINAL_MAIN)

View file

@ -16,6 +16,7 @@ def sp_back(solver: BaseSolver):
@edge(Scene.SP_GIVEUP_CONFIRM, Scene.SP_MAIN)
@edge(Scene.SP_BACK_CONFIRM, Scene.SP_MAIN)
@edge(Scene.SP_WASTE_CONFIRM, Scene.SP_AUTO)
def dialog_confirm(solver: BaseSolver):
solver.tap("double_confirm/main", x_rate=1)

View file

@ -260,6 +260,8 @@ class Recognizer:
self.scene = Scene.SP_BACK_CONFIRM
elif self.find("double_confirm/stronghold_protocol_giveup"):
self.scene = Scene.SP_GIVEUP_CONFIRM
elif self.find("double_confirm/stronghold_protocol_waste"):
self.scene = Scene.SP_WASTE_CONFIRM
else:
self.scene = Scene.DOUBLE_CONFIRM
elif self.find("mission_trainee_on"):

View file

@ -39,6 +39,7 @@ color = {
"double_confirm/sss_abandon_drop": (901, 463),
"double_confirm/stronghold_protocol_back": (1056, 437),
"double_confirm/stronghold_protocol_giveup": (921, 434),
"double_confirm/stronghold_protocol_waste": (706, 398),
"double_confirm/voice": (745, 435),
"drone": (274, 437),
"factory_collect": (1542, 886),
@ -172,6 +173,9 @@ color = {
"stronghold_protocol/defence": (29, 14),
"stronghold_protocol/empty": (1533, 934),
"stronghold_protocol/main": (1456, 472),
"stronghold_protocol/money0": (326, 255),
"stronghold_protocol/money2": (327, 255),
"stronghold_protocol/round1": (1701, 856),
"stronghold_protocol/start": (1709, 879),
"stronghold_protocol/stop": (1272, 801),
"terminal_main": (1658, 734),

View file

@ -369,6 +369,8 @@ class Scene:
"卫戍协议回到主页确认"
SP_ANIMATION = 1808
"卫戍协议动画"
SP_WASTE_CONFIRM = 1809
"卫戍协议浪费金币确认"
LOADING = 9998
"场景跳转时的等待界面"
CONFIRM = 9999
@ -561,6 +563,7 @@ SceneComment = {
1806: "卫戍协议结算",
1807: "卫戍协议回到主页确认",
1808: "卫戍协议动画",
1809: "卫戍协议浪费金币确认",
9998: "场景跳转时的等待界面",
9999: "确认对话框",
}

View file

@ -89,6 +89,7 @@ Res = Literal[
"double_confirm/sss_abandon_drop",
"double_confirm/stronghold_protocol_back",
"double_confirm/stronghold_protocol_giveup",
"double_confirm/stronghold_protocol_waste",
"double_confirm/voice",
"drone",
"episode",
@ -520,6 +521,9 @@ Res = Literal[
"stronghold_protocol/entry.jpg",
"stronghold_protocol/main",
"stronghold_protocol/medic",
"stronghold_protocol/money0",
"stronghold_protocol/money2",
"stronghold_protocol/round1",
"stronghold_protocol/start",
"stronghold_protocol/stop",
"switch_order/check",

16
sp.py
View file

@ -1,16 +0,0 @@
if __name__ == "__main__":
from mower.utils import path
path.global_space = "/home/zhao/Documents/profile"
import logging
from mower.utils.log import dhlr
dhlr.setLevel(logging.INFO)
from mower.solvers.stronghold_protocol import StrongholdProtocol
solver = StrongholdProtocol()
solver.solver_update_before_transition = True
solver.run()

File diff suppressed because one or more lines are too long

View file

@ -1,5 +1,7 @@
<template>
<div>使用说明选择核心协议并结束之前的对局</div>
<div>刷分原理第一回合成功击杀所有敌人得10分每次一分钟出头大半天就能刷满</div>
<div>
使用说明开始前需手动选择<b>核心协议推荐</b>或原型协议刷分效率减半放弃已有的模拟
</div>
<div>刷分原理第一回合击杀所有敌人得10分每轮一分钟出头大半天就能刷满</div>
<div>卫戍协议动画时间较长建议Mower设置-等待时间-未知-超时时长不低于10秒</div>
</template>