Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- defender_pirate = game.get_all_my_pirates()[-2]
- drones = game.get_my_living_drones()
- if defender_pirate.is_alive():
- list_of_owned_islands = game.get_my_islands()
- attack_aircraft = actions_helper.attack_aircraft_pirate_priority(defender_pirate)
- if not attack_aircraft:
- if len(drones) > 0:
- max_drone = drones[0]
- for drone in drones:
- if actions_helper.count_drones_with_drone(drone) >= actions_helper.count_drones_with_drone(max_drone):
- max_drone = drone
- count = 0
- destination = max_drone.get_location()
- for drone in drones:
- if defender_pirate.distance(max_drone) > defender_pirate.distance(drone):
- destination = drone.get_location()
- count = 1
- if count == 1:
- actions_helper.aircraft_sail_by_directions(defender_pirate, destination)
- else:
- destination = max_drone.get_location()
- actions_helper.aircraft_sail_by_directions(defender_pirate, destination)
- elif len(list_of_owned_islands) > 0:
- closest_island = list_of_owned_islands[0]
- for island in list_of_owned_islands:
- if defender_pirate.distance(closest_island.get_location()) > defender_pirate.distance(island.get_location()):
- closest_island = island
- destination = closest_island.get_location()
- actions_helper.aircraft_sail_by_directions(defender_pirate, destination)
- list_of_enemy_islands = game.get_enemy_islands()
- elif (len(list_of_enemy_islands) > 0) and len(list_of_owned_islands) == 0:
- closest_island = list_of_enemy_islands[0]
- for island in list_of_enemy_islands:
- if defender_pirate.distance(closest_island.get_location()) > defender_pirate.distance(island.get_location()):
- closest_island = island
- destination = closest_island.get_location()
- actions_helper.aircraft_sail_by_directions(defender_pirate, destination)
- else:
- actions_helper.aircraft_sail_by_directions(defender_pirate, owned_cities_mid_location)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement