[SOLVED] Clash of Clones. Need Help

I need help with my code. I am always loosing. Can anyone Help!

He is my code:

while True:
enemy = hero.findNearestEnemy()
if hero.isReady(“electrocute”):
elif hero.isReady(“bash”):
elif enemy and hero.canCast(“grow”, hero):
hero.cast(“grow”, hero)
elif enemy and hero.canCast(“drain-life”, enemy):
hero.cast(“drain-life”, enemy)
elif enemy and hero.cast(“chain-lightning”, enemy):
hero.cast(“chain-lightning”, enemy)
elif hero.health > 500 and hero.canCast(“heal”, hero):
hero.cast(“heal”, hero)
elif enemy and hero.canCast(“force-bolt”, enemy):
hero.cast(“force-bolt”, enemy)

I don’t really think just attacking the enemy will work.
The way I did it was to find the enemy with the lowest health, and if my hero had enough health, attack it.

Oh, and you can format your code properly by selecting the arrows (if you hover your cursor above it, it should say preformatted text) and pasting or writing your code there.

while True:
    friends = hero.findFriends()

Thanks for the help, I finished the level.

1 Like