Exemplo n.º 1
0
def get_synergy(hero1, hero2, blank_is_negative):
    hero1 = conv.fancify(hero1)
    hero2 = conv.fancify(hero2)
    if hero1 == 'Soldier 76':  # this is formatted with a colon in the csv
        hero1 = 'Soldier: 76'  # but without one in this program
    if hero2 == 'Soldier 76':
        hero2 = 'Soldier: 76'
    if blank_is_negative:
        if 'unknown' in hero1 or 'loading' in hero1:
            return -2
        if 'unknown' in hero2 or 'loading' in hero2:
            return -2
    if hero1 == hero2:
        return 0

    synergy_value1 = None
    synergy_value2 = None
    for full_synergy in synergies_table:
        synergy_first = full_synergy[0]
        synergy_second = full_synergy[1]
        if synergy_first == hero1 and synergy_second == hero2:
            synergy_value1 = full_synergy[2]
        if synergy_first == hero2 and synergy_second == hero1:
            synergy_value2 = full_synergy[2]
        if synergy_value1 and synergy_value2:
            break
    if synergy_value1 and synergy_value2:
        synergy_value1 = int(convert_values_table[str(synergy_value1)])
        synergy_value2 = int(convert_values_table[str(synergy_value2)])
        synergy_value_average = (synergy_value1 + synergy_value2) / 2
        return -synergy_value_average
    return 0  # if doomfist or orisa
Exemplo n.º 2
0
def get_counter_csv(hero1, hero2):
    hero1 = conv.fancify(hero1)
    hero2 = conv.fancify(hero2)
    if hero1 == 'Soldier 76':
        hero1 = 'Soldier: 76'
    if hero2 == 'Soldier 76':
        hero2 = 'Soldier: 76'
    if hero1 == hero2:
        return 0

    counter_value1 = None
    counter_value2 = None
    for full_counter in counters_table:
        counter_first = full_counter[0]
        counter_second = full_counter[1]
        if counter_first == hero1 and counter_second == hero2:
            counter_value1 = full_counter[2]
        if counter_first == hero2 and counter_second == hero1:
            counter_value2 = full_counter[2]
        if counter_value1 and counter_value2:
            break
    if counter_value1 and counter_value2:
        counter_value1 = int(convert_values_table[str(counter_value1)])
        counter_value2 = int(
            convert_values_table_reversed[str(counter_value2)])
        counter_value_average = (counter_value1 + counter_value2) / 2
        return -counter_value_average
    return None  # if doomfist or orisa
Exemplo n.º 3
0
def format_counter_list(counter_list):
    formatted_counter = ''
    for pair_ in counter_list:
        just_name_ = pair_[0]
        just_num_ = pair_[1]
        full_counter = conv.fancify(just_name_) + ': ' + str(just_num_)
        formatted_counter += (full_counter + ', ')
    return formatted_counter[:-2]  # removes extra comma and space
Exemplo n.º 4
0
def fancify_hero_list(team_list):
    alive_list = ": "
    for hero in team_list:
        hero = conv.fancify(hero)
        alive_list += hero + ", "
    if alive_list == ": ":
        return ""
    else:
        return alive_list[:-2]
Exemplo n.º 5
0
                enemy_team.append(likely_name)

        print('\n')

        process_time_elapsed = time.perf_counter() - process_time_start
        print("Processing finished in " + str(process_time_elapsed)[0:3] +
              " seconds")
        log.info("Image recognition finished in " + str(process_time_elapsed) +
                 " seconds")
        log.info("Enemy team is " + str(enemy_team))
        log.info("Allied team is " + str(allied_team))
        log.info("Confidences (allied first): " + str(total_confidence))

        enemy_team_fancy = ''
        for i in enemy_team:
            hero = conv.fancify(i)
            enemy_team_fancy += (hero + ', ')
        allied_team_fancy = ''
        for i in allied_team:
            hero = conv.fancify(i)
            allied_team_fancy += (hero + ', ')

        total_conf_average = int(
            sum(total_confidence) / float(len(total_confidence)))
        log.info("Image recognition had a confidence of " +
                 str(total_conf_average))

        enemy_is_heroes = True
        j = 0
        for i in enemy_team:
            if (i == 'loading') or (i == 'unknown') or (i == 'unknowndead'):