forked from vadim-job-hg/CodeCombat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MegaMunchkinAttacks.py
17 lines (16 loc) · 966 Bytes
/
MegaMunchkinAttacks.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
path = [{'x': 19, 'y': 33}, {'x': 19, 'y': 14}, {'x': 42, 'y': 14}, {'x': 53, 'y': 37}, {'x': 52, 'y': 52}]
index = len(path)
while True: # Найдите лучника.
friend = self.findNearest(self.findFriends())
enemy = self.findNearest(self.findEnemies())
# Прикажите лучнику атаковать противника.
if friend and enemy:
if (friend.distanceTo(enemy) > 16):
self.command(friend, "attack", enemy)
else:
self.say(index + '_' + len(path) % index)
self.command(friend, "move", path[index % len(path)])
if (friend.pos.x == path[index % len(path)].x and friend.pos.y == path[index % len(path)].y):
index += 1
# Подождите-ка! Как то не очень получается. Может быть следует попробовать что-нибудь другое?
# Манчкин ужасно меееедленный...