Is there a way to check how many enemies are around before using Cleave?


#1

I’m trying to find a way to make through Backwoods Brawl but it would be better to only use cleave if there was 2 or more enemies around;

loop:
enemy = self.findNearestEnemy()
if not enemy:
     self.shield()
elif enemy.type is "thrower":
    self.attack(enemy)
elif self.isReady("cleave") and self.distanceTo(enemy) < 10:
    self.cleave(enemy)
else:
    self.attack(enemy)

#2

With upgraded glasses you get use this.findEnemies() which returns an array of all enemies which you can then loop over.


#3

Yep, you need better glasses if you want more information than just the nearest enemy.


#4

Do i earn them? Or do i have to buy them?


#5

for now you have to buy them


#6

I’m not sure if they are ever earned, I think you will need to buy them, but you probably have enough gems in order to do so. Of course, the higher level of glasses you buy, the more options you will have in the future and the lower chance you’ll need to buy another pair.


#7

As of yet, you do not earn them.

Look at the thread below to see which items are earned and what the do.

http://discourse.codecombat.com/t/when-do-i-get-which-item-a-reference/2212?u=j_f_b_m


#8

Yes, you can check but to do so you would need a special type of glasses. But it would cost gems or earning them. :grin: