예제 #1
0
            for ship in packs[leader]:
                orders[ship] = leader
        elif len(pack) == 1:
            orders[pack[0]] = target

    # determine which members of the pack should be tethered
    tethered_followers = {leader: [] for leader in packs}
    for leader in packs:
        for follower in packs[leader]:
            if leader.calculate_distance_between(follower) < tether_dist:
                tethered_followers[leader].append(follower)
                my_free_navigation_ships.remove(follower)
    for leader, followers in tethered_followers.items():
        if len(followers) > 0:
            leader.radius = leader.calculate_distance_between(
                bot_utils.get_furthest(leader, followers)) + 0.5

    # survival mode overwrites
    if total_health <= int(total_health_high_water_mark *
                           (1 - health_reduction_for_survival_mode)):
        for ship in my_fighting_ships:
            orders[ship] = bot_utils.get_closest(ship, collection_points)

    # mission overwrite for safety
    for ship in my_free_navigation_ships:
        if ship in defense_distractors:
            continue
        nearby_enemies = bot_utils.get_proximity_alerts([ship],
                                                        [safety_check_radius],
                                                        mobile_enemies)
        if len(nearby_enemies) > 0:
예제 #2
0
            orders[leader] = target
            for ship in packs[leader]:
                orders[ship] = leader
        elif len(pack) == 1:
            orders[pack[0]] = target

    # determine which members of the pack should be tethered
    tethered_followers = {leader: [] for leader in packs}
    for leader in packs:
        for follower in packs[leader]:
            if leader.calculate_distance_between(follower) < tether_dist:
                tethered_followers[leader].append(follower)
                my_free_navigation_ships.remove(follower)
    for leader, followers in tethered_followers.items():
        if len(followers) > 0:
            leader.radius = leader.calculate_distance_between(bot_utils.get_furthest(leader, followers)) + 0.5

    # survival mode overwrites
    if total_health <= int(total_health_high_water_mark * (1 - health_reduction_for_survival_mode)):
        for ship in my_fighting_ships:
            orders[ship] = bot_utils.get_closest(ship, collection_points)

    # mission overwrite for safety
    for ship in my_free_navigation_ships:
        nearby_enemies = bot_utils.get_proximity_alerts([ship], [safety_check_radius], mobile_enemies)
        if len(nearby_enemies) > 0:
            nearest_enemy = bot_utils.get_closest(ship, nearby_enemies)
            enemy_support = len(bot_utils.get_proximity_alerts([nearest_enemy], [support_radius], mobile_enemies))
            my_support = len(
                bot_utils.get_proximity_alerts([ship], [support_radius], my_fighting_ships))
            if enemy_support * attack_superiority_ratio > my_support: