Sarven Shepherd


#1

Can you please help me with my code. Basically it works, but i have only 365 health so i die wery soon. How can i make it work with so little health?

my code:
loop:
enemies = self.findEnemies()
enemyIndex = 0

while enemyIndex < len(enemies):    
    enemy = enemies[enemyIndex]
    if enemy.type != "sand-yak":
   
        while enemy.health >0:
            if self.isReady("cleave") :
                self.cleave(enemy)
            else:
                self.attack(enemy)
    enemyIndex = enemyIndex +1
    pass

self.moveXY(40, 32)

#2

You can take out the pass; it serves only as a placeholder in the sample code.

Assuming you are using the long sword, it may help somewhat to remove the cleave command; since enemies show up in groups of no more than two, it is more effective to stick to attacking. I’m not sure whether it’s practical to beat this level without better items; when I tried it using the Long Sword, I lost 672 health with basically the same code as yours.

You may just have to upgrade your equipment. In my trials, the Short Sword cut health loss to 576, and the Darksteel Blade with power-up to 336 (not that I would necessarily especially recommend those; they just happened to be the ones I owned). Alternatives include buying items to increase your health and buying a shield that has bash capability. If you have enough gems, you could even get the Emperor’s Gloves. Or if you don’t want to upgrade, you could maybe even kill the ogres using a hammer to build fire traps. There are many options indeed.


#3

Make more efficient use of your cleave. Maybe only use it if there are multiple enemies. If there are too many enemies for you to handle then you could shield until cleave is ready.

No enemies on field? Make use of that time too. Prior poster had a good suggestion.


#4

cleave with the Long Sword does 10 damage per target, while attack does 27.62 damage. Since enemies in Sarven Shepherd come in groups of no more than two, cleave can do a maximum damage of 20 (unless you don’t defeat scouts before others arrive, in which case you’re in serious trouble). This is less efficient than simply using attack. For more information, see https://codecombat.com/editor/thang/long-sword. With the Long Sword and the Bronze Shield, a cleave/shield strategy loses even when starting out with 827 health.


#5

Actually it cleaves for 15. The cleave damage is not upgraded by the hero’s attack multiplier, though, so the normal attack is still significantly better against one or two targets for heroes with a decent attack multiplier like most warriors.


#6

Ah, you’re right. I glanced at the wrong number.