Skip to content

Commit

Permalink
调整跑去NPC的路线,似乎更稳定点
Browse files Browse the repository at this point in the history
  • Loading branch information
bamboo98 committed Aug 3, 2024
1 parent 104e74a commit 4e8d284
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 49 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 8 additions & 41 deletions assets/resource/base/pipeline/my_task.json
Original file line number Diff line number Diff line change
Expand Up @@ -411,52 +411,19 @@
138
],
"expected": "80/",
"action": "Swipe",
"begin": [
231,
569.5,
16,
19
],
"end": [
346,
387.5,
23,
27
],
"duration": 4900,
"post_delay": 0,
"next": "战斗结束2"
},
"战斗结束2": {
"action": "Swipe",
"begin": [
231,
569.5,
16,
19
],
"end": [
425,
619.5,
26,
18
],
"duration": 900,
"next": [
"对话高坂"
],
"timeout": 3000,
"action": "Custom",
"custom_action": "JustRun",
"pre_delay": 0,
"timeout_next": "重开战斗"
"post_delay": 0,
"next": "对话高坂"
},
"对话高坂": {
"recognition": "OCR",
"roi": [
669,
75,
234,
321
285,
126,
345,
314
],
"expected": "[高坂建设]",
"action": "Click",
Expand Down
35 changes: 27 additions & 8 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ async def main():

# maa_inst.register_recognizer("MyRec", my_rec)
maa_inst.register_action("NikoAttack", NikoAttack)

maa_inst.register_action("JustRun", JustRun)
print("ZZZ!启动!")
print("队伍1号位建议上妮可,用比利步子迈大了可能定位会歪,2号位上一个跑得快的")

Expand All @@ -63,13 +63,8 @@ async def main():
class NikoAttack(CustomAction):
def run(self, context, task_name, custom_param, box, rec_detail) -> bool:
# 前进
context.touch_down(0,233,540,50)
for i in range(540,440,-10):
cur_t = time.time()
context.touch_move(0,233,i,50)
dlt_t = time.time() - cur_t
if dlt_t < 0.01:
time.sleep(0.01 - dlt_t)
context.touch_down(0,239,456,50)
time.sleep(0.10)
# 闪避
context.touch_down(1,1119,636,50)
time.sleep(0.05)
Expand All @@ -87,13 +82,37 @@ def run(self, context, task_name, custom_param, box, rec_detail) -> bool:
time.sleep(0.05)
context.touch_up(0)
return True
def stop(self) -> None:
pass

class JustRun(CustomAction):
def run(self, context, task_name, custom_param, box, rec_detail) -> bool:
# 前进
context.touch_down(0,315,519,50)
time.sleep(0.05)
# 闪避
context.touch_down(1,1119,636,50)
time.sleep(0.05)
context.touch_up(1)
time.sleep(0.20)
# 闪避
context.touch_down(1,1119,636,50)
time.sleep(0.05)
context.touch_up(1)
time.sleep(3.3)
# 转向
context.touch_move(0,238,472,50)
time.sleep(1.8)
context.touch_up(0)

return True
def stop(self) -> None:
pass


# my_rec = MyRecognizer()
NikoAttack = NikoAttack()
JustRun = JustRun()


if __name__ == "__main__":
Expand Down

0 comments on commit 4e8d284

Please sign in to comment.