Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

[SOLVED] Need help with grim determination

summonTypes = ['griffin-rider']


def summonTroops():
    type = summonTypes[len(hero.built) % len(summonTypes)]
    if hero.gold > hero.costOf(type):
        hero.summon(type)



def lowestHealthPaladin():
    lowestHealth = 99999
    lowestFriend = None
    friends = hero.findFriends()
    for friend in friends:
        if friend.type != "paladin":
            continue
        if friend.health < lowestHealth and friend.health < friend.maxHealth:
            lowestHealth = friend.health
            lowestFriend = friend

    return lowestFriend


def commandPaladin(paladin):
    if (paladin.canCast("heal")):
        target = lowestHealthPaladin()
        if target:
            hero.command(paladin, "cast", "heal", target)
    elif (paladin.health < 200):
        hero.command(paladin, "shield")
    else:
        target = paladin.findNearestEnemy()
        if (target):
            hero.command(paladin, "attack", target)


def commandPeasant(peasant):
    item = peasant.findNearestItem()
    if item:
        hero.command(peasant, 'move', item.pos)


def commandGriffin(griffin):
    target = hero.findNearest(hero.findByType('warlock'))
    if not target:
        target = griffin.findNearestEnemy()
    if (target):
        hero.command(griffin, "attack", target)


def commandFriends():
    
    friends = hero.findFriends()
    for friend in friends:
        if friend.type == "peasant":
            commandPeasant(friend)
        elif friend.type == "griffin-rider":
            commandGriffin(friend)
        elif friend.type == "paladin":
            commandPaladin(friend)


while True:
    commandFriends()
    summonTroops()

when i run it, it says success, but when i submit it, my guy reynaldo gets one shotted by an arrow.

Bruh.

I would keep submitting it until you get a successful seed (it took me one try).
I’m still not sure whether it was friendly fire though…

1 Like

If you use Chrome, try to open this level in Mozilla or any other browser. And vice versa. It often helps get another seed quickly.

thank you, i will try

hmmm…lemme try that

i just resubmitted and it worked! Thank you guys!