One Wizard Help

I have 32 kills but can’t get 44, I ‘die’ when the ogres spawn.

# Defeat as many ogres as you can.
# Use 'cast' and 'canCast' for spells.
while True:
    enemy = hero.findNearestEnemy()
    if not enemy and hero.canCast("regen", hero) and hero.health < hero.maxHealth *0.6:
        hero.cast("regen", hero)
    if enemy and enemy.type != "catapult":
        if hero.canCast("lightning-bolt", enemy):
            hero.cast("lightning-bolt", enemy)
        elif hero.canCast("chain-lightning", enemy):
            hero.cast("chain-lightning", enemy)
        elif hero.canCast("root", enemy) and hero.distanceTo(enemy)>5:
            hero.cast("root", enemy)
            hero.attack(enemy)
        elif not enemy and hero.canCast("regen", hero):
            hero.cast("regen", hero)
    else:
        if enemy:
            hero.say("C'mon! Move you stupid catapult!")
            hero.say("C'mon!")
            hero.moveXY(hero.pos.x+20, hero.pos.y)
            hero.cast("lightning-bolt", enemy)
            hero.moveXY(hero.pos.x-20, hero.pos.y)
            if enemy.type == "ogre":
                hero.moveXY(7, 31)