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()
def special_attack(im, current_enemies): current_spirit = getSpirit(im) current_overcharge = getOvercharge(im) if not is_spirit_active(im): if use_spirit(current_spirit, current_overcharge, im): print "Spirit Activated" elif activate_iris_strike(current_spirit, current_overcharge): if len(current_enemies) > 0: attack(current_enemies[0]) print "Iris Strike Used" elif activate_shield_bash(current_spirit, current_overcharge): if len(current_enemies) > 0: attack(current_enemies[0]) print "Shield Bash Used" else: use_gem() if len(current_enemies) > 0: attack(current_enemies[0]) else: return False return True
def restore_stats(im): current_health = get_health(im) current_spirit = get_spirit(im) current_mana = get_mana(im) message = "" if current_health == 0 and not enemies_exist(im): time.sleep(1) if current_health == 0 and not enemies_exist(screenGrab()): Cord.p_dead = True message = "Player has died" else: return False elif use_gem(0, current_health): message = "Health Gem Used" elif activate_cure(current_health): message = "Cure Casted" elif activate_spark_life(current_health): message = "Spark Life Casted" elif use_health_pot(current_health): message = "Health Potion used" elif use_gem(1, current_mana): message = "Mana Gem Used" elif use_mana_pot(current_mana): message = "Mana Potion used" elif use_gem(2, current_spirit): message = "Spirit Gem Used" elif use_spirit_pot(current_spirit): message = "Spirit Potion used" elif activate_regen(current_health): message = "Regen Casted" elif activate_protection(): message = "Protection Casted" elif is_channeling_active() and activate_premium(): message = "premium activated" #elif activate_absorb(): # message = "absorb activated") elif activate_auto_cast(): message = "auto skill activated" return message