MCPcopy Create free account
hub / github.com/runhey/OnmyojiAutoScript / run

Method run

tasks/Duel/script_task.py:19–55  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

17
18class ScriptTask(GameUi, GeneralBattle, DuelAssets):
19 def run(self):
20 con = self.config.duel.duel_config
21 limit_time = con.limit_time
22 self.limit_time: timedelta = timedelta(hours=limit_time.hour, minutes=limit_time.minute,
23 seconds=limit_time.second)
24 self.ui_get_current_page()
25 self.ui_goto(page_duel)
26 if con.switch_all_soul:
27 self.switch_all_soul()
28
29 # 循环
30 while 1:
31 self.screenshot()
32 if self.appear_then_click(self.I_REWARD, interval=0.6):
33 continue
34 if not self.duel_main():
35 continue
36
37 if datetime.now() - self.start_time >= self.limit_time:
38 # 任务执行时间超过限制时间,退出
39 logger.info('Duel task is over time')
40 break
41 if con.honor_full_exit and self.check_honor():
42 # 荣誉满了,退出
43 logger.info('Duel task is over honor')
44 break
45 current_score = self.check_score(con.target_score)
46 if not current_score:
47 # 分数够了,退出
48 logger.info('Duel task is over score')
49 break
50 self.duel_one(current_score, con.green_enable, con.green_mark)
51
52 # 记得退回去到町中
53 self.ui_click(self.I_UI_BACK_YELLOW, self.I_CHECK_TOWN)
54 self.set_next_run(task='Duel', success=True, finish=False)
55 raise TaskEnd('Duel')
56
57 def duel_main(self, screenshot=False) -> bool:
58 """

Callers 1

script_task.pyFile · 0.45

Calls 12

switch_all_soulMethod · 0.95
duel_mainMethod · 0.95
check_honorMethod · 0.95
check_scoreMethod · 0.95
duel_oneMethod · 0.95
ui_clickMethod · 0.95
TaskEndClass · 0.90
ui_get_current_pageMethod · 0.80
ui_gotoMethod · 0.80
appear_then_clickMethod · 0.80
set_next_runMethod · 0.80
screenshotMethod · 0.45

Tested by

no test coverage detected