Hello! I am struggling with the final stage of this level(with chieftain). My hero keeps dying and, most important he stops summoning griffins, when he has gems.
Here is the screenshot of my equipment:
Here is my code:
# Прорвись с боем в святилище вождя огров и убей его.
def lowestHealthPaladin():
lowestHealth = 99999
lowestFriend = None
friends = hero.findFriends()
for friend in friends:
if friend.health < lowestHealth and friend.health < friend.maxHealth:
lowestHealth = friend.health
lowestFriend = friend
return lowestFriend
def commandArmy(friend):
enemy = friend.findNearestEnemy()
if enemy and enemy.type =='warlock':
hero.command(friend, "attack", enemy)
elif enemy:
hero.command(friend, "attack", enemy)
def commandPaladin(paladin):
enemy = paladin.findNearestEnemy()
lowestFriend = lowestHealthPaladin()
if enemy:
hero.command(paladin, "attack", enemy)
if lowestFriend and paladin.canCast("heal"):
hero.command(paladin, "cast", "heal", lowestFriend)
def commandFriends():
# Управляй своими союзниками.
friends = hero.findFriends()
for friend in friends:
if friend.type == "soldier" or friend.type == 'archer' or friend.type == 'griffin-rider':
commandArmy(friend)
elif friend.type == "paladin":
commandPaladin(friend)
def commandHeroandPet():
enemy = hero.findNearestEnemy()
flag = hero.findFlag("green")
if enemy:
if hero.canCast("chain-lightning", enemy):
hero.cast("chain-lightning", enemy)
elif hero.isReady("throw") and hero.distanceTo(enemy) <= hero.throwRange:
hero.throw(enemy)
else:
hero.attack(enemy)
if flag:
hero.pickUpFlag(flag)
if hero.isReady("phase-shift"):
hero.phaseShift()
if hero.isReady("shadow-vortex"):
hero.shadowVortex(hero.pos, {"x": enemy.pos.x, "y": enemy.pos.y})
specialPos = {'x': 276, 'y': 34}
if hero.isReady("wall-of-darkness") and hero.distanceTo(specialPos) < 30:
hero.wallOfDarkness([{"x": 276, "y": 44}, {"x": 276, "y": 24}]);
while True:
if hero.gold >= hero.costOf("griffin-rider"):
hero.summon("griffin-rider")
else:
commandFriends()
commandHeroandPet()
``
My army is doing everything great, and I use ALL of my hero's possibilities.
Please, help me!