Level: Preferential Treatment


#1

All of the melee munchkins went down on my first cleave leaving me nothing to clean up after I take care of the throwers. I’m using the Long Sword w/ 27.62 damage. I’m wondering if it would be better if one or two munchkins attacked as each thrower is taken care of or have the munchkins otherwise stay out of range until the throwers are taken care of.

I’m thinking of the levels Woodland Cleaver or Munchkin Swarm as examples.


#2

Yeah, I thought this was a weird one as well, way too easy to just clear out the munchkins first. If there was a way to have the goal require the throwers to die first the left could be left as is. Otherwise, better to just keep some of the munchkins out of reach.


#3

I’ve tweaked it such that some of the munchkins start further out as y’all suggested–how does it work now?


#4

It is better, though I’m still not sure that there is a reason to target the throwers first in terms of strategy. What if they were shaman instead? Then they would be buffing the munchkins so it would be more necessary to take them out before the munchkins.


#5

Are you speaking from a perspective of “warrior who has thousands of health”? I didn’t balance this one as much, Josh did, but it’d be interesting to figure out whether it’s only easy because of your sick gear.


#6

The changes made feel closer in intent to the description. There were a couple of munchkin survivors after the great cleaving which needed to be finished off.


#7

OK, so I just played the level with Tharin instead of Omarn. I don’t have top armor for him, just 198 on shield and 73 on armor (I left my helmet off for testing). If I tried just a basic cleave or attack nearest, I failed, if instead I targeted the throwers with cleave then attack, followed by the munchkins with cleave then attack, I succeeded, so I guess it is working well.

It also worked if I moved a bit before starting the cleave nearest loop, so there was a large mob when I cleaved, so it wasn’t so much the killing of the throwers first, but rather making sure cleave hit as many as possible.


#8

Balance on this probably needs tweaking. I can’t find any strategy to stay alive. 320 HP with bash / cleave abilities. What HP rating is needed to beat this?


#9

I believe I beat it with roughly that amount of health.
I used a total of 145 health using a simple cleave strategy, first hitting the throwers, then the munchkins. Make sure you are cleaving the throwers as well as that will take out a bunch of munchkins with it.


#11

Might have tweaked too far?

I die with Tharin in like 9 seconds, and I have 2051 HP!

He gets surrounded immediately without a chance to move (even if I place a flag to the left where the throwers are) and beaten to death.

I switched out my sword to the freebie for the cleave ability: no improvement. He dies before even activating this first skill. My code is below:

// First, loop through all enemies...
loop {
var enemy = this.findEnemies();
var enemyIndex = 0;
var flag = this.findFlag();

if (flag) {
    this.pickUpFlag(flag);
}

// ... but only attack 'thrower' type enemies.
// And don't forget to use your special abilities!
if (enemy.type == "thrower") {
    if (this.isReady("cleave")) {
        this.cleave(enemy);
    }
    else if (this.isReady("electrocute") && this.canElectrocute(enemy) && this.distanceTo(enemy) < 21) {
        this.electrocute(enemy);
    }
    else {
        this.attack(enemy);
    }
}
}
// Then loop through all the enemies again...
loop {
enemy = this.findEnemies();
enemyIndex = 0;
// ... and take out everyone who's still standing.
    if (enemy) {
        if (this.isReady("cleave")) {
            this.cleave(enemy);
        }
        else if (this.isReady("electrocute") && this.canElectrocute(enemy) && this.distanceTo(enemy) < 21) {
            this.electrocute(enemy);
            }
        else if (this.isReady("bash") && this.distanceTo(enemy) < 4) {
            this.bash(enemy);
            }
        else{
            this.attack(enemy);
            }
    }
}

#12

It will work better to use a while-loop inside your loop to loop over the throwers. You have enemy = this.findEnemies(), but then enemy is an array, not a propery single enemy from the enemies array. Try like this:

loop {
    var enemies = this.findEnemies();
    var enemyIndex = 0;
    while (enemyIndex < enemies.length) {
        var enemy = enemies[enemyIndex];
        enemyIndex += 1;
        // Now you have the proper enemy and can check its type and cleave it.
        // ...
    }
}

#13

Worked like a charm, thanks!

I can already see some great uses for this logic on the repeatable levels.

Quick question, if new throwers enter the room later, this logic won’t target them 1st again, because I would already be in the 2nd loop, right?


#14

Right; the conceit in this level is that there’s a set group of enemies and you have to first kill the throwers, then kill the rest. If you wanted to do something similar for scenarios where more throwers could spawn, you could wrap both of those sub-loops in a loop, or refactor it to always do a single attack on a thrower if one exists before every attacking a munchkin.


#15

I’m having an issue with this level. I’m getting an error that states - Hard execution limit of 3000000 exceeded. My code is pretty much the same as in the help section for the level, except I’m not using the cleave. Please help.

    enemies = self.findEnemies()
    enemyIndex = 0
    # ... but only attack 'thrower' type enemi
    while enemyIndex < len(enemies):
        enemy = enemies[enemyIndex]
        if enemy.type == 'thrower':
            while enemy.health >0:
                if self.isReady("power-up"):
                    self.powerUp()
                elif self.isReady("bash") and self.distanceTo(enemy) < 4:
                    self.bash(enemy)
                else:
                    self.attack(enemy)
            enemyIndex += 1

#16

According to your indentation, in your first while loop you only increment enemyIndex if type IS thrower…


#17

You are right, I actually figured it out after I already posted the comment. Thank you anyways! :smile:


#18

Im using the classroom version, without a cleave command. i could use the non classroom version too, of course. My problem is it skips to the second loop. my code is:

First, loop through all enemies…

enemies = self.findEnemies()
enemyIndex = 0
while enemies.len > enemyIndex:

… but only attack ‘thrower’ type enemies.

if enemies[enemyIndex].type =='thrower':
    while enemies[enemyIndex].health>0:
        self.attack(enemies[enemyIndex])
enemyIndex = enemyIndex + 1;

Then loop through all the enemies again…

enemies = self.findEnemies()
enemyIndex = 0
while enemies.len>enemyIndex:
# … and take out everyone who’s still standing.
while enemies[enemyIndex].health > 0:
self.attack(enemies[enemyIndex])
enemyIndex = enemyIndex + 1;


#19

Make sure the second

enemies = self.findEnemies()

is outside the first loop (not indented).

Post your code fully formated

code here