while True:
enemies = hero.findEnemies()
if enemies:
if hero.isReady("cleave"):
hero.cleave(enemies)
else:
hero.attack(enemies)
hero.bash(enemies)
hero.shield(3)
def findStrongestEnemy(enemies):
strongest = None
strongestHealth = 0
enemyIndex = 0
enemy = hero.findNearestEnemy()
# While enemyIndex is less than the length of enemies:
while enemyIndex < len(enemies):
# Set an enemy variable to enemies[enemyIndex]
enemy = enemies[enemyIndex]
# If enemy.health is greater than strongestHealth
if enemy.health > strongestHealth:
# Set `strongest` to enemy
# Set strongestHealth to enemy.health
strongest = enemy
strongestHealth = enemy.health
# Increment enemyIndex
enemyIndex += 1
return strongest
enemies = hero.findEnemies()
leader = findStrongestEnemy(enemies)
if leader:
hero.attack(leader)
if hero.isReady("cleave"):
hero.cleave(leader)
else:
hero.attack(leader)
hero.bash(leader)
hero.shield(2)
if hero.health < leader.health:
hero.shield(3)
hero.moveXY(42, 38)
hero.moveXY(39, 85)
I changed it but now when he moves he just stays there
def findStrongestEnemy(enemies):
strongest = None
strongestHealth = 0
enemyIndex = 0
enemy = hero.findNearestEnemy()
# While enemyIndex is less than the length of enemies:
while enemyIndex < len(enemies):
# Set an enemy variable to enemies[enemyIndex]
enemy = enemies[enemyIndex]
# If enemy.health is greater than strongestHealth
if enemy.health > strongestHealth:
# Set `strongest` to enemy
# Set strongestHealth to enemy.health
strongest = enemy
strongestHealth = enemy.health
# Increment enemyIndex
enemyIndex += 1
return strongest
while True:
enemies = hero.findEnemies()
leader = findStrongestEnemy(enemies)
if leader:
hero.attack(leader)
if hero.isReady("cleave"):
hero.cleave(leader)
hero.attack(leader)
hero.attack(leader)
else:
hero.attack(leader)
hero.attack(leader)
hero.bash(leader)
hero.shield(10)
if hero.health < leader.health:
hero.shield(3)
hero.moveXY(42, 38)
hero.shield(4)
if leader < 10:
hero.bash(leader)
hero.attack(leader)
hero.attack(leader)
hero.cleave(leader)
hero.moveXY(39, 85)
hero.shield(5)
I’m afraid from here it’s just about tactics… If you can’t get any more equipment.
Do you have the jump boots? Maybe try and make your way to the archers at the start and cleave them, that gives you a massive advantage over your clone, then attack your clone.
Also equip a bad sword and just kill the clone with bash and cleave and your soldiers, who you’ll have more of if you unbalance the numbers by killing their archers at the start.
I hope this helps
Danny
to Alex and Deadpool: “if you target a location out of range of the shoes” - never noticed such freeze.
I usually combine jump with move ( measured jump distance about 25 metres )
def heroMove(pos, distance = 20):
if hero.isReady("jump") and hero.distanceTo(pos) > distance:
hero.jumpTo(pos)
else:
hero.move(pos)
while True:
# calling heroMove(pos) with default parameter
heroMove(Vector(120,70)) # or
# heroMove({'x':120,'y':70}, 25) # with parameter