Medical Attention


#1

Hey Guys! On CodeCombat, I’m currently stuck on this level. I need help!
This is my code:

// Ask the healer for help when you're under half health.
// Buy the Polished Sense Stone for health documentation.
loop {
    var enemy = this.findNearestEnemy();

    currentHealth = this.health;


    healingThreshold = this.maxHealth / 2;

    this.moveXY(66, 46);


    this.say("heal me!");


    // If your current health is less than the threshold,

    // move to the healing point and say, "heal me"
.
    // Otherwise, just attack enemies.
    'else';

    this.moveXY(55, 35);

    this.findNearestEnemy();
    
        this.attack(enemy);

#2

There’s a lot of stuff wrong with that at first glance.

You aren’t checking your health anywhere.

You need it setup something like

If currentHealth < healingThreshold then move to coord and say heal me
else if enemy then attack enemy