#textdomain wesnoth-ai

[test]
    id=micro_ai_test
    name= _ "Micro AI Tests"
    next_scenario=null

    map_data="{multiplayer/maps/Dark_Forecast_basic.map}"

    {DEFAULT_SCHEDULE}
    turns=unlimited
    victory_when_enemies_defeated=no

    [side]
        side=1
        controller=human
        suppress_end_turn_confirmation=yes
        id=Grnk
        name= _ "Grnk the Frail"
        gender=male
        unrenamable=yes
        type=Goblin Spearman
        max_moves=99
        x,y=13,8

        team_name=Grnk
        user_team_name= _ "team_name^Grnk"
        persistent=yes
        save_id=Grnk

        [modifications]
            {TRAIT_QUICK}
        [/modifications]

        village_gold=0
        {GOLD 24 22 19}
        income=-2  # No income whatsoever
    [/side]

    # The labels and signposts to go on to the next scenario
    [event]
        name=prestart

        {PLACE_IMAGE "scenery/signpost.png" 9 6}
        {SET_LABEL 9 6 _"Animals"}

        {PLACE_IMAGE "scenery/signpost.png" 10 5}
        {SET_LABEL 10 5 _"Wolves"}

        {PLACE_IMAGE "scenery/signpost.png" 11 5}
        {SET_LABEL 11 5 _"Swarm"}

        {PLACE_IMAGE "scenery/signpost.png" 12 4}
        {SET_LABEL 12 4 _"Dragon"}

        {PLACE_IMAGE "scenery/signpost.png" 13 4}
        {SET_LABEL 13 4 _"Guardians"}

        {PLACE_IMAGE "scenery/signpost.png" 14 3}
        {SET_LABEL 14 3 _"Lurkers"}

        {PLACE_IMAGE "scenery/signpost.png" 8 6}
        {SET_LABEL 8 6 _"Protect Unit"}

        {PLACE_IMAGE "scenery/signpost.png" 8 7}
        {SET_LABEL 8 7 _"HttT: The Elves Besieged"}

        {PLACE_IMAGE "scenery/signpost.png" 8 8}
        {SET_LABEL 8 8 _"Bottleneck"}

        {PLACE_IMAGE "scenery/signpost.png" 8 9}
        {SET_LABEL 8 9 _"Messenger"}

        {PLACE_IMAGE "scenery/signpost.png" 9 10}
        {SET_LABEL 9 10 _"Patrols"}

        {PLACE_IMAGE "scenery/signpost.png" 10 10}
        {SET_LABEL 10 10 _"Recruiting"}

        {PLACE_IMAGE "scenery/signpost.png" 11 11}
        {SET_LABEL 11 11 _"Healers"}

        {PLACE_IMAGE "scenery/signpost.png" 12 11}
        {SET_LABEL 12 11 _"Goto"}

        {PLACE_IMAGE "scenery/signpost.png" 13 12}
        {SET_LABEL 13 12 _"Hang Out and Messenger"}

        {PLACE_IMAGE "scenery/signpost.png" 14 12}
        {SET_LABEL 14 12 _"Simple Attack"}

        {PLACE_IMAGE "scenery/signpost.png" 15 13}
        {SET_LABEL 15 13 _"Fast AI"}

        {VARIABLE scenario_name micro_ai_test}

        # Menu items explaining the different scenarios
        [set_menu_item]
            id=m01_menu_bottleneck_defense
            description= _ "Bottleneck Defense Micro AI demo"
            image=units/human-loyalists/lieutenant.png~CROP(16,7,36,36)~SCALE(24,24)
            [filter_location]
                x,y=8,8
            [/filter_location]
            [show_if]
                {VARIABLE_CONDITIONAL scenario_name equals micro_ai_test}
            [/show_if]
            [command]
                [message]
                    speaker=Grnk
                    caption= _ "Bottleneck Defense Micro AI Demo"
                    message= _ "In the Bottleneck Defense Micro AI scenario, a small group of human soldiers is instructed to hold a pass against a large horde of orcs. You can either watch them fight it out against the standard RCA AI or take over the orc side."
                [/message]
            [/command]
        [/set_menu_item]

        [set_menu_item]
            id=m02_swamp_lurkers
            description= _ "Swamp Lurker Micro AI demo"
            image=units/monsters/wolf.png~CROP(40,29,24,24)
            [filter_location]
                x,y=14,3
            [/filter_location]
            [show_if]
                {VARIABLE_CONDITIONAL scenario_name equals micro_ai_test}
            [/show_if]
            [command]
                [message]
                    speaker=Grnk
                    caption= _ "Swamp Lurker Micro AI demo"
                    message= _ "Swamp lurkers are dumb, impulse-driven creatures which can move across most terrain, but only stop on swamp. They move individually without any strategy and always attack the weakest enemy within their reach. If no enemy is in reach, the lurker does a random move instead."
                [/message]
            [/command]
        [/set_menu_item]

        [set_menu_item]
            id=m03_guardians
            description= _ "Guardian Micro AI demo"
            image=items/buckler.png~CROP(24,24,24,24)
            [filter_location]
                x,y=13,4
            [/filter_location]
            [show_if]
                {VARIABLE_CONDITIONAL scenario_name equals micro_ai_test}
            [/show_if]
            [command]
                [message]
                    speaker=Grnk
                    caption= _ "Guardian Micro AI demo"
                    message= _ "In 'Guardians', several variations of the standard Wesnoth guardian are shown, including a ""coward"" unit that runs away from any approaching unit (an ""inverse guardian"", in a way)."
                [/message]
            [/command]
        [/set_menu_item]

        [set_menu_item]
            id=m04_patrol
            description= _ "Patrol Micro AI demo"
            image=units/goblins/wolf-rider.png~CROP(22,11,42,42)~SCALE(24,24)
            [filter_location]
                x,y=9,10
            [/filter_location]
            [show_if]
                {VARIABLE_CONDITIONAL scenario_name equals micro_ai_test}
            [/show_if]
            [command]
                [message]
                    speaker=Grnk
                    caption= _ "Patrol Micro AI demo"
                    message= _ "'Patrols' contains AI modifications for units following patrol routes."
                [/message]
            [/command]
        [/set_menu_item]

        [set_menu_item]
            id=m05_recruiting
            description= _ "Recruiting Tests Micro AI demo"
            image=units/human-loyalists/lieutenant.png~CROP(16,7,36,36)~SCALE(24,24)
            [filter_location]
                x,y=10,10
            [/filter_location]
            [show_if]
                {VARIABLE_CONDITIONAL scenario_name equals micro_ai_test}
            [/show_if]
            [command]
                [message]
                    speaker=Grnk
                    caption= _ "Recruiting Tests Micro AI demo"
                    message= _ "A simple scenario set up for the sole purpose of testing different recruiting patterns."
                [/message]
            [/command]
        [/set_menu_item]

        [set_menu_item]
            id=m06_protect
            description= _ "Protect Unit Micro AI demo"
            image=units/human-magi/red-mage.png~CROP(22,12,24,24)
            [filter_location]
                x,y=8,6
            [/filter_location]
            [show_if]
                {VARIABLE_CONDITIONAL scenario_name equals micro_ai_test}
            [/show_if]
            [command]
                [message]
                    speaker=Grnk
                    caption= _ "Protect Unit Micro AI Demo"
                    message= _ "This scenario demonstrates one side protecting a wizard while moving him to a goal location. At the same time, the other side is modified to do priority attacks on the wizard, even if a better target (by the default AI criteria) is available. You can watch the two AIs fight it out, or take control of either side to explore how the opposing AI behaves."
                [/message]
            [/command]
        [/set_menu_item]

        [set_menu_item]
            id=m06a_protect
            # wmllint: local spellings HttT
            description= _ "HttT: The Elves Besieged Micro AI demo"
            image=units/human-magi/red-mage.png~CROP(22,12,24,24)
            [filter_location]
                x,y=8,7
            [/filter_location]
            [show_if]
                {VARIABLE_CONDITIONAL scenario_name equals micro_ai_test}
            [/show_if]
            [command]
                [message]
                    speaker=Grnk
                    caption= _ "HttT: The Elves Besieged Micro AI demo"
                    message= _ "This is a reenactment of scenario ""The Elves Besieged"" of the mainline campaign ""Heir to the Throne"", just that the AI is playing Konrad's side here. The same algorithm as for scenario ""Protect Unit"" is used."
                [/message]
            [/command]
        [/set_menu_item]

        [set_menu_item]
            id=m07_messenger
            description= _ "Messenger Escort Micro AI demo"
            image=units/human-loyalists/cavalryman/cavalryman.png~CROP(33,27,24,24)
            [filter_location]
                x,y=8,9
            [/filter_location]
            [show_if]
                {VARIABLE_CONDITIONAL scenario_name equals micro_ai_test}
            [/show_if]
            [command]
                [message]
                    speaker=Grnk
                    caption= _ "Messenger Escort Micro AI demo"
                    message= _ "'Messenger Escort' has the AI actively protect a messenger while he makes his way to the edge of the map. The escort will also try to open the path for the messenger if there are enemies in the way."
                [/message]
            [/command]
        [/set_menu_item]

        [set_menu_item]
            id=m08_animals
            description= _ "Animals Micro AI demo"
            image=units/monsters/wolf.png~CROP(40,29,24,24)
            [filter_location]
                x,y=9,6
            [/filter_location]
            [show_if]
                {VARIABLE_CONDITIONAL scenario_name equals micro_ai_test}
            [/show_if]
            [command]
                [message]
                    speaker=Grnk
                    caption= _ "Animals Micro AI demo"
                    message= _ "This scenario demonstrates a number of different animals following customized AI behavior, including wolves hunting deer in packs; dogs herding sheep; bears, spiders, yetis, boar and rabbits wandering and hunting/avoiding each other."
                [/message]
            [/command]
        [/set_menu_item]

        [set_menu_item]
            id=m09_wolves
            description= _ "Wolves Micro AI demo"
            image=units/monsters/wolf.png~CROP(40,29,24,24)
            [filter_location]
                x,y=10,5
            [/filter_location]
            [show_if]
                {VARIABLE_CONDITIONAL scenario_name equals micro_ai_test}
            [/show_if]
            [command]
                [message]
                    speaker=Grnk
                    caption= _ "Wolves Micro AI demo"
                    message= _ "Another demonstration of wolves wandering and attacking in packs, with a different behavior from that in 'Animals'."
                [/message]
            [/command]
        [/set_menu_item]

        [set_menu_item]
            id=m10_swarm
            description= _ "Swarm Micro AI demo"
            image=units/undead/bat-se-4.png~CROP(24,16,24,24)
            [filter_location]
                x,y=11,5
            [/filter_location]
            [show_if]
                {VARIABLE_CONDITIONAL scenario_name equals micro_ai_test}
            [/show_if]
            [command]
                [message]
                    speaker=Grnk
                    caption= _ "Swarm Micro AI demo"
                    message= _ "This scenario features bats moving around semi-randomly in a swarm."
                [/message]
            [/command]
        [/set_menu_item]

        [set_menu_item]
            id=m11_dragon
            description= _ "Dragon Micro AI demo"
            image=units/monsters/fire-dragon.png~CROP(102,60,48,48)~SCALE(24,24)
            [filter_location]
                x,y=12,4
            [/filter_location]
            [show_if]
                {VARIABLE_CONDITIONAL scenario_name equals micro_ai_test}
            [/show_if]
            [command]
                [message]
                    speaker=Grnk
                    caption= _ "Dragon Micro AI demo"
                    message= _ "This scenario features a fire dragon displaying a hunt-and-rest behavior."
                [/message]
            [/command]
        [/set_menu_item]

        [set_menu_item]
            id=m12_healer_support
            description= _ "Healer support Micro AI demo"
            image=units/elves-wood/shaman.png~CROP(26,19,24,24)
            [filter_location]
                x,y=11,11
            [/filter_location]
            [show_if]
                {VARIABLE_CONDITIONAL scenario_name equals micro_ai_test}
            [/show_if]
            [command]
                [message]
                    speaker=Grnk
                    caption= _ "Healer Support Micro AI demo"
                    message= _ "This scenario contains a simple demonstration of setting up the Healer Support Micro AI, which uses the healers of a side to back up injured or threatened units rather than having them participate in combat under all circumstances."
                [/message]
            [/command]
        [/set_menu_item]

        [set_menu_item]
            id=m13_goto
            description= _ "Goto Micro AI demo"
            image=units/human-loyalists/spearman.png~CROP(21,16,24,24)
            [filter_location]
                x,y=12,11
            [/filter_location]
            [show_if]
                {VARIABLE_CONDITIONAL scenario_name equals micro_ai_test}
            [/show_if]
            [command]
                [message]
                    speaker=Grnk
                    caption= _ "Goto Micro AI demo"
                    message= _ "This scenario contains several example usages of the Goto Micro AI, which is a highly configurable method of sending a unit (or units) to a location or set of locations. The units to be moved are defined using a Standard Unit Filter, while the goto locations are given in a Standard Location Filter."
                [/message]
            [/command]
        [/set_menu_item]

        [set_menu_item]
            id=m14_hangout
            description= _ "Hang Out Micro AI demo"
            image=units/human-outlaws/bandit.png~CROP(22,14,24,24)
            [filter_location]
                x,y=13,12
            [/filter_location]
            [show_if]
                {VARIABLE_CONDITIONAL scenario_name equals micro_ai_test}
            [/show_if]
            [command]
                [message]
                    speaker=Grnk
                    caption= _ "Combined Hang Out and Messenger Escort Micro AI demo"
                    message= _ "This scenario is a demonstration of the Hang Out Micro AI which keeps units around a (customizable) location until a (customizable) condition is met.  After that the units are released to follow other AI behavior.  The scenario also shows how to combine two Micro AIs on the same side by having the Messenger Escort Micro AI take over at that point."
                [/message]
            [/command]
        [/set_menu_item]

        [set_menu_item]
            id=m15_simple_attack
            description= _ "Simple Attack Micro AI demo"
            image=units/undead/soulless.png~CROP(27,14,24,24)
            [filter_location]
                x,y=14,12
            [/filter_location]
            [show_if]
                {VARIABLE_CONDITIONAL scenario_name equals micro_ai_test}
            [/show_if]
            [command]
                [message]
                    speaker=Grnk
                    caption= _ "Simple Attack Micro AI demo"
                    message= _ "This scenario demonstrates how certain attacks can be executed with higher priority than the standard Wesnoth attacks and how the AI can be forced to do attacks that it would otherwise avoid."
                [/message]
            [/command]
        [/set_menu_item]

        [set_menu_item]
            id=m16_fast
            description= _ "Fast Micro AI demo"
            image=units/orcs/grunt.png~CROP(24,12,24,24)
            [filter_location]
                x,y=15,13
            [/filter_location]
            [show_if]
                {VARIABLE_CONDITIONAL scenario_name equals micro_ai_test}
            [/show_if]
            [command]
                [message]
                    speaker=Grnk
                    caption= _ "Fast Micro AI demo"
                    message= _ "A simple demonstration of the calculation time advantage of the Fast Micro AI over the default AI in scenarios with many units."
                [/message]
            [/command]
        [/set_menu_item]
    [/event]

    [event]
        name=start

        {SCROLL_TO 13 11}

        [message]
            speaker=Grnk
            message= _ "Move me to any of the signposts to go to a Micro AI demonstration.

Information about each demonstration can be accessed by right-clicking on the respective signpost."
        [/message]

        [objectives]
            [objective]
                description= _ "Move Grnk to one of the signposts"
                condition=win
            [/objective]
            [note]
                description= _ "Right-click on a signpost to get information about the scenario"
            [/note]
        [/objectives]
    [/event]

    # Events for going on to next scenarios, when Grnk goes to a signpost
    [event]
        name=moveto
        [filter]
            x,y=8,8
        [/filter]

        [endlevel]
            result=victory
            next_scenario=bottleneck_defense
            bonus=no
            carryover_percentage=0
            carryover_report=no
            linger_mode=no
            replay_save=no
        [/endlevel]
    [/event]

    [event]
        name=moveto
        [filter]
            x,y=14,3
        [/filter]

        [endlevel]
            result=victory
            next_scenario=lurkers
            bonus=no
            carryover_percentage=0
            carryover_report=no
            linger_mode=no
            replay_save=no
        [/endlevel]
    [/event]

    [event]
        name=moveto
        [filter]
            x,y=9,6
        [/filter]

        [endlevel]
            result=victory
            next_scenario=animals
            bonus=no
            carryover_percentage=0
            carryover_report=no
            linger_mode=no
            replay_save=no
        [/endlevel]
    [/event]

    [event]
        name=moveto
        [filter]
            x,y=10,5
        [/filter]

        [endlevel]
            result=victory
            next_scenario=wolves
            bonus=no
            carryover_percentage=0
            carryover_report=no
            linger_mode=no
            replay_save=no
        [/endlevel]
    [/event]

    [event]
        name=moveto
        [filter]
            x,y=11,5
        [/filter]

        [endlevel]
            result=victory
            next_scenario=swarm
            bonus=no
            carryover_percentage=0
            carryover_report=no
            linger_mode=no
            replay_save=no
        [/endlevel]
    [/event]

    [event]
        name=moveto
        [filter]
            x,y=12,4
        [/filter]

        [endlevel]
            result=victory
            next_scenario=dragon
            bonus=no
            carryover_percentage=0
            carryover_report=no
            linger_mode=no
            replay_save=no
        [/endlevel]
    [/event]

    [event]
        name=moveto
        [filter]
            x,y=13,4
        [/filter]

        [endlevel]
            result=victory
            next_scenario=guardians
            bonus=no
            carryover_percentage=0
            carryover_report=no
            linger_mode=no
            replay_save=no
        [/endlevel]
    [/event]

    [event]
        name=moveto
        [filter]
            x,y=9,10
        [/filter]

        [endlevel]
            result=victory
            next_scenario=patrols
            bonus=no
            carryover_percentage=0
            carryover_report=no
            linger_mode=no
            replay_save=no
        [/endlevel]
    [/event]

    [event]
        name=moveto
        [filter]
            x,y=10,10
        [/filter]

        [endlevel]
            result=victory
            next_scenario=recruiting
            bonus=no
            carryover_percentage=0
            carryover_report=no
            linger_mode=no
            replay_save=no
        [/endlevel]
    [/event]

    [event]
        name=moveto
        [filter]
            x,y=8,6
        [/filter]

        [endlevel]
            result=victory
            next_scenario=protect_unit
            bonus=no
            carryover_percentage=0
            carryover_report=no
            linger_mode=no
            replay_save=no
        [/endlevel]
    [/event]

    [event]
        name=moveto
        [filter]
            x,y=8,7
        [/filter]

        [endlevel]
            result=victory
            next_scenario=The_Elves_Besieged
            bonus=no
            carryover_percentage=0
            carryover_report=no
            linger_mode=no
            replay_save=no
        [/endlevel]
    [/event]

    [event]
        name=moveto
        [filter]
            x,y=8,9
        [/filter]

        [endlevel]
            result=victory
            next_scenario=messenger_escort
            bonus=no
            carryover_percentage=0
            carryover_report=no
            linger_mode=no
            replay_save=no
        [/endlevel]
    [/event]

    [event]
        name=moveto
        [filter]
            x,y=11,11
        [/filter]

        [endlevel]
            result=victory
            next_scenario=healer_support
            bonus=no
            carryover_percentage=0
            carryover_report=no
            linger_mode=no
            replay_save=no
        [/endlevel]
    [/event]

    [event]
        name=moveto
        [filter]
            x,y=12,11
        [/filter]

        [endlevel]
            result=victory
            next_scenario=goto
            bonus=no
            carryover_percentage=0
            carryover_report=no
            linger_mode=no
            replay_save=no
        [/endlevel]
    [/event]

    [event]
        name=moveto
        [filter]
            x,y=13,12
        [/filter]

        [endlevel]
            result=victory
            next_scenario=hang_out
            bonus=no
            carryover_percentage=0
            carryover_report=no
            linger_mode=no
            replay_save=no
        [/endlevel]
    [/event]

    [event]
        name=moveto
        [filter]
            x,y=14,12
        [/filter]

        [endlevel]
            result=victory
            next_scenario=simple_attack
            bonus=no
            carryover_percentage=0
            carryover_report=no
            linger_mode=no
            replay_save=no
        [/endlevel]
    [/event]

    [event]
        name=moveto
        [filter]
            x,y=15,13
        [/filter]

        [endlevel]
            result=victory
            next_scenario=fast
            bonus=no
            carryover_percentage=0
            carryover_report=no
            linger_mode=no
            replay_save=no
        [/endlevel]
    [/event]
[/test]
