Backwood Treasure code stuck w/o error

In Backwoods treasure and several others; at a late stage in the code run, it will highlight an enemy but not attack them properly. Interestingly in this case I can still see my cleave periodically triggering but that one enemy is invincible and eventually finishes killing me. This code worked correctly for the first run but now becomes stuck at the end of the first quadrant.
2020-10-22 10_50_05-Backwoods Treasure

# Collect 100 gold from two or three groves.
# If you win, it gets harder (and more rewarding).
# If you lose, you must wait a day before you can resubmit.
# Remember, each submission gets a new random seed.

def home():
    hero.moveXY(39, 32)

#limits character sections of the map triggering cleave as cooldown expires, when no more coins spawn, it breaks and directs the character to another section.

def northEast():
    while True:
        enemy = hero.findNearestEnemy()
        if enemy:
            if hero.isReady("cleave"):
                hero.cleave()
        coin = hero.findNearestItem()
        if coin:
            if (coin.pos.x > 43) and (coin.pos.y > 34):
                hero.moveXY(coin.pos.x, coin.pos.y)
            else:
                break

def southEast():
    while True:
        enemy = hero.findNearestEnemy()
        if enemy:
            if hero.isReady("cleave"):
                hero.cleave()
        coin = hero.findNearestItem()
        if coin:
            if coin.pos.x > 43 and coin.pos.y < 34:
                hero.moveXY(coin.pos.x, coin.pos.y)
            else:
                break

def west():
    while True:
        if hero.isReady("cleave"):
            hero.cleave()
        coin = hero.findNearestItem()
        if coin:
            if coin.pos.x < 43:
                hero.moveXY(coin.pos.x, coin.pos.y)
            else:
                break

while-True:
    hero.moveXY(60, 16)
    southEast()
    home()
    
    hero.moveXY(60, 51)
    northEast()
    home()    
    
    hero.moveXY(16, 33)
    west()
    home()

its not invincible it just has more than 14 health(75)

and the enemy is called a scout a stronger munchkin

Yes, as @cheddarcheese said, they are not “invincible”, they just have more health than the cleave does.
I noticed you only have cleave, try adding attack if cleave is not ready.
Lydia

2 Likes

like @Lydia_Song has said

change this

    while True:
        if hero.isReady("cleave"):
            hero.cleave()

to

    while True:
        if hero.isReady("cleave"):
            hero.cleave()
        else:
            hero.attack(enemy)