Help! My code is not working, but it should. This has gotten really frusturating, and I cannot beat this level. I have full dragonplate, rune sword, and crude spike sheild. totaling to about 2100 heath. I cannot beat the level. Please Help! Here is my code, it should work. Hector just keeps dying.
def summonSoldiers():
if hero.gold >= hero.costOf("soldier"):
hero.summon("soldier")
def commandSoldiers():
peasant = self.findByType("peasant")[0]
friends=self.findFriends()
for friend in friends:
if friend.type != 'peasant':
enemy= peasant.findNearest(peasant.findEnemies())
if enemy:
self.command(friend, "attack", enemy)
def pickUpNearestCoin():
coin=self.findNearest(self.findItems())
self.moveXY(coin.pos.x, coin.pos.y)
peasant = self.findByType("peasant")[0]
def attackmalos():
malos=self.findEnemies()
if len(malos)>10:
for malo in malos:
if self.isReady("bash"):
self.bash(malo)
elif hero.isReady("cleave"):
self.cleave(malo)
while True:
summonSoldiers()
commandSoldiers()
pickUpNearestCoin()
attackmalos()