Forest Shadow Help

My character does nothing; I am not sure why the script never gets to the attack section.

while (true) {
    // Find the nearest enemy.
   var enemy = hero.findNearestEnemy();
    
    // Attack it only if its type is "thrower" or "munchkin".
   if (enemy && enemy.type == "munckin" || enemy.type == "thrower") {
        hero.attack(enemy);
   }
    // Find the nearest item.
   else {
    var item = hero.findNearestItem();
    
    // else (hero.findNearestItem());
        if (item && item.type == "gem" || item.type == "coin") {
            hero.move(item.pos);
        }
        
    }
    // Collect it only if its type is "gem" or "coin".

}

Thanks for the feedback.

    // Attack it only if its type is "thrower" or "munchkin".
   if (enemy && enemy.type == "munckin" || enemy.type == "thrower") 
   // munckin != munchkin
2 Likes