#textdomain wesnoth-utbs

#! -- Recall a random number of troops among the tents to make the glorious victory achieveable on harder levels
#! -- internal variables : $tents, $rally_chance, $i
#define WAR_CRY
    [event]
        name=turn 1

        [store_villages]
            variable=tents
        [/store_villages]

#ifdef EASY
        {VARIABLE rally_chance 70}
#endif

#ifdef MEDIUM
        {VARIABLE rally_chance 50}
#endif

#ifdef HARD
        {VARIABLE rally_chance 30}
#endif

        {VARIABLE i 0}

        {FOREACH tents i}
        {RANDOM 0..100}
        {VARIABLE_OP random add -tents[i].y}
        [if]
            [variable]
                name=random
                less_than=$rally_chance
            [/variable]

            [then]
                [recall]
                    side=1
                    x=$tents[$i].x
                    y=$tents[$i].y
                [/recall]
                {VARIABLE_OP rally_chance add -3}
            [/then]
        [/if]
        {NEXT i}
        {CLEAR_VARIABLE tents}
        {CLEAR_VARIABLE i}
        {CLEAR_VARIABLE rally_chance}
    [/event]
#enddef
