def start_round(): logging.info("Starting Round.") enemy_num = 0 get_gem() style = Settings.Player.style Settings.pause = False while not round_won() and not Cord.p_dead: if Settings.pause: return False #reduce_cooldown() im = screenGrab() if im.getpixel((42, 710)) != (227, 224, 209): continue current_enemies = get_enemies(im) cool_down() #logging.debug("Enemies: {} Health: {} Mana: {} Spirit: {}".format(len(current_enemies), get_health(im), get_mana(im), get_spirit(im))) log_message = "{},{},{},{},".format(len(current_enemies), get_health(im), get_mana(im), get_spirit(im)) get_status() restore_message = restore_stats(im) if len(restore_message) > 0: log_message = log_message + restore_message time.sleep(0.2) elif 0 < len(current_enemies) < enemy_num: log_message = log_message + get_gem() else: message = special_attack(im, current_enemies, style) log_message = log_message + message #this sleep function triggers the amount of time between clicks, thus the time between server communication #This function is very important as it randomizes the communication times, emulating the behavior of a player #sleep() logging.info(log_message) enemy_num = len(current_enemies) return True
def is_item_active(item): get_status() item_name = '' if item == 0: item_name = "Health_Pot" elif item == 1: item_name = "Mana_Pot" elif item == 2: item_name = "Spirit_Pot" if is_status_active(item_name): return True else: time.sleep(2) get_status() return is_status_active(item_name)
def startRound(): #UNFINISHED print "Starting Round." while not roundWon() and not Cord.p_dead: #time.sleep(1) reduceCooldown() im = screenGrab() current_enemies = getEnemies(im) get_status() if restore_stats(im): """restoration occurred""" elif special_attack(im, current_enemies): """special attack occurred""" else: use_gem() if len(current_enemies) > 0: attack(current_enemies[0]) #this sleep function triggers the amount of time between clicks, thus the time between server communication #This function is very important as it randomizes the communication times, emulating the behavior of a player sleep()