The one wizard help

Is there something wrong with my code?

# Defeat as many ogres as you can.
# Use 'cast' and 'canCast' for spells.
while True:
    enemy = hero.findNearestEnemy()
    if enemy:
        if hero.canCast("chain-lightning"):
            hero.cast("chain-lightning", enemy)
    elif enemy:
        if hero.canCast("lightning-bolt"):
            hero.cast("lightning-bolt", enemy)
    else:
        hero.moveXY(28, 16)


Why are you using elifs and ifs to check for an enemy? Merge those two into one if statement

1 Like

Try using hero.cast("root", target) and then killing the target by using hero.attack(target)

is this solved? it was created on the 19th of february 2019!!!

Yes probably, please don’t revive dead topics, underboy is not active anymore so you just wasted you post.

1 Like

i noticed after i rplied