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"):
        pet.shapeShift()
    if item and item.type == "potion":
        pet.fetch(item)

def summonTroops():
    summonType = troops[len(hero.built) % len(troops)]
    if hero.gold > hero.costOf(summonType):
        hero.summon(summonType)
    if hero.canCast("summon-burl"):
        hero.cast("summon-burl")
    if hero.canCast("summon-undead"):
        hero.cast("summon-undead")
    if hero.canCast("summon-yeti"):
        hero.cast("summon-yeti")
    if hero.gold > hero.costOf(summonType):
        hero.summon(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)
                else:
                    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"):
            hero.cast("raise-dead")
    if enemy and enemy.type == "ogre" and enemy.health > 240:
        if hero.canCast("fear"):
            hero.cast("fear", enemy)
        elif hero.canCast("time-travel"):
            hero.cast("time-travel", enemy)

while True:
    enemy = hero.findNearestEnemy()
    summonTroops()
    commandTroops()
    castSpells()
    pet.on("spawn", onSpawn)
    if hero.health < 500:
        if hero.canCast("invisibility"):
            hero.cast("invisibility", hero)
            if enemy:
                hero.cast("drain-life", enemy)
        if hero.health < 70:
            hero.cast("undying-charm", hero)
            if enemy:
                hero.cast("drain-life", enemy)
    else:
        if enemy and enemy.health >= 120:
            hero.attack(enemy)
        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.