New Level: Munchkin Harvest

Check it out here. For all you players wanting to know how to unlock the Ranger, well we now have an answer: beat this level to unlock Amara Arrowhead. The next two levels after this were built to show players how to use the rangers and wizards and we’d love to know how well they do at differentiating warrior vs ranger strategies.

Ah, very nice. Just a small note, when I got through this level the victory screen looks like this:

I think too many items to fit into the victory box.

Ah yeah, that’ll be fixed as soon as we implement the new design for the victory modal (it’s going to look pretty sweet).

Smart. Any suggestion to unlock this level? I tried many times, but it seemed that the hero’s blood was too thin to sustain to the end.

I need help on this level, how do I beat it?

loop:
enemy = self.findNearestEnemy()
if enemy: 
self.cleave(enemy)
else:
self.shield()

I have indents,

I think rather than shielding, try attacking the munchkins as they turn up. They seem to come in singly for a while, and then a big group just as the cleave becomes ready. But still need enough armor to survive too.

Or invest on items that give more life points. Ex. Tougher Armor and Head Gear.

Yeah, I have it on my TODO list to indicate in the comments that you should probably cleave and attack instead of cleaving and shielding; that’s the easiest way to do it, anyway. You also need to make sure you have over 300 health.

Nice, I’ll try to get 300+ health.

I can’t seem to beat this level and it’s extremely frustrating. That is my code, I have indents, and I have over 400 health. What am I doing wrong?

loop {
    var enemy = this.findNearestEnemy();
    if (enemy) {
        this.cleave(enemy);
    } else {
        this.shield();
    }
}

Did you try this one?

1 Like

Yeah, it still doesn’t work.

It works fine, but your condition does not make sense.

loop {
    var enemy = this.findNearestEnemy();

    // Are there enemies nearby?
    if (enemy) {
        // Yes, there are enemies nearby.
        this.cleave(enemy);
    } else {
        // No, there aren't any enemies around.
        this.shield();
    }
}

Try this instead:

// Is the cleave action ready?
if (this.isReady("cleave")) {
    // Yes, the action is ready.
    this.cleave(enemy);
} else {
    // No, I can't use cleave right now.
    this.shield();
}

Thank You! That was really helpful and I just completed it! I did have like, 1300 health points but I did complete it! Thanks!

Here’s the code and i have 700 of health. After the first round, it seems like the loop is stopping and my fighter is not looking for enemies

loop:
enemy = self.findNearestEnemy()
if self.isReady(“cleave”):
self.cleave(enemy)
else:
self.attack(enemy)

I do get a warning about target is nul

Any help is much appreciated :slight_smile:

Could you have a go at formatting your code as per the FAQ - given that its Python the whitespace makes quite a difference :smile:

You need a if enemy: because self.findNearestEnemy() doesn’t always find an enemy and when there isn’t one the code get’s an error and stops.

Where do i put that if enemy? Before or after checking that cleave is ready?

And where do i find the FAQ if it really is just a white space issue?

Thanks for your help

“If enemy” goes between setting and using “enemy” . . . not much point checking if enemy exists if you already failed trying to attack/cleave/etc it…

The FAQ is one of the posts “pinned” to the top of the message/post/thread-s list.

Hi,
something is wrong with my code :frowning:
while(true) {

var enemy = hero.findNearestEnemy();
if (hero.isReady("cleave")) {
hero.cleave(enemy);

} else {
hero.attack(enemy);
}
}
I’ve no idea what is wrong but i can’t harvest Muchking .
Any suggestion?
Thank’s