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

Method battle_wait

tasks/DemonEncounter/script_task.py:371–404  ·  view source on GitHub ↗
(self, random_click_swipt_enable: bool)

Source from the content-addressed store, hash-verified

369 return True
370
371 def battle_wait(self, random_click_swipt_enable: bool) -> bool:
372 # 重写
373 self.device.stuck_record_add('BATTLE_STATUS_S')
374 self.device.click_record_clear()
375 # 战斗过程 随机点击和滑动 防封
376 logger.info("Start battle process")
377 check_timer = None
378 while 1:
379 self.screenshot()
380 if self.appear(self.I_DE_WIN):
381 logger.info('Appear [demon encounter] win button')
382 self.ui_click_until_disappear(self.I_DE_WIN)
383 check_timer = Timer(3)
384 check_timer.start()
385 continue
386 if self.appear_then_click(self.I_WIN, interval=1):
387 logger.info('Appear win button')
388 check_timer = Timer(3)
389 check_timer.start()
390 continue
391 if self.appear(self.I_REWARD):
392 logger.info('Win battle')
393 self.ui_click_until_disappear(self.I_REWARD)
394 return True
395
396 # 失败的
397 if self.appear(self.I_FALSE):
398 logger.warning('False battle')
399 self.ui_click_until_disappear(self.I_FALSE)
400 return False
401 # 时间到
402 if check_timer and check_timer.reached():
403 logger.warning('Obtain battle timeout')
404 return True
405
406if __name__ == '__main__':
407 from module.config.config import Config

Callers 1

script_task.pyFile · 0.45

Calls 9

startMethod · 0.95
reachedMethod · 0.95
TimerClass · 0.90
stuck_record_addMethod · 0.80
click_record_clearMethod · 0.80
appearMethod · 0.80
appear_then_clickMethod · 0.80
screenshotMethod · 0.45

Tested by

no test coverage detected