#textdomain wesnoth-ai

[test]
    id=hang_out
    name= _ "Hang Out"
    next_scenario=micro_ai_test

    map_data="{multiplayer/maps/4p_Castle_Hopping_Isle.map}"

    {DEFAULT_SCHEDULE}
    turns=-1
    victory_when_enemies_defeated=no

    [side]
        side=1
        controller=ai
        id=Bad Outlaw
        type=Outlaw
        x,y=2,19
        persistent=no

        team_name=Outlaw
        user_team_name= _ "team_name^Bad Outlaw"
        recruit=Footpad

        gold=200
    [/side]

    [side]
        side=2
        controller=human
        suppress_end_turn_confirmation=yes
        id=Good Bandit
        type=Bandit
        x,y=16,2
        persistent=no

        team_name=Bandit
        user_team_name= _ "team_name^Good Bandit"
        recruit=Thief

        gold=200
    [/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 hang_out}

        # Goal signpost for Rossauba
        {PLACE_IMAGE "scenery/signpost.png" 36 19}
        {SET_LABEL 36 19 _"Outlaw moves here"}

        # Change some of the terrain for this demonstration
        [terrain]
            x=4,15,23
            y=19,20,20
            terrain=Aa
        [/terrain]
        [terrain]
            x=0,1
            y=20-22,21-22
            terrain=Mm
        [/terrain]
        [terrain]
            x=18,20
            y=19,19
            terrain=Wwf
        [/terrain]
        [terrain]
            x,y=21-22,16-17
            terrain=Ww
        [/terrain]

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

            [avoid]
                terrain=C*,H*,M*,A*,S*,*^F*
            [/avoid]
            [mobilize_condition]
                [have_unit]
                    side=1
                    count=7-99
                [/have_unit]
            [/mobilize_condition]
        [/micro_ai]

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

            id=Bad Outlaw
            ca_score=165000
            waypoint_x=16,22,36
            waypoint_y=19,19,19
        [/micro_ai]
    [/event]

    [event]
        name=start

        # wmllint: unbalanced-on
        {MESSAGE (Good Bandit) "" "" _"That outlaw over there is going to run for the keep in the southeast.  He's only going to recruit for three rounds before he'll start moving and he and his footpads are much faster than we are.  Let's make haste or we'll never catch him.

Note: This scenario uses a combination of two Micro AIs, the Hang Out Micro AI which makes the Side 2 units remain around the keep for two turns (while moving off castle tiles to allow for recruiting) and the Messenger Escort AI which takes over after that.  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

        [objectives]
            summary= _ "Get into the outlaw's way before he can make it to the south-eastern keep"
            [objective]
                description= _ "Death of Bad Outlaw"
                condition=win
            [/objective]
            [objective]
                description= _ "Death of Good Bandit"
                condition=lose
            [/objective]
            [objective]
                description= _ "Bad Outlaw makes it to the signpost"
                condition=lose
            [/objective]
        [/objectives]
    [/event]

    [event]
        name=die
        [filter]
            id=Bad Outlaw
        [/filter]

        {MESSAGE (Good Bandit) "" "" _"We got him! Now whatever it is we are fighting for is safe."}

        # 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]
    [/event]

    [event]
        name=moveto
        [filter]
            id=Bad Outlaw
            x,y=36,19
        [/filter]

        {MESSAGE (Bad Outlaw) "" "" _"I made it! Now we can keep fighting for whatever it is that we are fighting for."}
        [endlevel]
            result=defeat
        [/endlevel]
    [/event]
[/test]
