Advertisement
Guest User

Untitled

a guest
Jan 17th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.38 KB | None | 0 0
  1.     defender_pirate = game.get_all_my_pirates()[-2]
  2.     drones = game.get_my_living_drones()
  3.     if defender_pirate.is_alive():
  4.         list_of_owned_islands = game.get_my_islands()
  5.         attack_aircraft = actions_helper.attack_aircraft_pirate_priority(defender_pirate)
  6.         if not attack_aircraft:
  7.             if len(drones) > 0:
  8.                 max_drone = drones[0]
  9.                 for drone in drones:
  10.                     if actions_helper.count_drones_with_drone(drone) >= actions_helper.count_drones_with_drone(max_drone):
  11.                         max_drone = drone
  12.                 count = 0
  13.                 destination = max_drone.get_location()
  14.                 for drone in drones:
  15.                     if defender_pirate.distance(max_drone) > defender_pirate.distance(drone):
  16.                         destination = drone.get_location()
  17.                         count = 1
  18.                 if count == 1:
  19.                     actions_helper.aircraft_sail_by_directions(defender_pirate, destination)
  20.                 else:
  21.                     destination = max_drone.get_location()
  22.                     actions_helper.aircraft_sail_by_directions(defender_pirate, destination)
  23.  
  24.            
  25.             elif len(list_of_owned_islands) > 0:
  26.                 closest_island = list_of_owned_islands[0]
  27.                 for island in list_of_owned_islands:
  28.                     if defender_pirate.distance(closest_island.get_location()) > defender_pirate.distance(island.get_location()):
  29.                         closest_island = island
  30.                 destination = closest_island.get_location()
  31.                 actions_helper.aircraft_sail_by_directions(defender_pirate, destination)
  32.            
  33.             list_of_enemy_islands = game.get_enemy_islands()
  34.             elif (len(list_of_enemy_islands) > 0) and len(list_of_owned_islands) == 0:
  35.                 closest_island = list_of_enemy_islands[0]
  36.                 for island in list_of_enemy_islands:
  37.                     if defender_pirate.distance(closest_island.get_location()) > defender_pirate.distance(island.get_location()):
  38.                         closest_island = island
  39.                 destination = closest_island.get_location()
  40.                 actions_helper.aircraft_sail_by_directions(defender_pirate, destination)
  41.             else:
  42.                 actions_helper.aircraft_sail_by_directions(defender_pirate, owned_cities_mid_location)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement