code
pet.on("spawn", onSpawn)
tower = self.findNearest(self.findFriends())
self.jumpTo({"x": 76, "y": 56})
self.cast("earthskin", self)
self.summon("peasant")
def onSpawn():
while True:
if pet.isReady("shape-shift"):
pet.shapeShift()
pet.moveXY(36, 52)
else:
pet.moveXY(66, 50)
def commandPeasants():
peasants = self.findByType("peasant")
for i, peasant in enumerate(peasants):
if self.gold >= peasant.costOf('decoy'):
self.command(peasant, "buildXY", "decoy", peasant.pos.x - 2, peasant.pos.y)
else:
item = peasant.findNearestItem()
if item:
self.command(peasant, "move", item.pos)
while True:
commandPeasants()
if self.distanceTo({"x": 74, "y": 51}) > 2:
self.move({"x": 74, "y": 51})
brawler = self.findNearest(self.findByType("brawler"))
headhunter = self.findNearest(self.findByType("headhunter"))
shaman = self.findNearest(self.findByType("shaman"))
fangrider = self.findNearest(self.findByType("fangrider"))
thrower = self.findNearest(self.findByType("thrower"))
enemy = self.findNearest(self.findEnemies())
if self.isReady('throw'):
hero.throwAt(enemy)
elif self.isReady("heal") and tower and tower.health < tower.maxHealth - 200:
self.heal(tower)
elif shaman and self.distanceTo(shaman) < self.attackRange:
self.scattershot(shaman)
elif fangrider and self.distanceTo(fangrider) < self.attackRange:
self.scattershot(fangrider)
elif thrower and self.distanceTo(thrower) < self.attackRange:
self.scattershot(thrower)
elif enemy and self.distanceTo(enemy) < self.attackRange:
self.scattershot(enemy)
gear:
the tower didn’t survive