New Level: Shield Rush

Level ends before second wave engages.

Code used:
if (this.isReady(“cleave”))
this.cleave(this.findNearestEnemy());
else
this.shield();

I’ve fixed it up now so that it’ll keep going. You’ll probably want to put that code in a loop, though.

2 Likes

Works correctly now, and a loop was indeed needed! Is there a way to mark this as solved now?

loop
{
    if (this.isReady("cleave")); 
    {
        this.cleave(this.findNearestEnemy());
    }
    else 
    {
    this.shield();
    }
}

I dont understand what is my mistake, anyone can help me?

Remove the semicolon after your if statement as it ends the statement prematurely. It’s similar to not using the semicolon after else as it’s a condition.

Thanks so much for this post!! lol i also had the semi colon and tried for half an hour to find the problem before i checked here. all fixed now :smiley:

2 Likes

I tried to do this level in Clojure and it seems as if shield is not working right? I can’t survive until cleave is ready again. When I did this in python, shield() had a different sprite and I could tell I was taking less damage. In Clojure (.shield this) did not change the sprite and might not be lowering damage?

This is the code I thought would work.

(dotimes [n 100]
    (if (.isReady this "cleave")
        (.cleave this (.findNearestEnemy this))
        (.shield this)
    )
)

If you reverse the order of the if/else clauses, can you get the shield to work? (Wondering if it’s a problem with shield or our if-statements in Clojure.)

The if/else seems to be working because I can replace shield with (.say this n) and get what iteration I’m on. I tried putting just a shield in a loop and I seem to die about the same rate as if I have no code.

I can create a new thread of a github issue if there is a better place for this.

I think it might be related to this one: https://github.com/codecombat/aether/issues/124

It doesn´t work to me:

loop {
    if (this.isReady("cleave"))
this.cleave(this.findNearestEnemy());

else
this.shield();

}

I found I didn’t survive until the second cleave was ready (javascript), but you could try moving to the bottom right of the field, this gives you a it more time without being attacked, and then the cleave becomes ready.

It´s make me crazy, i quick!

It seems like something has changed to cause this level not to pass anymore with my old working code. Perhaps the newer item have less health to survive the second attack now. Nick, could you take a look?

loop {
    if (this.isReady("cleave"))
        this.cleave(this.findNearestEnemy());
    else
        this.shield();
}

Ah, thanks for the heads up! We had noticed a typo with the female ogre munchkin speed and corrected it, but that broke the balance in this level. I’ve adjusted it again; let me know how it goes.

1 Like

This code should work:

loop:

if self.isReady("cleave"):
    enemy = self.findNearestEnemy()
    self.cleave(enemy)

else:
    self.shield()
  self.attack(enemy)

if it doesn’t maybe you don’t have enough health???

I’ve been stuck for the past 30 minutes, not sure what I did wrong.

I think you don’t have enough health to survive until the second cleave is ready. You might need to upgrade your armor.

Yeah, Hattori isn’t quite as tough as Tharin or Anya (he’s faster and does more damage), so he needs more armor to survive levels like this.

Please Check the shield action if working or not using python language , i tried to use it even before cleaving them and it doesn’t work , The if/else stat is working good but the shield function ain’t working pls fix it