#textdomain wesnoth-ai

[test]
    id=recruiting
    name= _ "Recruiting"
    next_scenario=micro_ai_test

    map_data="{ai/micro_ais/maps/protect_unit.map}"

    {DEFAULT_SCHEDULE}
    turns=-1
    victory_when_enemies_defeated=no

    [side]
        side=1
        controller=ai
        name= _ "Langzhar"
        id=Langzhar
        type=Lieutenant
        persistent=no

        team_name=Langzhar
        user_team_name= _ "team_name^Langzhar"
        recruit=Peasant,Spearman,Swordsman,Bowman,Longbowman,Cavalryman,Dragoon,Heavy Infantryman,Shock Trooper,Mage,White Mage

        gold=1000
    [/side]

    [side]
        side=2
        controller=ai
        name= _ "Koorzhar"
        id=Koorzhar
        type=Lieutenant
        persistent=no

        team_name=Koorzhar
        user_team_name= _ "team_name^Koorzhar"
        recruit=Peasant,Spearman,Swordsman,Bowman,Longbowman,Cavalryman,Dragoon,Heavy Infantryman,Shock Trooper,Mage,White Mage

        gold=1000
    [/side]

    [side]  # This side is only here because we need one persistent side for the game to go on
        side=3
        controller=null
        persistent=yes
        save_id=Grnk
        hidden=yes
    [/side]

    # Prestart actions
    [event]
        name=prestart

        {VARIABLE scenario_name recruiting}

        [micro_ai]
            side=1
            ai_type=recruit_random
            action=add

            [probability]
                type=Swordsman,Peasant
                probability=8
            [/probability]

            skip_low_gold_recruiting=yes
        [/micro_ai]
        [micro_ai]
            side=2
            ai_type=recruit_rushers
            action=add
        [/micro_ai]
    [/event]

    [event]
        name=start

        {STORE_UNIT_VAR id=Koorzhar profile profile}
        {MESSAGE Koorzhar "$profile~FL()~RIGHT()" "" _"This is a very simple scenario that can be used to test out different recruiting patterns."}
        {CLEAR_VARIABLE profile}

        {MESSAGE Langzhar "" "" _"Just watch the recruiting of both sides and see if it is what you would expect. The recruitment lists cover level 0 to level 2 units, in order to make differences more obvious."}
        # wmllint: unbalanced-on
        {MESSAGE narrator "wesnoth-icon.png" "Notes" _"If you have not changed anything in the scenario code, Side 1 uses the Random Recruitment Micro AI, with swordsmen and peasants having been given higher probability than the other units. This is not meant as a good recruitment pattern, it simply serves as a demonstration how to use the AI.

Side 2 uses the Rush Recruitment Micro AI (which is also used in the Experimental AI).

A Micro AI can be added and adapted to the need of a scenario easily using only WML and the [micro_ai] tag. Check out the <span color='#00A000'>Micro AI wiki page</span> at http://wiki.wesnoth.org/Micro_AIs for more information."}
        # wmllint: unbalanced-off
    [/event]

    # Stop if this was the last death on this side
    [event]
        name=die
        first_time_only=no

        [if]
            [not]
                [have_unit]
                    count=1-9999
                    side=$unit.side
                [/have_unit]
            [/not]
            [then]
                {MESSAGE narrator "wesnoth-icon.png" "" _"Well, that was that."}

                # So that game goes on to next scenario
                [modify_side]
                    side=3
                    controller=human
                [/modify_side]

                [endlevel]
                    result=victory
                    bonus=no
                    carryover_percentage=0
                    carryover_report=no
                    linger_mode=no
                [/endlevel]
            [/then]
        [/if]
    [/event]
[/test]
