Level: Summit’s gate
So my computer lags a lot, so most of the times, I can’t get past the 2nd one. How can I automate it?
def lowestHealthPaladin():
lowestHealth = 99999
lowestFriend = None
friends = self.findFriends()
for friend in friends:
if friend.health < lowestHealth and friend.health < friend.maxHealth:
lowestHealth = friend.health
lowestFriend = friend
if self.health < 1200:
lowestFriend = self;
return lowestFriend
def commandFriends():
# Command your friends.
nearestEnemy = self.findNearest(self.findEnemies())
friends = self.findFriends()
blackFlag = self.findFlag("black")
for friend in friends:
if friend.type == "paladin":
commandPaladin(friend)
elif blackFlag:
self.command(friend, "attack", nearestEnemy)
else:
self.command(friend, "defend", self.pos)
def commandPaladin(paladin):
# Heal the paladin with the lowest health using lowestHealthPaladin()
# You can use paladin.canCast("heal") and command(paladin, "cast", "heal", target)
# Paladins can also shield: command(paladin, "shield")
lowestFriend = lowestHealthPaladin()
healingThreshold = 0.8 * paladin.maxHealth
warlocks = self.findByType('warlock')
nearestWarlock = paladin.findNearest(warlocks)
nearestEnemy = paladin.findNearest(self.findEnemies())
if lowestFriend and paladin.canCast('heal') and lowestFriend.health < healingThreshold:
self.command(paladin, 'cast', 'heal', lowestFriend)
else:
self.command(paladin, 'defend', self.pos)
self.attack("Catapult 1")
self.attack("Catapult")
loop:
commandFriends()
enemy = self.findNearest(self.findEnemies())
flag = self.findFlag()
if flag:
if flag.color is "green":
self.pickUpFlag(flag)
else if flag.color is "black":
self.attack(enemy)
self.pickUpFlag(flag)
if flag.color is "violet":
while self.costOf("archer") < self.gold:
self.summon("archer")
self.pickUpFlag(flag)