hello I would like some help with solving Clash of Clones no matter what I do I die.
here is my equipment
and my code
enemies = hero.findEnemies()
strongest = None
greatestHealth = 0
enemyIndex = 0
for enemy in enemies:
if enemy.health > greatestHealth:
if enemy.type != "sand-yak":
strongest = enemy
greatestHealth = enemy.health
return strongest
def findWeakestEnemy():
enemies = hero.findEnemies()
weakest = None
leastHealth = 99999
enemyIndex = 0
for enemy in enemies:
if enemy.type != "sand-yak":
if enemy.health < leastHealth:
weakest = enemy
leastHealth = enemy.health
return weakest
while True:
#weakestShaman = findWeakestEnemy()
hero.maxSpeed == 10
strongestShaman = findWeakestEnemy()
if strongestShaman:
hero.attack(strongestShaman)
if hero.isReady("cleave"):
hero.cleave(strongestShaman)
if hero.isReady("bash"):
hero.bash(strongestShaman)
if hero.health < hero.maxHealth / 2:
if hero.isReady("shield"):
hero.shield()
#strongXY = (strongestShaman.pos.x, strongestShaman.pos.y)
#hero.moveXY(29, 99)
if hero.health < hero.maxHealth / 4:
hero.moveXY(51, 44)
if strongestShaman.type == "ogre":
I don’t know what is wrong and what to do to fix it my character kills for a while then dies.