#textdomain wesnoth-ai

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

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

    {DEFAULT_SCHEDULE}
    turns=-1
    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,15

        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 13}
        {SET_LABEL 9 13 _"Animals"}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        {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,15
            [/filter_location]
            [show_if]
                {VARIABLE_CONDITIONAL scenario_name equals micro_ai_test}
            [/show_if]
            [command]
                {MESSAGE Grnk "" _"Bottleneck Defense Micro AI Demo" _"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."}
            [/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,10
            [/filter_location]
            [show_if]
                {VARIABLE_CONDITIONAL scenario_name equals micro_ai_test}
            [/show_if]
            [command]
                {MESSAGE Grnk "" _"Swamp Lurker Micro AI demo" _"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."}
            [/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,11
            [/filter_location]
            [show_if]
                {VARIABLE_CONDITIONAL scenario_name equals micro_ai_test}
            [/show_if]
            [command]
                {MESSAGE Grnk "" _"Guardian Micro AI demo" _"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)."}
            [/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,17
            [/filter_location]
            [show_if]
                {VARIABLE_CONDITIONAL scenario_name equals micro_ai_test}
            [/show_if]
            [command]
                {MESSAGE Grnk "" _"Patrol Micro AI demo" _"'Patrols' contains AI modifications for units following patrol routes."}
            [/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,17
            [/filter_location]
            [show_if]
                {VARIABLE_CONDITIONAL scenario_name equals micro_ai_test}
            [/show_if]
            [command]
                {MESSAGE Grnk "" _"Recruiting Tests Micro AI demo" _"A simple scenario set up for the sole purpose of testing different recruiting patterns."}
            [/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,13
            [/filter_location]
            [show_if]
                {VARIABLE_CONDITIONAL scenario_name equals micro_ai_test}
            [/show_if]
            [command]
                {MESSAGE Grnk "" _"Protect Unit Micro AI Demo" _"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."}
            [/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,14
            [/filter_location]
            [show_if]
                {VARIABLE_CONDITIONAL scenario_name equals micro_ai_test}
            [/show_if]
            [command]
                {MESSAGE Grnk "" _"HttT: The Elves Besieged Micro AI demo" _"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."}
            [/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,16
            [/filter_location]
            [show_if]
                {VARIABLE_CONDITIONAL scenario_name equals micro_ai_test}
            [/show_if]
            [command]
                {MESSAGE Grnk "" _"Messenger Escort Micro AI demo" _"'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."}
            [/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,13
            [/filter_location]
            [show_if]
                {VARIABLE_CONDITIONAL scenario_name equals micro_ai_test}
            [/show_if]
            [command]
                {MESSAGE Grnk "" _"Animals Micro AI demo" _"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."}
            [/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,12
            [/filter_location]
            [show_if]
                {VARIABLE_CONDITIONAL scenario_name equals micro_ai_test}
            [/show_if]
            [command]
                {MESSAGE Grnk "" _"Wolves Micro AI demo" _"Another demonstration of wolves wandering and attacking in packs, with a different behavior from that in 'Animals'."}
            [/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,12
            [/filter_location]
            [show_if]
                {VARIABLE_CONDITIONAL scenario_name equals micro_ai_test}
            [/show_if]
            [command]
                {MESSAGE Grnk "" _"Swarm Micro AI demo" _"This scenario features bats moving around semi-randomly in a swarm."}
            [/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,11
            [/filter_location]
            [show_if]
                {VARIABLE_CONDITIONAL scenario_name equals micro_ai_test}
            [/show_if]
            [command]
                {MESSAGE Grnk "" _"Dragon Micro AI demo" _"This scenario features a fire dragon displaying a hunt-and-rest behavior."}
            [/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,18
            [/filter_location]
            [show_if]
                {VARIABLE_CONDITIONAL scenario_name equals micro_ai_test}
            [/show_if]
            [command]
                {MESSAGE Grnk "" _"Healer Support Micro AI demo" _"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."}
            [/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,18
            [/filter_location]
            [show_if]
                {VARIABLE_CONDITIONAL scenario_name equals micro_ai_test}
            [/show_if]
            [command]
                {MESSAGE Grnk "" _"Goto Micro AI demo" _"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."}
            [/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,19
            [/filter_location]
            [show_if]
                {VARIABLE_CONDITIONAL scenario_name equals micro_ai_test}
            [/show_if]
            [command]
                {MESSAGE Grnk "" _"Combined Hang Out and Messenger Escort Micro AI demo" _"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."}
            [/command]
        [/set_menu_item]

        [set_menu_item]
            id=m14_simple_attack
            description= _ "Simple Attack Micro AI demo"
            image=units/undead/soulless.png~CROP(27,14,24,24)
            [filter_location]
                x,y=14,19
            [/filter_location]
            [show_if]
                {VARIABLE_CONDITIONAL scenario_name equals micro_ai_test}
            [/show_if]
            [command]
                {MESSAGE Grnk "" _"Simple Attack Micro AI demo" _"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."}
            [/command]
        [/set_menu_item]
    [/event]

    [event]
        name=start

        {SCROLL_TO 13 18}

        {MESSAGE Grnk "" "" _"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."}

        [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,15
        [/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,10
        [/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,13
        [/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,12
        [/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,12
        [/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,11
        [/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,11
        [/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,17
        [/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,17
        [/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,13
        [/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,14
        [/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,16
        [/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,18
        [/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,18
        [/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,19
        [/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,19
        [/filter]

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