Summits gate javascript (this is just to change the title)

In the stage where the warlock and the skeletons are the skeletons keep killing me and I have no clue what to do. when I enter the area of the warlock I have about 1000 health.
This is my code for the warlock part (just so people can’t copy my code).

while (true) {
    var enemy = hero.findNearestEnemy(); 
    if (enemy) {
        if (hero.canCast('chain-lightning')){
            hero.cast('chain-lightning', enemy);
        }else{
            hero.attack(enemy);
        }
    }
}

Any suggestions on where to change my code? Thanks

I had 1548 HP at this point , but I think, there is one more difference. I used chain-lightning, attack, bash and shield abilities and paladin healing.

Did it work for you?
Does ‘bash’ have a cooldown?
I tried to use command to command my troops but it has an error saying that the hero needs something
to command

Yes, it worked, I passed this level quite a long time ago.
Yes, it has.
Such error often appears when you do something to anything without checking that it exists.

What sword did you use? I’m using the Runesword. It does more damage than my shield’s bash.
Do the warlock and skeletons count as ogres? Also, I know the door is an enemy, but could you tell me what enemy type it is? thanks

I used Runesword too. You can use Viking Helmet if you have it to power-up your bash damage. I did so in this level.

Ironically, all three types you are asking about, you already named)

warlocks = self.findByType("warlock", self.findEnemies())
doors = self.findByType("door", self.findEnemies())

I didn’t define skeletons in this level, but I believe, they are skeletons = self.findByType(“skeleton”, self.findEnemies())
Actually, you can click on enemy you want to know type and on the bar at the bottom of level map will appear his name and type.

Oh, I’m sorry, I forgot that you use JavaScript and I play Python. But you understand the idea, I think.

I haven’t seen the viking helmet before. Where do you get it from?
So the warlock and the skeletons count as ogres?

Do you want me to private message you my code?

When I was playing forest map, it was possible to gain Viking Helmet here: CodeCombat - Coding games to learn Python and JavaScript?
as far as I see, level is still available.

It depends on what you mean. I’m not sure I understood in right way.
Their team is “ogres” but their types are warlock and skeleton.

So, you can define them as ogres, by replacing enemies to ogres:
enemies-> ogres= self.findEnemies()
enemy-> ogre= self.findNearest(ogres)

Sorry I’m not subscribed so I can’t play that level

Me too. In my time it was free. Yesterday I saw its flag is blue, but with clicking on it - it opened as usual. Did you try to play it?

Yeah I did but it it told me that I couldn’t play it

Oh, sorry about that, I didn’t know it goes like this(