def combat_logic_wrapper(self): """Method that fires off the necessary child methods that encapsulates the entire action of sortieing combat fleets and resolving combat. Returns: bool: True if the combat cycle was complete """ if self.check_need_to_sortie(): Logger.log_msg('Navigating to map.') Utils.touch_randomly(self.region['home_menu_attack']) Utils.script_sleep(1) if not self.resume_previous_sortie: self.kills_needed = self.config.combat['kills_needed'] if self.event_map: Utils.touch_randomly(self.region['event_map']) if self.hard_mode: Utils.find_and_touch('map_menu_hard') Utils.wait_and_touch('map_{}'.format(self.sortie_map), 5, 0.85) Utils.script_sleep() Utils.touch_randomly(self.region['map_go_1']) Utils.script_sleep() Utils.touch_randomly(self.region['map_go_2']) Utils.script_sleep(5) if self.config.combat['alt_clear_fleet']: Logger.log_msg('Alternate clearing fleet enabled, ' + 'switching to 2nd fleet to clear trash') self.switch_fleet() self.need_to_refocus = False # Trash if self.clear_trash(): # Boss if self.config.combat['boss_fleet']: Logger.log_msg('Switching to 2nd fleet to kill boss') self.switch_fleet() self.clear_boss() self.stats.increment_combat_done() self.next_combat_time = datetime.now() Logger.log_success('Sortie complete. Navigating back home.') while not (Utils.exists('home_menu_build')): Utils.touch_randomly(self.region['nav_back']) self.set_next_combat_time({'seconds': 10}) return True return False
def retirement_logic_wrapper(self): """Method that fires off the necessary child methods that encapsulates the entire action filtering and retiring ships """ if self.need_to_retire: while not (Utils.find_and_touch('home_menu_build')): Utils.touch_randomly(Region(12, 8, 45, 30)) Utils.wait_and_touch('build_menu_retire', 5) Utils.script_sleep(1) self.set_filters() Utils.script_sleep(1) done = False while not done: self.select_ships() if (Utils.exists('retire_none_selected')): done = True # Click confirm button else: self.retire_ships()
def retire_ships(self): """Clicks through the dialogs for retiring ships """ Utils.find_and_touch('retire_confirm', 0.8) Utils.wait_and_touch('retire_confirm', 0.8, 3) Utils.touch_randomly(Region(0, 0, 300, 300)) Utils.wait_and_touch('retire_confirm', 0.8, 3) Utils.wait_and_touch('retire_disassemble', 3) Utils.touch_randomly(Region(0, 0, 300, 300))
def conduct_battle(self): """Method to start the battle and click through the rewards once the battle is complete. """ Logger.log_msg('Starting battle') while (Utils.exists('combat_auto_enabled')): Utils.touch_randomly(self.region['battle_start']) if Utils.wait_for_exist('combat_notification_sort', 3): return False Utils.script_sleep(30) while not Utils.find_and_touch('combat_battle_confirm', 0.85): if Utils.find_and_touch('confirm'): Logger.log_msg('Locked new ship.') else: Utils.touch_randomly(Region(0, 100, 150, 150)) Utils.script_sleep() Logger.log_msg('Battle complete.') if Utils.wait_and_touch('confirm', 3): Logger.log_msg('Dismissing urgent notification.') return True