#textdomain wesnoth-ei
[scenario]
    id=04b_The_Undead_Border_Patrol
    name= _ "The Undead Border Patrol"
    map_data="{campaigns/Eastern_Invasion/maps/04b_The_Undead_Border_Patrol.map}"
    turns=20
    next_scenario=05_Northern_Outpost

    {DEFAULT_SCHEDULE}

    {INTRO_AND_SCENARIO_MUSIC legends_of_the_north.ogg the_dangerous_symphony.ogg}
    {EXTRA_SCENARIO_MUSIC the_city_falls.ogg}
    {EXTRA_SCENARIO_MUSIC vengeful.ogg}

    {campaigns/Eastern_Invasion/utils/deaths.cfg}

    [story]
        [part]
            show_title=yes
            {TO_THE_UNDEAD_BORDER_PATROL}
        [/part]
    [/story]

    [side]
        race=Humans
        type=Lieutenant
        id=Gweddry
        name= _ "Gweddry"
        side=1
        canrecruit=yes
        controller=human
        team_name=wesnothians
        user_team_name=_"Wesnothians"
        {GOLD 200 150 100}
        {FLAG_VARIANT loyalist}
    [/side]

    [side]
        type=Dark Sorcerer
        id=Mal-Skraat
        name= _ "Mal-Skraat"
        side=2
        canrecruit=yes
        recruit=Vampire Bat,Skeleton,Skeleton Archer
        [ai]
            {NO_SCOUTS}
            recruitment_pattern=scout,fighter,archer
        [/ai]
        {GOLD 60 120 160}
        {FLAG_VARIANT undead}
        team_name=undead
        user_team_name=_"Undead"
    [/side]

    [side]
        type=Lich
        id=Mal-Telnarad
        name= _ "Mal-Telnarad"
        side=3
        canrecruit=yes
        facing=sw
#ifdef HARD
        recruit=Blood Bat,Vampire Bat,Skeleton Archer,Skeleton,Dark Adept,Ghost
#else
        recruit=Vampire Bat,Skeleton Archer,Skeleton,Dark Adept
#endif
        [ai]
            {NO_SCOUTS}
            recruitment_pattern=scout,fighter,archer,fighter,archer
        [/ai]
        {GOLD 100 140 170}
        {FLAG_VARIANT undead}
        team_name=undead
        user_team_name=_"Undead"
    [/side]

#ifdef HARD
    {LIMIT_CONTEMPORANEOUS_RECRUITS 3 "Blood Bat" 2}
#endif

    {STARTING_VILLAGES 3 14}

    [event]
        name=prestart

        # {SCATTER_IMAGE (terrain=Gg) 5 scenery/pine1.png}

        [objectives]
            side=1
            [objective]
                description= _ "Defeat either enemy leader"
                condition=win
            [/objective]
            [objective]
                description= _ "Death of Gweddry"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Dacyn"
                condition=lose
            [/objective]

            {TURNS_RUN_OUT}

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

    [event]
        name=start
        [recall]
            id=Dacyn
        [/recall]
        [message]
            speaker=Dacyn
            message= _ "We have gotten out of that mountain range now, and the path northwards is clear. Let us go north, now, and try to reach Owaec at the outpost."
        [/message]
        [message]
            speaker=Gweddry
            message= _ "Wait. I am not sure that is the best option. If we go east now, we may be able to find the lich Mal-Ravanal who attacked us, and destroy him before he can attack Wesnoth again. After we escaped, I suspect he went back east to find us."
        [/message]
        [message]
            speaker=Mal-Skraat
            message= _ "They run from me! Still, it will not help them, the border patrol will destroy them. I may even be promoted!"
        [/message]
    [/event]

    [event]
        name=last breath
        [filter]
            id=Mal-Skraat
        [/filter]
        [message]
            speaker=Mal-Skraat
            message= _ "Now I will never get promoted!"
        [/message]
        [kill]
            id=Mal-Skraat
            animate=yes
        [/kill]
        [message]
            speaker=Dacyn
            message= _ "Come, let us return to Wesnoth and aid the Northern Outpost."
        [/message]
        [endlevel]
            result=victory
            bonus=yes
            next_scenario=05_Northern_Outpost
            {NEW_GOLD_CARRYOVER 40}
        [/endlevel]
    [/event]

    [event]
        name=die
        [filter]
            id=Mal-Telnarad
        [/filter]
        [message]
            speaker=Dacyn
            message= _ "We have defeated this patrol, but we can still turn back! Do we want to go further east now, or do we want to try to turn back and defeat this dark sorcerer?"
        [/message]
        [message]
            speaker=Gweddry
            message= _ "Hmm..."
            [option]
                message= _ "I wish to destroy the evil before it can spread. East we go!"
                [command]
                    [message]
                        speaker=Dacyn
                        message= _ "I cannot say if this is a good decision, but I will follow you."
                    [/message]
                    [message]
                        speaker=Mal-Skraat
                        message= _ "Noo!! I can’t be promoted if they run away!"
                    [/message]
                    [endlevel]
                        result=victory
                        bonus=yes
                        next_scenario=04c_Mal-Ravanals_Capital
                        {NEW_GOLD_CARRYOVER 40}
                    [/endlevel]
                [/command]
            [/option]
            [option]
                message= _ "You are right. It is foolish to go onward — we must defeat Mal-Skraat and turn back, going to the Northern Outpost."
                [command]
                    [message]
                        speaker=Mal-Skraat
                        message= _ "Good! If I defeat them, I can become a lich!"
                    [/message]
                [/command]
            [/option]
        [/message]
    [/event]

    [event]
        name=time over
        [if]
            [have_unit]
                id=Mal-Telnarad
            [/have_unit]
            [then]
                [message]
                    speaker=Dacyn
                    message= _ "We failed to defeat either enemy! Now more liches will come, and we will be overwhelmed!"
                [/message]
                [endlevel]
                    result=defeat
                [/endlevel]
            [/then]
            [else]
                [message]
                    speaker=Gweddry
                    message= _ "We cannot spend any more time attempting to defeat Mal-Skraat. Like it or not, we must go further into these undead lands."
                [/message]
                [message]
                    speaker=Mal-Skraat
                    message= _ "Noo!! He will reach Mal-Ravanal’s capital, and I shall be punished for letting him escape!"
                [/message]
                [endlevel]
                    result=victory
                    next_scenario=04c_Mal-Ravanals_Capital
                    {NEW_GOLD_CARRYOVER 40}
                [/endlevel]
            [/else]
        [/if]
    [/event]

    {FOREIGN_DEFEAT}
[/scenario]
