/
Penders Trial
39 lines (32 loc) · 1.14 KB
/
Penders Trial
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
# Pender wants to test you on a series of trials. Use your boss star to clear off the ogres! Remember, you cannot move or attack in this level.
def summonTroops():
# These are just an example. Feel free to use griffin riders and/or other units!
if hero.gold >= 60:
hero.summon("soldier")
hero.summon("soldier")
hero.summon("archer")
def commandPeasant():
peasant = hero.findByType("peasant")[0]
if peasant:
item = peasant.findNearestItem()
if item:
hero.command(peasant, "move", item.pos)
def commandSoldiers():
soldiers = hero.findByType("soldier")
for soldier in soldiers:
enemy = soldier.findNearestEnemy()
if enemy:
hero.command(soldier, "attack", enemy)
else:
hero.command(archer, "move", Vector(25, 21))
def commandArchers():
archers = hero.findByType("archer")
for archer in archers:
enemy = archer.findNearestEnemy()
if enemy:
hero.command(archer, "attack", enemy)
while True:
summonTroops()
commandPeasant()
commandSoldiers()
commandArchers()