/
Kelvintaph Crusader
70 lines (63 loc) · 2.36 KB
/
Kelvintaph Crusader
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# You can find friends through walls, but not enemies.
# Watch out for smooth, frictionless ice patches!
def LowestFriend():
lowestfriend = None
lowestHealth = 9999
friends = hero.findFriends()
for friend in friends:
if friend.health < friend.maxHealth and friend.health < lowestHealth:
lowestfriend = friend
lowestHealth = friend.health
return lowestfriend
def commandPaladin(paladin):
if paladin.canCast("heal"):
hero.command(paladin, "cast", "heal", LowestFriend())
elif paladin.health < 200:
hero.command(paladin, "shield")
else:
witches = hero.findByType("witch")
for witch in witches:
if witch:
hero.command(paladin, "attack", witch)
if hero.canCast("chain-lightning", 'Trogdor'):
hero.cast("chain-lightning", 'Trogdor')
def commandTroops():
friends = hero.findFriends()
paladins = hero.findByType("paladin")
enemies = hero.findEnemies()
witches = hero.findByType("witch")
enemies = hero.findEnemies()
ogre = hero.findByType("ogre", hero.findEnemies())
for friend in friends:
if friend.type != "paladin":
if ogre.health > 0:
hero.command(friend, "attack", "Oni")
elif ogre.health <= 0:
if 'Rusty':
hero.command(friend, "attack", "Rusty")
elif 'Skully':
hero.command(friend, "attack", "Skully")
else:
commandPaladin(friend)
def EscapeTimeBoys():
friends = hero.findFriends()
for friend in friends:
if hero.wait() > 22:
hero.command(friend, "move", {'x': 32, 'y': 59})
hero.command(friend, "move", {'x': 50, 'y': 57})
hero.command(friend, "move", {'x': 50, 'y': 39})
if hero.wait() > 30:
hero.command(friend, "move", {'x': 78, 'y': 40})
while True:
commandTroops()
EscapeTimeBoys()
catapult = hero.findNearest(hero.findByType("catapult"))
brawler = hero.findNearest(hero.findByType("brawler"))
if brawler and hero.distanceTo(brawler) >= 18:
hero.moveXY(hero.pos.x + 5, hero.pos.y)
elif brawler:
hero.moveXY(hero.pos.x - 2, hero.pos.y)
elif catapult:
hero.attack(catapult)
else:
hero.moveXY(78, 14)