#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=unlimited
    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]
            [probability]
                type=Mage
                probability=4
            [/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]
            speaker=Koorzhar
            image=$profile~FL()~RIGHT()
            message= _ "This is a very simple scenario that can be used to test out different recruiting patterns."
        [/message]
        {CLEAR_VARIABLE profile}

        [message]
            speaker=Langzhar
            message= _ "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."
        [/message]
        # wmllint: unbalanced-on
        [message]
            speaker=narrator
            image=wesnoth-icon.png
            caption= _ "Notes"
            message= _ "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, and mages a middling probability. 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 https://wiki.wesnoth.org/Micro_AIs for more information."
        [/message]
        # 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]
                    speaker=narrator
                    image=wesnoth-icon.png
                    message= _ "Well, that was that."
                [/message]

                # 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]
