Last active
June 25, 2018 05:38
-
-
Save AnonQuebec/25a90391ca6a090baad74d4bbebf3bc7 to your computer and use it in GitHub Desktop.
empireofcode offence
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from battle import commander | |
unit_client = commander.Client() | |
my_info = unit_client.ask_my_info() | |
def search_target(data=None, **kwargs): | |
towers = unit_client.ask_towers() | |
print("List of towers:{}".format(towers)) | |
if towers: | |
tower_id = towers[0]["id"] | |
unit_client.do_attack(tower_id) | |
print("Unit {}".format(my_info['id'])) | |
print("attak ID:{}".format(tower_id)) | |
unit_client.when_item_destroyed(tower_id, search_target) | |
else: | |
attack_center() | |
def attack_center(*args, **kawargs): | |
center = unit_client.ask_center() | |
unit_client.do_attack(center['id']) | |
attack_center() | |
search_target() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from battle import commander | |
unit_client = commander.Client() | |
def search_target(data=None, **kwargs): | |
towers = unit_client.ask_towers() | |
if towers: | |
tower_id = towers[0]["id"] | |
unit_client.do_attack(tower_id) | |
unit_client.when_item_destroyed(tower_id, search_target) | |
else: | |
search_and_destroy() | |
def search_and_destroy(data=None, *args, **kwargs): | |
enemy = unit_client.ask_nearest_enemy() | |
unit_client.do_attack(enemy['id']) | |
unit_client.when_item_destroyed(enemy['id'], search_and_destroy) | |
search_target() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment