#textdomain wesnoth-tsg
[scenario]
    id=9a_Vengeance

    name= _ "Vengeance"
    next_scenario=10a_Elf_Epilogue
    [music]
        name=main_menu.ogg
        ms_before=500
    [/music]
    [music]
        name=knolls.ogg
        ms_before=500
        append=yes
    [/music]

    map_data="{campaigns/The_South_Guard/maps/9a_Vengeance.map}"

    {MORNING}
    {AFTERNOON}
    {DUSK}
    {FIRST_WATCH}
    {SECOND_WATCH}
    {DAWN}
    
    {VICTORY_AND_DEFEAT_MUSIC}

    turns=-1
    victory_when_enemies_defeated=no

    # The South Guard

    [side]
        side=1
        type=Dismounted Commander 1
        description=Deoran
        user_description= _ "Deoran"
        unrenamable=yes

        team_name=South_Guard
        controller=human
        {CUSTOM_SG_FLAG}

        {GOLD 125 100 80}
        {INCOME 4 2 0}

        fog=no
        shroud=no

        canrecruit=yes
        recruit=Bowman, Spearman, Cavalryman

        {SG_GUARD (Javelineer) (Westin Guard) (_"Westin Guard") 1 22 12}
        {SG_GUARD (Heavy Infantryman) (Westin Guard) (_"Westin Guard") 1 19 14}
        {SG_GUARD (Heavy Infantryman) (Westin Guard) (_"Westin Guard") 1 17 15}
        {SG_GUARD (Heavy Infantryman) (Westin Guard) (_"Westin Guard") 1 17 17}
        {SG_GUARD (Spearman) (Westin Guard) (_"Westin Guard") 1 16 19}
        {SG_GUARD (Spearman) (Westin Guard) (_"Westin Guard") 1 15 21}
    [/side]

    {STARTING_VILLAGES 1 15}

    # The Enraged Elves

    [side]
        side=2
        type=Elvish Marshal
        description=Ithelden
        user_description= _ "Ithelden"

        team_name=The_Enraged Elves
        controller=ai

        {GOLD 125 100 80}
        {INCOME 4 2 0}

        canrecruit=no
        [ai]
            passive_leader=yes
            aggression=0.0
            caution=1.0
            [target]
                description=Ethiliel
                value=2.0
            [/target]
        [/ai]
        [ai]
            passive_leader=yes
            time_of_day=dusk,first_watch,second_watch
            aggression=1.0
            caution=0
            grouping=no
        [/ai]
    [/side]

    [event]
        name=prestart

        [disallow_recruit]
            side=1
            type=Elvish Fighter, Elvish Shaman
        [/disallow_recruit]
    [/event]

    [event]
        name=start

        [recall]
            description=Sir Gerrick
        [/recall]
        [recall]
            description=Ethiliel
        [/recall]
        [recall]
            description=Minister Hylas
        [/recall]

        [message]
            speaker=Sir Gerrick
            message= _ "Commander! I took your message to the council, and your deeds have pleased them. Are the undead finally gone from our lands?"
        [/message]
        [message]
            speaker=Deoran
            message= _ "The undead are gone! Perhaps now there will be peace for a time in Westin. You have our thanks Lady Ethiliel."
        [/message]
        [message]
            speaker=Ethiliel
            message= _ "Though the undead are vanquished, they have brought us much sorrow. Deoran, your people have restored their honor. Let us part in peace."
        [/message]
        [message]
            speaker=Deoran
            message= _ "Indeed. Neither the bandits nor the undead will trouble us for some time. We will tend our wounds and you yours."
        [/message]
        [message]
            speaker=narrator
            message= _ "Help!"
            image=wesnoth-icon.png
        [/message]

        [scroll_to_unit]
            description=Ithelden
        [/scroll_to_unit]

        [message]
            speaker=narrator
            message= _ "Help!"
            image=wesnoth-icon.png
        [/message]
        [move_unit_fake]
            type=Peasant
            side=1
            x= 1, 2, 2, 2, 3, 4
            y=11,11,12,13,14, 14
        [/move_unit_fake]
        [unit]
            type=Peasant
            description=Poor Farmer
            user_description= _ "Poor Farmer"
            side=1
            x=4
            y=14
        [/unit]
        [message]
            speaker=Ithelden
            message= _ "You must pay for killing Mebrin!"
        [/message]
        [message]
            speaker=Poor Farmer
            message= _ "I am just a farmer! What did I do?!"
        [/message]
        [message]
            speaker=Ithelden
            message= _ "What did you do?! Your people kidnapped and murdered our greatest leader! And now you will pay!"
        [/message]
        [colour_adjust]
            red=255
            green=0
            blue=0
        [/colour_adjust]
        [sound]
            name=human-die-1.ogg
        [/sound]
        [colour_adjust]
            red=0
            green=0
            blue=0
        [/colour_adjust]
        [kill]
            description=Poor Farmer
            fire_event=no
        [/kill]
        [message]
            speaker=Sir Gerrick
            message= _ "He just killed that innocent farmer! We must stop him!"
        [/message]
        [message]
            speaker=Ethiliel
            message= _ "Stop, Ithelden! I have traveled with these humans, and they are not the ones who harmed Mebrin. They are our allies!"
        [/message]
        [message]
            speaker=Ithelden
            message= _ "You too, Ethiliel? All these menfolk are the same! They fell trees to till the earth; now they have felled our leader! We cannot brook such deeds! You will die with them!"
        [/message]
        [music]
            name=revelation.ogg
        [/music]

        {SG_UNIT (Elvish Fighter) (Disciple of Mebrin) (_"Disciple of Mebrin") 2 3 17}
        {SG_UNIT (Elvish Fighter) (Disciple of Mebrin) (_"Disciple of Mebrin") 2 7 15}
        {SG_UNIT (Elvish Druid) (Disciple of Mebrin) (_"Disciple of Mebrin") 2 6 19}
        [+unit]
            gender=female
        [/unit]
        {SG_UNIT (Elvish Ranger) (Disciple of Mebrin) (_"Disciple of Mebrin") 2 8 15}
        {SG_UNIT (Elvish Druid) (Disciple of Mebrin) (_"Disciple of Mebrin") 2 4 22}
        [+unit]
            gender=female
        [/unit]
        {SG_UNIT (Elvish Hero) (Disciple of Mebrin) (_"Disciple of Mebrin") 2 6 23}
        {SG_UNIT (Elvish Rider) (Disciple of Mebrin) (_"Disciple of Mebrin") 2 11 13}

        [kill]
            description=Ithelden
            animate=no
            fire_event=no
        [/kill]

        [objectives]
            side=1
            [objective]
                description= _ "Keep the enraged elves from sacking Westin"
                condition=win
            [/objective]
            [objective]
                description= _ "Death of Deoran"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Ethiliel"
                condition=lose
            [/objective]
        [/objectives]
    [/event]

    [event]
        name=die
        [filter]
            side=2
        [/filter]
        first_time_only=no

        [set_variable]
            name=how_many_elves
            random=1..6
        [/set_variable]
        [set_variable]
            name=number_of_elves
            value=1
        [/set_variable]

        [while]
            [variable]
                name=number_of_elves
                less_than=$how_many_elves
            [/variable]
            [do]
                [set_variable]
                    name=unit_type
                    random=Elvish Fighter,Elvish Archer,Elvish Ranger,Elvish Shaman,Elvish Druid,Elvish Hero,Elvish Marksman,Elvish Rider,Elvish Fighter,Elvish Archer,Elvish Shaman
                [/set_variable]
                [unit]
                    type=$unit_type
                    description=Disciple of Mebrin
                    user_description= _ "Disciple of Mebrin"
                    side=2
                    x,y=1,12
                [/unit]
                [set_variable]
                    name=number_of_elves
                    add=1
                [/set_variable]
            [/do]
        [/while]

        [message]
            speaker=Disciple of Mebrin
            message= _ "For every one of us you strike down, more will rise!"
        [/message]
    [/event]

    [event]
        name=die
        [filter]
            side=1
        [/filter]
        [message]
            speaker=Ethiliel
            message= _ "We won't be able to hold them off for long. I should go reason with them!"
        [/message]
        [message]
            speaker=Deoran
            message= _ "Are you sure that the elves will greet you any more kindly than they have met us? After all, you did lead us into the forests..."
        [/message]
        [message]
            speaker=Ethiliel
            message= _ "Perhaps not, but it is your only hope. I must reach Ithelden!"
        [/message]

        {SET_LABEL 6 15 _"Ithelden's base"}
        {HIGHLIGHT_IMAGE 6 15 items/gohere.png ()}

        [objectives]
            side=1
            [objective]
                description= _ "Send Ethiliel to the Great Tree and parlay with Ithelden"
                condition=win
            [/objective]
            [objective]
                description= _ "Death of Deoran"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Ethiliel"
                condition=lose
            [/objective]
        [/objectives]
    [/event]

    [event]
        name=die
        [filter]
            description=Ethiliel
        [/filter]
        [message]
            description=Minister Hylas
            message= _ "Ithelden's elves have killed Ethiliel! Now we have no chance to come to an agreement with them. A war with the Elves is imminent."
        [/message]
        [message]
            description=Deoran
            message= _ "We are far away from Weldyn. We'll surely all be killed long before any reinforcements arrive."
        [/message]

        [endlevel]
            result=defeat
        [/endlevel]
    [/event]

    [event]
        name=moveto
        [filter]
            description=Ethiliel
            x=6
            y=15
        [/filter]

        [endlevel]
            result=victory
        [/endlevel]
    [/event]
[/scenario]
