#textdomain wesnoth-thot

[scenario]
    id=09_Forbidden_Forest
    name= _ "Forbidden Forest"
    map_data="{campaigns/The_Hammer_of_Thursagan/maps/09_Forbidden_Forest.map}"
    {TURNS 40 34 28}
    next_scenario=10_The_Siege_of_Kal_Kartha
    victory_when_enemies_defeated=no

    {DEFAULT_SCHEDULE}

    {SCENARIO_MUSIC       elvish-theme.ogg}
    {EXTRA_SCENARIO_MUSIC traveling_minstrels.ogg}
    {EXTRA_SCENARIO_MUSIC frantic.ogg}

    {THOT_TRACK {JOURNEY_STAGE9}}

    # wmllint: validate-off
    [side]
        side=1
        controller=human
        recruit="Dwarvish Fighter,Dwarvish Thunderer, Dwarvish Guardsman, Dwarvish Scout"
        {GOLD 150 120 80}
        team_name="northern_alliance"
        user_team_name= _ "Alliance"
        {FLAG_VARIANT knalgan}

        # wmllint: recognize Aiglondur
        {CHARACTER_STATS_AIGLONDUR}

        fog=yes
        facing=se
    [/side]
    # wmllint: validate-on

    # This tells the elves not to venture onto the plains

    # Set up the Staff of Righteous Flame.
    # Tell the AIs not to step on it so we don't have to deal
    # with the case where a forest unit picks it up.
#define AVOID
    [avoid]
        x=   0,   1,   2,    2,    2,   3,    3,  4,   4,    4,    5,22, 35, 36, 37,37, 38,38,   38,38, 39,  39,   39,   39,  40,   40,  41,   41
        y=7-32,8-33,7-23,25-29,31-33,6-11,15-21,6-7,9-10,16-18,10-11,16,0-2,0-1,0-2,10,0-2, 9,13-14,24,0-4,7-10,13-19,22-27,0-19,21-26,0-19,22-27
    [/avoid]
#enddef

    [side]
        side=2
        controller=ai
        recruit=Elvish Scout,Elvish Rider,Elvish Lord,Elvish Archer,Elvish Ranger
        {GOLD 96 120 144}
        team_name=forest
        user_team_name= _ "Forest"
        {FLAG_VARIANT wood-elvish}

        type=Elvish High Lord
        id=Telcherion
        name= _ "Telcherion"
        canrecruit=yes

        facing=sw

        [ai]
            grouping=offensive
            passive_leader=yes
            recruitment_pattern=scout,fighter,mixed fighter,archer
            {AVOID}
        [/ai]
    [/side]

    [side]
        side=3
        controller=ai
        recruit=Elvish Fighter,Elvish Hero,Elvish Archer,Elvish Ranger,Elvish Sorceress
        {GOLD 96 120 144}
        team_name=forest
        user_team_name= _ "Forest"
        {FLAG_VARIANT wood-elvish}

        type=Elvish Enchantress
        id=Iluvarda
        name= _ "Iluvarda"
        canrecruit=yes

        facing=nw

        [ai]
            grouping=offensive
            passive_leader=yes
            recruitment_pattern=fighter,archer,mixed fighter,mixed fighter
            {AVOID}
        [/ai]
    [/side]

    [side]
        side=4
        controller=ai
        recruit=Wose,Elder Wose
        {GOLD 90 120 150}
        {INCOME 10 5 3}
        team_name=forest
        user_team_name= _ "Forest"

        type=Ancient Wose
        id=Burumardir-Athelorand
        name= _ "Burumardir-Athelorand"
        canrecruit=yes

        facing=nw

        [ai]
            {NO_SCOUTS}
            grouping=offensive
            passive_leader=yes
            recruitment_pattern=fighter
            [avoid]
                x,y=22,16
            [/avoid]
        [/ai]
    [/side]

    {STARTING_VILLAGES 2 9}
    {STARTING_VILLAGES 3 9}

    {OBJ_STAFF_OF_RIGHTEOUS_FLAME 22 16}

    {PLACE_IMAGE "scenery/signpost.png" 40 17}

    [event]
        name=prestart

        [objectives]
            side=1
            [objective]
                description= _ "Move both Aiglondur and Angarthing to the eastern signpost"
                condition=win
            [/objective]
            [objective]
                description= _ "Death of Aiglondur"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Angarthing"
                condition=lose
            [/objective]

            {TURNS_RUN_OUT}

            [note]
                description=_ "To win, either move Aiglondor to the signpost and Angarthing next to him, or move Angarthing to the signpost and Aiglondur next to him."
            [/note]

            [gold_carryover]
                bonus=yes
                carryover_percentage=40
            [/gold_carryover]
        [/objectives]

        [recall]
            id=Angarthing
        [/recall]

        [recall]
            id=Ratheln
        [/recall]

        [recall]
            id=Darchas
        [/recall]

        [recall]
            id=Lorinne
        [/recall]

        {MODIFY_UNIT (side=1) facing se}
    [/event]

    {CONDITIONAL_MAGE_RECRUITING}

    [event]
        name=start

        [delay]
            time=500
        [/delay]

        [sound]
            name=horse-canter.wav
        [/sound]

        [move_unit_fake]
            type=Elvish Scout
            side=2
            x=12,11, 8, 7, 6
            y=17,18,16,17,16
        [/move_unit_fake]

        [unit]
            type=Elvish Scout
            id=Elurin
            name= _ "Elurin"
            profile="portraits/elurin.png~RIGHT()"
            side=2
            x,y=5,17
            facing=sw
        [/unit]

        [message]
            speaker=Elurin
            message= _ "Who disturbs our forest?"
        [/message]

        [message]
            speaker=Aiglondur
            message= _ "A delegation of the Northern Alliance, seeking the road through to Kal Kartha."
        [/message]

        [message]
            speaker=Elurin
            message= _ "We allow few outsiders in our forest paths, and no dwarves since the masked ones began to trouble our eastern margins. No axe-bearers shall come near our trees. Return whence you came!"
        [/message]

        [message]
            speaker=Aiglondur
            message= _ "No. We have our duty. We must pass."
        [/message]

        [message]
            speaker=Elurin
            message= _ "You shall not pass here."
        [/message]

        [message]
            speaker=Aiglondur
            message= _ "Winter comes on our heels, and your forest straddles the only gap in these mountains. You leave us no choice but to fight you."
        [/message]

        [message]
            speaker=Elurin
            message= _ "So be it, then. Yours will not be the first bones to nourish the earth of our forest."
        [/message]

        [kill]
            id=Elurin
        [/kill]

        [sound]
            name=horse-canter.wav
        [/sound]

        [move_unit_fake]
            type=Elvish Scout
            side=2
            x= 6, 7, 8,11,12
            y=16,17,16,18,17
        [/move_unit_fake]
    [/event]

    # Angarthing and Aiglondur speak when they reach the signpost.
    [event]
        name=moveto
        first_time_only=yes
        [filter]
            id=Aiglondur
            x,y=40,17
        [/filter]
        [fire_event]
            name=Aiglondur message
        [/fire_event]
        [allow_undo][/allow_undo]
    [/event]

    [event]
        name=moveto
        first_time_only=yes
        [filter]
            id=Angarthing
            x,y=40,17
        [/filter]
        [fire_event]
            name=Angarthing message
        [/fire_event]
        [allow_undo][/allow_undo]
    [/event]

    [event]
        name=Aiglondur message
        first_time_only=yes
        [message]
            speaker=Aiglondur
            message= _ "Rally on me, everyone. We have better things to do than brawl with elves."
        [/message]
    [/event]

    [event]
        name=Angarthing message
        first_time_only=yes
        [message]
            speaker=Angarthing
            message= _ "Kal Kartha should be only another day’s march east of here."
        [/message]
    [/event]

    [event]
        name=moveto
        first_time_only=no
        [filter_condition]
            [have_unit]
                id=Aiglondur
                x,y=40,17
                [filter_adjacent]
                    id=Angarthing
                [/filter_adjacent]
            [/have_unit]
            [or]
                [have_unit]
                    id=Angarthing
                    x,y=40,17
                    [filter_adjacent]
                        id=Aiglondur
                    [/filter_adjacent]
                [/have_unit]
            [/or]
        [/filter_condition]

        # If Aiglondor is on the signpost and Angarthing next to him, or the other way around,
        # the player has won. Fire Aiglondur's and Angarthing's messages if they haven't fired yet.
        [fire_event]
            name=Aiglondur message
        [/fire_event]
        [fire_event]
            name=Angarthing message
        [/fire_event]
        [endlevel]
            result=victory
            bonus=yes
            {NEW_GOLD_CARRYOVER 40}
        [/endlevel]
    [/event]

    {HERODEATH_AIGLONDUR}
    {HERODEATH_ANGARTHING}
    {HERODEATH_RATHELN}
[/scenario]

#undef AVOID
