[solved] Distracting Dungeon Help!


#1

I need help, and I have been stuck on it for so long. @kinasharma01
This is my code:

peasant = hero.findNearest(hero.findFriends())
while True:
    # Command your friend to build a decoy towards x + 1:
    hero.command(peasant, "buildXY", "decoy", hero.pos.x+1, hero.pos.y)
    tDest = {"x": hero.pos.x, "y": hero.pos.y + 28};
    while hero.distanceTo(tDest) > 1:
        hero.move(tDest)
        hero.command(peasant, "move", tDest)
    # Create a new x/y dict +28 units away in the x dir:
    tDest = {"x": hero.pos.x + 28, "y": hero.pos.y};
    # Find the nearest enemy:
    enemy = hero.findNearest(hero.findEnemies())
    while enemy:
        while enemy.health > 0: 
            if enemy.type == "brawler": 
                hero.attack(enemy)
            else:
                if hero.canCast("chain-lightning", enemy): 
                    hero.cast("chain-lightning", enemy)
                else: 
                    hero.attack(enemy)
        else: 
            hero.attack(enemy)
        
        enemy = hero.findNearest(hero.findEnemies())
    while peasant.distanceTo(tDest) > 1:
        hero.move(tDest)
        hero.command(peasant, "move", tDest)


#2

I messaged you on some pointers on how to complete it. Hope that helps out!


#3

Don’t attack brawlers. Your little peasant friend might get killed :frowning:
Try using the decoys to draw away the brawlers, as the level instructs you to do, or you can summon some soldiers to stall the brawlers, and kill the scouts yourself.


#4

I attacked the brawlers and still won.


#5

… okay then… xd