mirror of
https://github.com/TheFunny/ArisuAutoSweeper
synced 2025-12-16 11:15:13 +00:00
fix(tc): improve stability of reward
This commit is contained in:
parent
6e3d5fc4c5
commit
34af75245e
@ -41,8 +41,6 @@ class TacticalChallenge(TacticalChallengeUI):
|
||||
def _handle_challenge(self, status):
|
||||
match status:
|
||||
case TCStatus.REWARD:
|
||||
if self.ui_additional():
|
||||
return status
|
||||
if self.get_reward():
|
||||
return TCStatus.OCR
|
||||
case TCStatus.OCR:
|
||||
|
||||
@ -26,17 +26,26 @@ class TacticalChallengeUI(UI):
|
||||
|
||||
def get_reward(self):
|
||||
timer = Timer(10, 10).start()
|
||||
action_timer = Timer(0.5, 1)
|
||||
while 1:
|
||||
self.device.screenshot()
|
||||
self.ui_additional()
|
||||
if not action_timer.reached_and_reset():
|
||||
continue
|
||||
if self.handle_insufficient_inventory():
|
||||
logger.warning('Insufficient inventory, skip reward')
|
||||
return True
|
||||
if self.ui_additional():
|
||||
continue
|
||||
if self.match_color(GOT_REWARD_DAILY) and self.match_color(GOT_REWARD_CREDIT):
|
||||
return True
|
||||
if self.match_color(GET_REWARD_DAILY):
|
||||
self.click_with_interval(GET_REWARD_DAILY, 0.3)
|
||||
logger.info('Get daily reward')
|
||||
continue
|
||||
if self.match_color(GET_REWARD_CREDIT):
|
||||
self.click_with_interval(GET_REWARD_CREDIT, 0.3)
|
||||
logger.info('Get credit reward')
|
||||
continue
|
||||
if timer.reached():
|
||||
return False
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user