#textdomain wesnoth-ai

[test]
    id=dragon
    name=_"Dragon"
    next_scenario=micro_ai_test

    map_data="{multiplayer/maps/2p_Fallenstar_Lake.map}"

    {DEFAULT_SCHEDULE}
    turns=-1
    victory_when_enemies_defeated=no

    [side]
        side=1
        controller=ai
        no_leader=yes

        team_name=Rowck
        # wmllint: local spellings Rowck
        user_team_name= _ "team_name^Rowck"
        persistent=no

        gold=200
    [/side]

    [side]
        side=2
        type=Dread Bat
        controller=human
        suppress_end_turn_confirmation=yes
        id=Dreadful Bat
        name= _ "Dreadful Bat"

        canrecruit=yes
        recruit=Vampire Bat,Giant Rat,Giant Scorpion
        persistent=no
        gold=1000
    [/side]

    # Put all the units and markers out there
    [event]
        name=prestart

        {VARIABLE scenario_name dragon}

        {PLACE_IMAGE "scenery/signpost.png" 40 5}
        {SET_LABEL 40 5 _"End Scenario"}

        {PLACE_IMAGE "scenery/signpost.png" 3 15}
        {SET_LABEL 3 15 _"Rowck's Home"}

        [unit]
            id=Rowck
            name= _ "Rowck"
            unrenamable=yes
            type=Fire Dragon
            side=1
            x,y=3,15
        [/unit]

        # Set up the dragon micro AI
        [micro_ai]
            side=1
            ai_type=hunter
            action=add

            id=Rowck
            [filter_location]
                x,y=5-30,1-15
            [/filter_location]
            home_x,home_y=3,15
            rest_turns=2
        [/micro_ai]
    [/event]

    [event]
        name=start

        {STORE_UNIT_VAR (id=Dreadful Bat) profile profile}
        {MESSAGE (Dreadful Bat) "" "" _"Be careful to stay out of the way of that dragon. He's a mean one."}
        {CLEAR_VARIABLE profile}
        # wmllint: unbalanced-on
        {MESSAGE Rowck "" "" _"Hi there. I am Rowck and here is what I do:
When hungry, I move around part of the map in a random wander until I get into range of an enemy. If enemies are within range, I attack and devour the weakest of them. After that, I retreat to my rest location, where I stay for a certain number of turns or until fully healed.
A few details (features, not bugs, but can be changed if desired):
- If my way home is blocked on the return, the normal RCA AI takes over my behavior.
- I will, however, attack any enemy occupying my rest hex, if I can get there.
- A kill only makes me go home when I am the attacker, not as defender.
- Occasionally I will not move at all while wandering (a dragon has to rest sometimes!)

Note: The Hunter AI is coded as a Micro 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

        [objectives]
            summary= _ "Move the bats around to explore how Rowck reacts"
            [objective]
                description= _ "Defeat Rowck"
                condition=win
            [/objective]
            [objective]
                description= _ "Move the lead bat to the signpost"
                condition=win
            [/objective]
            [objective]
                description= _ "Death of the bat leader"
                condition=lose
            [/objective]
        [/objectives]
    [/event]

    # The events finishing the scenario
    [event]
        name=die
        [filter]
            id=Rowck
        [/filter]

        [fire_event]
            name=end_scenario
        [/fire_event]
    [/event]

    [event]
        name=moveto
        [filter]
            id=Dreadful Bat
            x,y=40,5
        [/filter]

        [fire_event]
            name=end_scenario
        [/fire_event]
    [/event]

    [event]
        name=end_scenario

        {MESSAGE (Dreadful Bat) "" "" _"I'm out of here."}

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