Sacred statue sennick not throw

# Walk to a few points around the ogre camps, defeating any enemies along the way.
# Visit the statue to begin the event.
# Stand your ground and defeat the attacking ogres.

# Hint: fight close to the statue for it's assistance during the battle.
hero.moveXY(60, 60)
while True:
    flag = hero.findFlag("green")
    enemy = hero.findNearestEnemy()
    if enemy and hero.isReady("throw") and hero.distanceTo(enemy.pos) < hero.throwRange:
        hero.throw(enemy)
    elif enemy:
        hero.attack(enemy)
    else:
        hero.moveXY(60, 60)
    if flag:
        hero.moveXY(flag.pos.x, flag.pos.y)
        hero.pickUpFlag(flag)
        
# After you defeat all of the waves, you will have to face off against the Ancient Cyclops!

Any idea why Sennick doesn’t throw his blade here? No errors given? thanks

Try breaking up your lengthy if conditional like this:

if enemy:
    if hero.distanceTo(enemy) < hero.throwRange:
        if hero.isReady("throw"):
            hero.throw(enemy)
        else:
            hero.attack(enemy)

Even better would be to create a separate function to do this and then just call the function when needed.

2 Likes