#textdomain wesnoth-trow
[scenario]
    id=The_Fall
    name= _ "The Fall"
    next_scenario=A_Harrowing_Escape
    map_data="{campaigns/The_Rise_Of_Wesnoth/maps/The_Fall.map}"
    {TURNS 23 20 17}
    {DEFAULT_SCHEDULE}

    {SCENARIO_MUSIC the_dangerous_symphony.ogg}
    {EXTRA_SCENARIO_MUSIC battle.ogg}

    {TROW_THE_FALL_STORY}
    {THE_FALL_BIGMAP}

    {TROW_DEATHS}

    [side]
        type=Noble Fighter
        id=Prince Haldric
        name= _ "Prince Haldric"
        unrenamable=yes
        side=1
        canrecruit=yes
        gold=100
        controller=human
        team_name=Haldric
        user_team_name=_"Stormvale"
        {FLAG_VARIANT loyalist}
    [/side]

    {STARTING_VILLAGES 1 6}

    [side]
        type=Wesfolk Outcast
        gender=female
        id=Wesfolk Leader
        name= _ "Wesfolk Leader"
        profile="portraits/lady_outlaw.png"
        side=2
        canrecruit=yes
        recruit=Footpad,Poacher,Thief,Thug
        [ai]
            recruitment_pattern=fighter,fighter,archer,scout
            {NO_SCOUTS}
            aggression=0.15
            caution=0.5
            passive_leader=yes
            grouping=defensive
            {ATTACK_DEPTH 3 4 5}
        [/ai]
        {GOLD 90 130 170}
        team_name=wesfolk
        user_team_name=_"Wesfolk"
    [/side]

    {STARTING_VILLAGES 2 7}

    [side]
        type=Orcish Warlord
        id=Tan-Rarbag
        name= _ "Tan-Rarbag"
        profile=portraits/orcs/transparent/grunt-3.png
        side=3
        canrecruit=yes
        recruit=Orcish Archer, Orcish Assassin, Orcish Grunt, Wolf Rider, Goblin Spearman
        {GOLD 180 260 350}
        team_name=orcs
        user_team_name=_"Orcs"
        [ai]
            recruitment_pattern=scout,scout,fighter,fighter,mixed fighter,archer
            {NO_SCOUTS}
            passive_leader=yes
            recruitment_ignore_bad_movement=yes
        [/ai]
        [ai]
            time_of_day=first_watch,second_watch
            aggression=0.75
            caution=0.0
            grouping=no
        [/ai]
    [/side]

    [side]
        type=Orcish Warrior
        id=Tan-Erang
        name= _ "Tan-Erang"
        side=4
        canrecruit=yes
        recruit=Orcish Archer, Orcish Assassin, Orcish Grunt, Wolf Rider, Goblin Spearman
        {GOLD 160 220 310}
        team_name=orcs
        user_team_name=_"Orcs"
        [ai]
            recruitment_pattern=scout,scout,fighter,fighter,mixed fighter,archer
            {NO_SCOUTS}
        [/ai]
        [ai]
            time_of_day=first_watch,second_watch
            aggression=0.75
            caution=0.0
            grouping=no
        [/ai]
    [/side]

#define NORTH_GUARD X Y ID_STRING NAME_STRING SECOND_TRAIT_WML
    [unit]
#ifdef EASY
        type=Shock Trooper
#endif
#ifdef NORMAL
        type=Heavy Infantryman
#endif
#ifdef HARD
        type=Heavy Infantryman
#endif
        side=1
        id={ID_STRING}
        name={NAME_STRING}  # wmllint: ignore
        x={X}
        y={Y}
        [modifications]
            {TRAIT_LOYAL}
            {SECOND_TRAIT_WML}
        [/modifications]
        {IS_LOYAL}
    [/unit]
#enddef

    [event]
        name=prestart

        {MODIFY_UNIT (id=Wesfolk Leader) experience $wesfolk_leader_store.experience}

#ifdef EASY
        {LOYAL_UNIT 2 (Poacher) 11 20} {GUARDIAN}
#else
        {LOYAL_UNIT 2 (Poacher) 11 20} {GUARDIAN}
        {LOYAL_UNIT 2 (Poacher)  7 21} {GUARDIAN}
        {LOYAL_UNIT 2 (Poacher)  9 22} {GUARDIAN}
#endif

        [recall]
            id=King Eldaric IV
            x=28
            y=15
        [/recall]

        {NORTH_GUARD 10 6 (Thegwyn) (_ "Thegwyn") {TRAIT_RESILIENT}}
        {NORTH_GUARD 12 6 (Galdred) (_ "Galdred") {TRAIT_STRONG}}
        {NORTH_GUARD 12 10 (Tromas) (_ "Tromas") {TRAIT_FEARLESS}}

        [objectives]
            side=1
            [objective]
                description= _ "Defeat the Wesfolk Leader"
                condition=win
            [/objective]
            [objective]
                description= _ "Death of Prince Haldric"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of King Eldaric IV"
                condition=lose
            [/objective]
            [objective]
                description= _ "Orcs kill the Wesfolk Leader"
                condition=lose
            [/objective]
            [objective]
                description= _ "Turns run out"
                condition=lose
            [/objective]

            note={EARLY_FINISH_BONUS_NOTE}+{NEW_GOLD_CARRYOVER_NOTE_40}
        [/objectives]
    [/event]

    [event]
        name=start

        [message]
            speaker=King Eldaric IV
            message= _ "Haldric, things have not gone well! The orcs have arrived. We met them at the north keep but they were just too many. They have flanked us to the east in the mountains. I have my personal guards holding the pass to the north, but they won't be able to last long... We must evacuate our home."
        [/message]

        [message]
            speaker=Prince Haldric
            message= _ "That's awful! And it only gets worse. That Wesfolk rabble has set up shop again in the south pass..."
        [/message]

        [message]
            speaker=King Eldaric IV
            message= _ "That's the only way out of the valley! This is a disaster! We must defeat that Wesfolk scum and flee to the south. Our home is lost... We must make haste."
        [/message]

        [message]
            speaker=Tan-Rarbag
            message= _ "So HUMAN, care to make your final stand?"
        [/message]

        [message]
            speaker=Tan-Erang
            message= _ "Die! Die! Die!"
        [/message]

        [message]
            speaker=Wesfolk Leader
            message= _ "This is going to get ugly..."
        [/message]
    [/event]

    [event]
        name=turn 14
        [message]
            speaker=King Eldaric IV
            message= _ "Hurry! Only death awaits in this valley!"
        [/message]
    [/event]

    [event]
        name=die
        [filter]
            id=Tan-Erang
        [/filter]

        [filter_second]
            side=1
        [/filter_second]

        {LOOT 75 1}
    [/event]

    [event]
        name=die
        [filter]
            id=Tan-Rarbag
        [/filter]

        [filter_second]
            side=1
        [/filter_second]

        {LOOT 75 1}
    [/event]

    [event]
        name=last breath

        [filter]
            id=Wesfolk Leader
        [/filter]

        [filter_second]
            side=1
        [/filter_second]

        [message]
            speaker=unit
            # wmllint: local spelling surren
            message= _ "Umm, I invoke the right of surren..."
        [/message]

        [message]
            speaker=King Eldaric IV
            message= _ "Nay! Off with your hea- - -"	# wmllint: no spellcheck
        [/message]

        [message]
            speaker=unit
            message= _ "But I can help! Really! You could use me and my men's skills on the long road ahead!"
        [/message]

        [message]
            speaker=King Eldaric IV
            message= _ "Haldric, what say you on this matter?"
        [/message]

        [message]
            speaker=Prince Haldric
            message= _ "Hmm... after some thought..."

            [option]
                message= _ "I think that your skills may be useful. You may join us."
                [command]
                    [message]
                        speaker=Wesfolk Leader
                        message= _ "Let there be peace between us, our survival depends on it."
                    [/message]
                    [allow_recruit]
                        side=1
                        type=Thief,Thug,Poacher,Footpad
                    [/allow_recruit]
                    [message]
                        speaker=Prince Haldric
                        message= _ "So what shall I call you?"
                    [/message]
                    [message]
                        speaker=Wesfolk Leader
                        message= _ "The Lady Outlaw will do."
                    [/message]
                    [store_unit]
                        [filter]
                            id=Wesfolk Leader
                        [/filter]

                        kill=yes
                        variable=wesfolk_leader_store
                    [/store_unit]

                    [unit]
                        id=Lady Outlaw
                        name= _ "Lady Outlaw"
                        type=$wesfolk_leader_store.type
                        gender=female
                        side=1
                        x,y=$wesfolk_leader_store.x,$wesfolk_leader_store.y
                        experience=$wesfolk_leader_store.experience
                        moves=$wesfolk_leader_store.moves
                        overlays=misc/hero-icon.png
                        random_traits=no
                        profile=portraits/lady_outlaw.png
                        [modifications]
                            {TRAIT_LOYAL}
                        [/modifications]
                    [/unit]

                    # wmllint: recognize Lady Outlaw

                    [set_variable]
                        name=have_lady
                        value=1
                    [/set_variable]
                [/command]
            [/option]
            [option]
                message= _ "Your word can't be trusted. Prepare to meet your gods!"
                image=portraits/haldric-mad.png
                [command]
                    [message]
                        speaker=Wesfolk Leader
                        message= _ "Arrogant fools! (Reaches into pocket) POOF!"
                    [/message]

                    {FULL_HEAL (id=Lady Outlaw)}

                    [store_unit]
                        [filter]
                            id=Wesfolk Leader
                        [/filter]

                        kill=yes
                        variable=lady_store
                    [/store_unit]

                    {VARIABLE lady_store.id (Lady Outlaw)}
                    {VARIABLE lady_store.name ( _ "Lady Outlaw")}
                    {VARIABLE lady_store.canrecruit no}
                    {VARIABLE lady_store.side 1}

                    # wmllint: recognize Lady Outlaw

                    [set_variable]
                        name=have_lady
                        value=0
                    [/set_variable]

                    [message]
                        speaker=King Eldaric IV
                        message= _ "Argh, she's gone. Next time, more sword, less chat."
                    [/message]

                    [message]
                        speaker=Prince Haldric
                        message= _ "She's clever! Maybe I made the wrong choice. Well, at least she left some of her gold behind..."
                    [/message]

#ifdef EASY
                    {LOOT 300 1}
#endif

#ifdef NORMAL
                    {LOOT 250 1}
#endif

#ifdef HARD
                    {LOOT 200 1}
#endif
                [/command]
            [/option]
        [/message]
        [message]
            speaker=King Eldaric IV
            message= _ "Son, you must lead our people through the south pass. I will remain behind to hold off these vile monsters for as long as I can."
        [/message]
        [message]
            speaker=Prince Haldric
            message= _ "But, Father!"
        [/message]
        [message]
            speaker=King Eldaric IV
            message= _ "It's the only way. Go now, and don't look back! Luck be with you!"
        [/message]

        [endlevel]
            result=victory
            bonus=yes
            {NEW_GOLD_CARRYOVER 40}
        [/endlevel]
    [/event]

    [event]
        name=die
        [filter]
            id=Wesfolk Leader
        [/filter]

        [filter_second]
            side=3, 4
        [/filter_second]

        [message]
            speaker=King Eldaric IV
            message= _ "We're surrounded! The orcs have taken the southern pass! All is lost!"
        [/message]

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

    [event]
        name=time over
        [message]
            speaker=King Eldaric IV
            message= _ "We're surrounded! I can see their reinforcements! All is lost!"
        [/message]
    [/event]

    [event]
        name=moveto
        [filter]
            side=3, 4
            x=26-30
            y=13-15
        [/filter]
        [message]
            speaker=Prince Haldric
            message= _ "Our home! Where shall we go!"
        [/message]
        [message]
            speaker=King Eldaric IV
            message= _ "There can be no looking back! We must go south."
        [/message]
    [/event]

    [event]
        name=victory
        [kill]
            id=King Eldaric IV
        [/kill]

        {CLEAR_VARIABLE wesfolk_leader_store}
    [/event]
[/scenario]
