Hide-and-seek, lightning activation rule?


#1

Is it possible to activate the lightning
After engage into the fight with a brawler
As far as I understand
Lightning should be activated by a trigger at the point {40, 34}
But even if I directly “swap” brawler at this point
Or do as the brawler passes through {40, 34} on the way to me
Or when pushing it to the point by hero
Lightning is not activated

Code
function checkTakeHide(item) {
    if (item) 
    {
        if ( item.pos.x > 68 )
        {
            hero.cast( "haste", hero );   
        }
        hero.moveXY( item.pos.x, item.pos.y );
        itemCounter += 1;

        if ( item.pos.x > 41 )
        {
            hero.buildXY( "fire-trap", hero.pos.x + 4, hero.pos.y );
            hero.buildXY( "fire-trap", hero.pos.x + 4, hero.pos.y );
        }
        if ( item.pos.x < 41 )
        {
            hero.buildXY( "fire-trap", hero.pos.x - 4, hero.pos.y );
            hero.buildXY( "fire-trap", hero.pos.x - 4, hero.pos.y );
        }

        hero.moveXY( 25, 56 );
    }

}

hero.moveXY ( 54, 56 );
var itemCounter = 0;

while ( true ) {
    
    if ( itemCounter == 4 )
    {
        var brawler = hero.findNearest(hero.findByType( "brawler" ));
        if ( brawler ) 
        {
            if ( hero.canCast( "swap" ) )
            {
                hero.moveXY( 28, 56);
                hero.cast( "swap", brawler );   
            }
            
            while( true )         
            {
                if ( hero.canCast( "swap" )
                    && hero.distanceTo( brawler ) < 30 )
                {   
                    hero.cast( "swap", brawler );
                }      
                hero.move( { x:40, y:34 } );  
            }
        }   
    }
    
    var stone = hero.findNearest( hero.findItems() );
    if ( stone )
    {
		checkTakeHide( stone );
    }
    else if ( itemCounter < 4 )
    {
        hero.buildXY( "fire-trap", 27, 47 );   
    }
}

#2

The magic is activated only when all lightstones are collected and the brawler in the center.

Are you trying to get in the scoreboard or just to solve it? Your solution looks too complex for that level.


#3

I collected all lightstones
And brawler was at the {40, 34}
by cast swap on him

I tried to get into the scoreboard
I managed to kill brawler by fire-traps
Using a slightly different approach.


#4

Hm, It’s hard to say the reason. Could you send me your sessionID exactly for that case? I can see only your last session/replay.


#5

Sent sessionID for that case


#6

Thanks! There was one more condition - the brawler should not be alarmed. I removed it. Could you check it now?


#7

It works exactly as I planned
Thank you so much

In some way
This “not alarmed” condition
Was a good thing
At first I thought
A lot of time spend in vain
But excellent solution was near