Backwoods Brawl 8 help

I am on backwoods brawl level 8, my code is all working, I did everything I can do, casted every spell I can cast. I literally used up everything, but everytime I submite, I still cannot get past the 30-second-line. Here’s my code:

# Stay alive for one minute.
# If you win, it gets harder (and more rewarding).
# If you lose, you must wait a day before you can resubmit.
# Remember, each submission gets a new random seed.

troops = ["soldier", "griffin-rider"]

def onSpawn(spawn, event):
    item = hero.findNearestItem()
    if pet.isReady("shape-shift"):
    if item and item.type == "potion":

def summonTroops():
    summonType = troops[len(hero.built) % len(troops)]
    if > hero.costOf(summonType):
    if hero.canCast("summon-burl"):
    if hero.canCast("summon-undead"):
    if hero.canCast("summon-yeti"):
    if > hero.costOf(summonType):

def commandTroops():
    friendIndex = 0
    friends = hero.findFriends()
    while friendIndex < len(friends):
        friend = friends[friendIndex]
        enemy = friend.findNearestEnemy()
        if enemy:
            if friend.type == "griffin-rider":
                if enemy.type == "fangrider":
                    hero.command(friend, "attack", enemy)
                if enemy.type == "shaman":
                    hero.command(friend, "attack", enemy)
                elif enemy.type == "thrower":
                    hero.command(friend, "attack", enemy)
                elif enemy.type == "ogre":
                    hero.command(friend, "attack", enemy)
                elif enemy.type == "headhunter":
                    hero.command(friend, "attack", enemy)
            elif friend.type == "soldier":
                if enemy.type == "munchkin":
                    hero.command(friend, "attack", enemy)
                    hero.command(friend, "attack", enemy)
        friendIndex += 1

def castSpells():
    enemy = hero.findNearestEnemy()
    if hero.time > 5:
        if hero.canCast("chain-lightning"):
            hero.cast("chain-lightning", enemy)
        if hero.canCast("poison-cloud"):
            hero.cast("poison-cloud", enemy)
    if hero.time > 10:
        if hero.canCast("raise-dead"):
    if enemy and enemy.type == "ogre" and > 240:
        if hero.canCast("fear"):
            hero.cast("fear", enemy)
        elif hero.canCast("time-travel"):
            hero.cast("time-travel", enemy)

while True:
    enemy = hero.findNearestEnemy()
    pet.on("spawn", onSpawn)
    if < 500:
        if hero.canCast("invisibility"):
            hero.cast("invisibility", hero)
            if enemy:
                hero.cast("drain-life", enemy)
        if < 70:
            hero.cast("undying-charm", hero)
            if enemy:
                hero.cast("drain-life", enemy)
        if enemy and >= 120:
        elif enemy:
            hero.cast("drain-life", enemy)

Maybe I should summon robobombs? But because it damages humans too so I prefer not summoning it.

Have you tried the oak wind staff? It has a windstorm ability that pushes light enemies(Munchkins, throwers) and projectiles away from the hero. Circling around the map w/ a fast wizard hero and invisibility should help.

Should I use Nalfar?

I think Omarn would probably be a good choice.

Okay, let me try it.