From 3938959d41e693917c46b480b2dc709cebe0b670 Mon Sep 17 00:00:00 2001 From: Matt Main_PC Date: Sun, 24 Dec 2023 00:57:15 -0500 Subject: [PATCH] fixing card mastery flow --- src/pyclashbot/bot/card_mastery_state.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/pyclashbot/bot/card_mastery_state.py b/src/pyclashbot/bot/card_mastery_state.py index 6e7f09046..687bb6ce5 100644 --- a/src/pyclashbot/bot/card_mastery_state.py +++ b/src/pyclashbot/bot/card_mastery_state.py @@ -58,14 +58,18 @@ def collect_card_mastery_rewards(vm_index, logger: Logger) -> bool: return False time.sleep(3) - # while card mastery icon exists: - while card_mastery_rewards_exist(vm_index): - logger.change_status("Detected card mastery rewards") - # click card mastery icon - collect_first_mastery_reward(vm_index, logger) - logger.change_status("Collected a card mastery reward!") - logger.add_card_mastery_reward_collection() - time.sleep(3) + if not card_mastery_rewards_exist(vm_index): + logger.change_status("No card mastery rewards to collect.") + + else: + # while card mastery icon exists: + while card_mastery_rewards_exist(vm_index): + logger.change_status("Detected card mastery rewards") + # click card mastery icon + collect_first_mastery_reward(vm_index, logger) + logger.change_status("Collected a card mastery reward!") + logger.add_card_mastery_reward_collection() + time.sleep(3) # get to clash main click(vm_index, 243, 600)