How do you do the kelvintaph defiler


Can you guys help me with kelvintaph defiler


Please post your code so we can help. Also provide a detailed explanation of the issue.


ok thanks for telling me


step = 0

def choiseTarget(enemies):
for enemy in enemies:
for att in attack:
if att[0] == enemy.pos.x and att[1] == enemy.pos.y:
return enemy
return None

def commandTroops():
for index, friend in enumerate(hero.findFriends()):
if (step == 0 and friend.pos.y > 60 and (friend.type != ‘archer’ or > 3.7)):
enemy = friend.findNearestEnemy()
if enemy:
hero.command(friend, “attack”, enemy)
elif step == 4:
hero.command(friend, “move”, {‘x’: 42, ‘y’: 67})
elif friend.type == ‘archer’:
elif friend.type == ‘paladin’:

def CommandPaladin(soldier):
if step < 4:
if (soldier.canCast(“heal”) and > 3):
hero.command(soldier, “cast”, “heal”, soldier)
elif > 3 and < soldier.maxHealth * 0.7:
hero.command(soldier, “shield”)

def CommandSoldier(soldier):
if step < 4:
if soldier.pos.x < 74:
hero.command(soldier, “move”, {‘x’: 76, ‘y’: 76})
enemy = soldier.findNearestEnemy()
if enemy:
hero.command(soldier, “attack”, enemy)

def CommandArcher(soldier):
if step == 1:
if soldier.pos.y > 60:
hero.command(soldier, “move”, {‘x’: 22, ‘y’: 55})
enemies = soldier.findEnemies()
for enemy in enemies:
if enemy.type != ‘yeti’:
hero.command(soldier, “attack”, enemy)
elif step == 2:
if soldier.pos.x > 14:
hero.command(soldier, “move”, {‘x’: 8, ‘y’: 77})
enemy = soldier.findNearestEnemy()
if enemy:
hero.command(soldier, “attack”, enemy)
elif step == 3:
if soldier.pos.x < 74:
hero.command(soldier, “move”, {‘x’: 76, ‘y’: 76})
enemy = soldier.findNearestEnemy()
if enemy:
hero.command(soldier, “attack”, enemy)

def moveTo(position, fast=True):
if (hero.isReady(“jump”) and fast):

index = 0
route = [[33, 12, False], [34, 9, False], [32, 6, False]]

def moveHero():
if len(route) > index:
moveTo({‘x’: route[index][0], ‘y’: route[index][1]}, route[index][2])
if (hero.pos.x == route[index][0] and hero.pos.y == route[index][1]):
return True
return False

def attack(target):
if target:
if (hero.distanceTo(target) > 10):
elif (hero.isReady(“bash”)):

while True:
if ( > 6 and < 12):
step = 1
elif ( > 10 and < 17):
step = 2
elif ( > 15 and < 30):
step = 3
elif ( > 28 and < 600):
step = 4
if step < 4:
if moveHero():
index = index + 1
enemy = hero.findNearest(hero.findEnemies())
if enemy:
moveTo({‘x’: 74, ‘y’: 44})


and can you help with the bonus because i am close to the next achievment


Here’s your formatted code:

same code :rofl:

If you put forth an effort into making your own solution, I’ll offer you help.


what do you mean i don’t get it


Do you know what the code you posted does? Can you understand most of it?

If you don’t, I suggest you to erase the code you have now. Write your own program from scratch. There’s a lot that goes on in this level, and you’ll have an easier time coding your own program instead of looking at someone else’s program.


Its @RobAnybody’s code.


lol :rofl: . thats all i can say.


Yep, I’ve seen the same code in about 100 different places. You can look up codecombat + level name + solution and there is a github page by vadim-job-hg with code solution. HaHaHa…


someone should copyright this… XD :rofl::joy:


I know right…
(Twenty charecters limit can be annoying, so I post this with short posts,
which works.)


i know it is really annoying


we should ask leaders to remove 20 character limit and instead just warn all the members that should they spam short posts, they would lose their privileges or something.


LOL tbh i just stole @RobAnybody’s code and modified it greatly and finished the level.
Thank you, RobAnybody, for your code, since i don’t want to spend hours typing out the base portion of it.


Great job, I am still stuck on it. Can you give me any tips?


This is the most publicized tip of the world, but in case you didn’t know, Your units can attack mid-air if not in fear.
Second hint deleted since @Chaboi_3000 says it gives away too much.


I didn’t say it was too long. I just said it gave away too much.


done! :slight_smile: I’ll give more hints, but that’s the best i can do now.