How do you defeat clash of clones?

Well when I did it, they did nothing so…

Only shielding will not work, as you yourself will need to fight as well.

here is my code i have bee stuck for ages pls help:
while True:
enemyIndex = 0
enemies = self.findEnemies()
while enemyIndex < len(enemies) and self.health > self.maxHealth / 4:
enemy = enemies[enemyIndex]
enemyIndex += 1
if enemy.type != ‘sand-yak’:
while enemy.health > 0:
if self.isReady(“electrocute”):
hero.electrocute(enemy)
if self.isReady(“bash”):
hero.bash(enemy)
if self.isReady(“cleave”):
hero.cleave(enemy)
else:
self.attack(enemy)
if self.health <= self.maxHealth / 4:
enemy = enemies[enemyIndex]
enemy=hero.findNearestEnemy()
distance=hero.distanceTo(enemy)
enemyIndex += 1
while enemy.health>0 :

        if distance < 4:
            if self.isReady("cleave"):
                self.cleave(enemy)
            else:
                self.attack(enemy)
        else:
            self.attack(enemy)

please do not necrompost, this is a dead topic, don’t revive it.

Again, it’s fine as long as it is in the same topic

1 Like

Please read this topics before posting your code, it requires little effort.

Here is my code, my hero dies every time.

self.moveXY(68, 78)
back = 0
while True:
    enemys = self.findEnemies()
    index = 0
    closest_soldier = None
    soldier_dist = 999
    closest_archer = None
    archer_dist = 999
    closest = None
    dist = 999
    while(index<len(enemys)):
        distance = self.distanceTo(enemys[index])
        if(enemys[index].health>0 and enemys[index].type != "sand-yak" ):
            if(enemys[index].type == 'archer' and distance<archer_dist):
                archer_dist=distance
                closest_archer = enemys[index]
            if(enemys[index].type == 'soldier' and distance<soldier_dist):
                soldier_dist=distance
                closest_soldier = enemys[index]
            if(distance<dist):
                soldier_dist=dist
                closest = enemys[index]
        index +=1
    if(closest_soldier and soldier_dist<10):
        enemy = closest_soldier
    elif(closest_archer and archer_dist<20):
        enemy = closest_archer
    else:
        enemy = closest
    if(enemy):
        if(self.health<self.maxHealth/2.5 and back==0):
            self.moveXY(40, 85)
            back = 1
        elif(self.health<self.maxHealth/5 and back==1):
            self.moveXY(40, 85)
            back = 2
        elif(self.isReady("electrocute")):
            self.electrocute(enemy)
        elif(self.isReady("bash")):
            self.bash(enemy)
        elif(self.isReady("power-up")):
            self.powerUp()
            self.attack(enemy)
        elif(self.isReady("cleave")):
            self.cleave(enemy)
        else:
            self.attack(enemy)

HP:900
Damage:6 (bash=74.5)
(have electrocute)

i only posted on here because i dont know how to make my own.

Please try to write your own. Because you won’t learn anything if ou don’t write it. Hint: try to cleave near enemy archers.

2 Likes

I meant to say my own question, also, I cant cleave

You have to have a sword that can cleave like long sword

Ok, ill try that out.

It didn’t work, my hero did cleave when there were no enemies around. @milton.jinich

Show me your updated code

ok.

self.moveXY(68, 78)
back = 0
while True:
    enemys = self.findEnemies()
    index = 0
    closest_soldier = None
    soldier_dist = 999
    closest_archer = None
    archer_dist = 999
    closest = None
    dist = 999
    while(index<len(enemys)):
        distance = self.distanceTo(enemys[index])
        if(enemys[index].health>0 and enemys[index].type != "sand-yak" ):
            if(enemys[index].type == 'archer' and distance<archer_dist):
                archer_dist=distance
                closest_archer = enemys[index]
            if(enemys[index].type == 'soldier' and distance<soldier_dist):
                soldier_dist=distance
                closest_soldier = enemys[index]
            if(distance<dist):
                soldier_dist=dist
                closest = enemys[index]
        index +=1
    if(closest_soldier and soldier_dist<10):
        enemy = closest_soldier
    elif(closest_archer and archer_dist<20):
        enemy = closest_archer
    else:
        enemy = closest
    if(enemy):
        if(self.health<self.maxHealth/2.5 and back==0):
            self.moveXY(40, 85)
            back = 1
        elif(self.health<self.maxHealth/5 and back==1):
            self.moveXY(40, 85)
            back = 2
        elif(self.isReady("electrocute")):
            self.electrocute(enemy)
        elif(self.isReady("bash")):
            self.bash(enemy)
        elif(self.isReady("power-up")):
            self.powerUp()
            self.attack(enemy)
        elif(self.isReady("cleave")):
            self.cleave(enemy)
        else:
            self.attack(enemy)

Can you give me a screen shot of your equipment

sure.

this is what im using but i have obsidian chest and engraved obsidian helmate

try to electrecute a archer using

if hero.isReady("electrocute") and enemy.type != "soldier":
   hero.castElectrocute("enemy")
else:
     hero.attack(enemy)

um, electrocute doesn’t do any dmg. electrocute a soldier, as it slows it’s victims down.

Try to move near clone’s archers and cleave there.

1 Like

Exactly it will slow the archer down making it harder to attack making your team do more damage and more of your soldier/archers survive and you win.