[SOLVED] Clash of Clones - Is it possible to win?

i did it. It was super hard and i messed up a lot but then i used a weaker sword that could attack faster and i won.

Я прошел, это было сложно)

Оказывается нельзя выкладывать решения.
Мне помогло сначала найти лучников и убивать их, попутно убивая врагов ближе 5 метров.
Еще как только появлялся шаман на карте его надо обязательно убить прерывая другие циклы.
Если у героя остается мало жизни то надо обращаться в бегство)

Mod edit: Please do not post final solutions. Thanks.

Hi. Thanks for sharing your code but I’m afraid I’m going to have to ask you to get rid of it. The point of this forum is to help people and, although this level has no right answer, if there is a solution available people will most likely use it. I think you learn a lot more when you work it out yourself.
Thank you for your understanding, and congratulations on beating the level, it’s difficult.
-Danny

I’ve noticed that a lot of the people who’ve beaten it say to do it with out a primary weapon, but I can’t start the level without one? Did that get changed or something?

Well, I’m not sure I agree with that, at least with the code/strategy I came up with. Here’s what I completed it with:
image

I think maka summed it up best:

Well, believe it or not, but I have gotten this far with out buying any gems and I intend to keep it that way. Not trying to put you down but I think you learn more if you don’t subscribe and have to work for what you get. I was also asking for help, not trying to complain. Here is my code…

# You'll need good strategy to win this one!
# Your clone will have the same equipment you have!
# But, they're not very skilled at using special powers.
while True:
    enemy = hero.findNearestEnemy()
    flag = hero.findFlag("green")
    if flag:
        hero.pickUpFlag(flag)
    if enemy and enemy.health > 0 and enemy.type != "yak":
        hero.attack(enemy)
        if hero.isReady("bash"):
            hero.bash(enemy)
        enemy = hero.findNearestEnemy()
        if hero.health < hero.maxHealth:
            hero.shield()

I will post my gear on request.

No offense taken. I too did not purchase gems…I also completed all free levels, before I subscribed. Sorry, I did not understand that you were asking for help. My ‘not agree’ remark was meant to say, I figured out a way to use the longsword and a bashing shield…no offense meant there either :slight_smile:

So, with all that having been said…your code looks like a pretty good start. I’d recommend targeting the archers first…they are the weakest, yet do the most damage.

I can’t figure out how to do that. Here is what I have so far

    if hero.distanceTo(enemy) > 50:
        while enemy and enemy.health > 0 and enemy.type != "yak":
            hero.attack(enemy)
            if hero.isReady("bash"):
                hero.bash(enemy)
            if hero.isReady("cleave"):
                hero.cleave("cleave")
            enemy = hero.findNearestEnemy()
            if hero.health < hero.maxHealth:
                hero.shield()

That is just the archer targeting and attacking, I didn’t change anything else.

here is my stuffme stuff

In my case, I grab a snapshot of the enemies. I then iterate through that array, comparing each, until I end up with the closest (enemy) archer and soldier…I have my hero attack that archer and then move down the line. Part of the code I use for that is:

            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]

Yes, there is a bit more determinations and decisions before this.

Your equipment set looks pretty good too.

Oh, I also moved my hero, via moveXY, to the top of the archer line, still inside the soldiers…this makes the archers closer. Then I determined which archer or soldier was where.

I have one thing to add to what @dedreous said:
I see you have the Jump boots, why don’t you use them? If you jump into the middle of the archers and cleave at the start you have a significant advantage. I used that tactic.

I can’t seem to jump to a coordinate point with them tho

@JamesClanCodeMaster, What coordinate method are you using?..this aspect gave me tons of trouble at first.

The ‘help’ for jumpTo demonstrates using the full vector, jumpTo({“x”: 24, “y”: 35}), but you can also use other methods, such as the .pos of an object:

def moveTo(position):
    if (hero.isReady("jump")):
        hero.jumpTo(position)
    else:
        hero.move(position)

def attack(target):
    if target:
        if (hero.distanceTo(target) > 10):
            moveTo(target.pos)
        else:
            hero.attack(target)

If I do this

hero.jumpTo({"x": 100, "y": 70})

the hero jumps half way to the point and I only got them so I could do that.

Gotcha. There is a max distance the boots will jump and if the destination is greater than that, he walks the rest of the way…sorry, I don’t recall the specifics on this.

If this is really what’s happening, I’d recommend walking a bit of the way first, then jump the final and cleave away!

I nearly have it, but right at the end my hero goes and attacks a yak even though I have this

if enemy and enemy.health > 0 and enemy.type != "yak":

I finished!!! But my hero still attacked the yak. :rofl:

1 Like

sorry for the multiple posts.