you would go:
if hero.canCast("chain-lightning"):
hero.cast("chain-lightning", target)
You need special gloves or a book to do this.
Mumbo_6
you would go:
if hero.canCast("chain-lightning"):
hero.cast("chain-lightning", target)
You need special gloves or a book to do this.
Mumbo_6
Ok, thanks.
Lydia
20 chars
this is only python, if you want java I can try, but ask AnSeDra if he can help you
I’m only doing Python right now.
Lydia
Try this @Lydia_Song. And you need Emperor’s gloves to cast Chain Lightning.
Andrei
if hero.canCast("chain-lightning"){
hero.cast("chain-lightning", target)
}
I think thats how you do it.
Mumbo_6
This is how you can cast Chain Lightining in Phyton:
if hero.canCast("chain-lightning"):
hero.cast("chain-lightning", enemy)
Andrei
Because my pender’s health is only 65, I get killed instantly.
Code: IDK if it works, tell me if it works and I will remove it.
def attackYeti():
yeti = hero.findByType("yeti-cub")[0]
if yeti:
hero.attack(yeti)
else:
break
def summon():
if hero.gold > hero.costOf("soldier"):
hero.summon("soldier")
else:
break
def command():
friends = hero.findFriends()
for friend in friends:
enemyF = friend.findNearestEnemy()
if enemyF:
hero.command(friend, "attack", enemyF)
if not enemyF:
break
def friendMove():
friends = hero.findFriends()
for friend in friends:
hero.command(friend, "move", {'x':53, 'y':47})
def attack():
enemy = hero.findNearestEnemy()
if enemy:
if hero.canCast("chain-lightning", enemy):
hero.cast("chain-lightning", enemy)
elif hero.canCast("drain-life", enemy):
hero.cast("drain-life", enemy)
elif hero.canCast("fear", enemy):
hero.cast("fear", enemy)
elif hero.canCast("poison-cloud", enemy):
hero.cast("poison-cloud", enemy)
elif hero.canCast("raise-dead", enemy):
hero.cast("raise-dead")
elif hero.canCast("magic-missile", enemy):
hero.cast("magic-missile", enemy)
hero.attack(enemy)
def collect():
item = hero.findNearestItem()
if item:
hero.move(item.pos)
else:
break
while True:
friends = hero.findFriends()
yeti = hero.findByType("yeti-cub")[0]
enemy = hero.findNearestEnemy()
if hero.gold > hero.costOf("soldier"):
summon()
for friend in friends:
enemyF = friend.findNearestEnemy()
if enemyF:
command()
if not enemyF:
friendMove()
if enemy:
if yeti:
attackYeti()
if not yeti:
if hero.isReady("resetCooldown"):
hero.resetCooldown("raise-dead")
else:
attack()
else:
hero.moveXY(19, 40)
Lydia
First cast poison cloud when you see an enemy. Then check if there is any corpse and if so, cast raise dead if it is ready. Then cast and do the rest.
Andrei
I am no subscriber unfortunately so I cannot test @Lydia_Song’s code…
Mumbo_6
How would I check if there is any corpse?
Lydia
I only have 827 gems, I can buy this:

And can anyone tell me if this:

Is going to be helpful in this level?
Lydia
By finding the corpses, putting them in an array, then check if the length of the array is not 0.
Andrei
I do not know what that is.
oh, maybe IDK
Mumbo_6
def attackYeti():
yeti = hero.findByType("yeti-cub")[0]
if yeti:
hero.attack(yeti)
else:
break
def summon():
if hero.gold > hero.costOf("soldier"):
hero.summon("soldier")
else:
break
def command():
friends = hero.findFriends()
for friend in friends:
enemyF = friend.findNearestEnemy()
if enemyF:
hero.command(friend, "attack", enemyF)
if not enemyF:
break
def friendMove():
friends = hero.findFriends()
for friend in friends:
hero.command(friend, "move", {'x':53, 'y':47})
def attack():
enemy = hero.findNearestEnemy()
if enemy:
if hero.canCast("chain-lightning", enemy):
hero.cast("chain-lightning", enemy)
elif hero.canCast("drain-life", enemy):
hero.cast("drain-life", enemy)
elif hero.canCast("fear", enemy):
hero.cast("fear", enemy)
elif hero.canCast("poison-cloud", enemy):
hero.cast("poison-cloud", enemy)
elif hero.canCast("raise-dead", enemy):
hero.cast("raise-dead")
elif hero.canCast("magic-missile", enemy):
hero.cast("magic-missile", enemy)
hero.attack(enemy)
def collect():
item = hero.findNearestItem()
if item:
hero.move(item.pos)
else:
break
def findCorpses():
corpses = hero.findCorpses()
corpseIndex = 0
for corpse in corpses:
corpse = corpses[corpseIndex]
if corpse:
if hero.canCast("raise-dead"):
hero.cast("raise-dead")
else:
break
while True:
friends = hero.findFriends()
yeti = hero.findByType("yeti-cub")[0]
enemy = hero.findNearestEnemy()
if hero.gold > hero.costOf("soldier"):
summon()
for friend in friends:
enemyF = friend.findNearestEnemy()
if enemyF:
command()
if not enemyF:
friendMove()
if enemy:
if yeti:
attackYeti()
if not yeti:
if hero.canCast("poison-cloud", enemy):
hero.cast("poison-cloud", enemy)
else:
attack()
else:
hero.moveXY(55, 27)
if enemy:
if yeti:
attackYeti()
if not yeti:
if hero.canCast("poison-cloud", enemy):
hero.cast("poison-cloud", enemy)
else:
attack()
hero.moveXY(19, 40)
My hero still just dies before she could attack.
Lydia
I do not think that you did what I told you to.
Andrei
Sorry, I’ve always had some trouble with arrays.
Lydia
Well, can you please try to solve it? I am going to bed soon, so tomorrow I will try to help you more. And try to simplify the code so it will be easier for both of us to watch the code and see what is wrong.
Andrei
What do you mean by ‘simplify’?
Lydia