Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

Clash Of Clones Help appreciated

while True:
    enemy = hero.findNearestEnemy()
    if enemy.type != "sand-yak":
        hero.attackDamage
        hero.canElectrocute(hero.findNearestEnemy())
        hero.electrocute(hero.findNearestEnemy())
        hero.bash(hero.findNearestEnemy())
        hero.attack(enemy)

this is my code so far. I’m stuck on ways on how to improve it. any tips or tricks would be very helpful. Thank you in advanced. And if its important my hero takes out 1 regular enemy before attacking the clone.

Hi. On my opinion you need quite much health, sword with low damage and “cleave” ability, and damage reflection circlet.
More tips here: [SOLVED] Need help on Clash Of Clones ASAP

while True:
    enemy = hero.findNearestEnemy()
    if enemy.type != "sand-yak":
        hero.attackDamage
        if hero.isReady("cleave"):
            hero.cleave(enemy)
        else:
            hero.bash(enemy)
            hero.attack(enemy)

i updated my code and still doesn’t win. any other tips?

Too simple, as for me) My code is about 100 lines.
And how much health does your hero have?

My characters health is 1144

Looks like not enough to me. Mine is 2850 HP.

ill see what i can do to boost it then

1 Like

how do i target the clone specifically?

If you had levels with targeting enemy types, like “ogre”, “shaman”, “thrower” etc, knowledge that clone type is “captain” for Anya and “knight” for Tharin may help.

I cant find a level with that.

Well, you need to define primary target as enemy with certain type. You need good glasses to be able to see “types”.

while True:
    clone = hero.findByType("clone", hero.findEnemies())
    enemy = hero.findNearestEnemy()
    if enemy.type != "sand-yak":
        if hero.isReady("cleave"):
            hero.cleave(enemy)
        else:
            hero.attack(enemy)

I don’t think I understand what you are saying

Nope. “Clone” won’t help. What hero do you play?

I am currently playing as Anya

So, I’m trying to say that

so replace “clone” with “captain”?

Yep. This is one of the way to specify him.

ok thank you! I will remake my code to properly include it.

1 Like
while True:
    captain = hero.findByType("captain", hero.findEnemies())
    enemy = hero.findNearestEnemy()
    if enemy.type != "sand-yak":
        if enemy == captain:
            hero.attack(captain)
        if hero.isReady("cleave"):
            hero.cleave(enemy)
        else:
            hero.attack(enemy)

so this is my code right now. I’m clearly doing something wrong but I don’t know what. My hero still doesn’t target the clone first.

You define captain already, so if you want to attack him first, you may simply do something like:

captain = hero.findByType("captain", hero.findEnemies())
if captain:
    hero.attack(captain)

I think, it should solve the task of attacking clone firs, but I suppose, won’t help to complete the level.