#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}

    {SETUP_CAMPFIRES}

    {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}

    {EI_TRACK {JOURNEY_04B_NEW} }

    # wmllint: validate-off
    [side]
        side=1
        controller=human
        {GOLD 175 130 100}
        team_name=wesnothians
        user_team_name= _ "Wesnothians"
        {FLAG_VARIANT loyalist}

        # wmllint: recognize Gweddry
        {CHARACTER_STATS_GWEDDRY}
    [/side]
    # wmllint: validate-on

    [side]
        side=2
        controller=ai
        recruit=Skeleton,Skeleton Archer,Skeleton Rider,Soulless
        {GOLD 80 120 150}
        {INCOME 2 3 3}
        team_name=undead
        user_team_name= _ "Undead"
        {FLAG_VARIANT undead}

        type=Dark Sorcerer
        id=Mal-Skraat
        name= _ "Mal-Skraat"
        gender=male
        canrecruit=yes

        facing=se
        [modifications]
            {TEAM_COLOR_OVERRIDE () darkred}
        [/modifications]

        [ai]
            recruitment_pattern=scout,fighter,fighter,archer
            scout_village_targeting=0.8
            aggression=0.8
        [/ai]
    [/side]

    [side]
        side=3
        controller=ai
#ifdef HARD
        recruit=Blood Bat,Vampire Bat,Skeleton Archer,Skeleton,Dark Adept,Ghost
#else
        recruit=Vampire Bat,Skeleton Archer,Skeleton,Dark Adept
#endif
        {GOLD 100 140 170}

        team_name=undead
        user_team_name= _ "Undead"
        {FLAG_VARIANT undead}

        type=Lich
        id=Mal-Telnarad
        name= _ "Mal-Telnarad"
        canrecruit=yes

        facing=nw

        [ai]
            {NO_SCOUTS}
            recruitment_pattern=scout,fighter,archer,fighter,archer
            aggression=0.4
        [/ai]
    [/side]

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

    # Start with all the villages in the swamp.
    {STARTING_VILLAGES_AREA 3 30-45 1-25 1}

    [event]
        name=prestart

        [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]

        [recall]
            id=Dacyn
            x,y=20,12
        [/recall]
    [/event]

    [event]
        name=start

        [message]
            speaker=Dacyn
            message= _ "Now that we are free of the mountain range the path northwards is clear. Let us go north 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 who attacked us and destroy him. He must be nearby."
        [/message]

        # wmllint: local spelling teleporting
        [message]
            speaker=Dacyn
            message= _ "This is no ordinary Lich you hunt. Even if you manage to find him, how will you prevent him from simply teleporting away? We should head north; there is much I must learn before we confront this menace."
        [/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 head for the Northern Outpost."
        [/message]

        {VARIABLE east_trek no}

        [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 you insist on traveling east, or shall we defeat this dark sorcerer?"
        [/message]

        [message]
            speaker=Gweddry
            message= _ "Hmm..."
            [option]
                label= _ "I wish to destroy the evil before it can spread. East we go!"
                [command]
                    [message]
                        speaker=Dacyn
                        message= _ "I cannot say 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]

                    {VARIABLE east_trek yes}

                    [endlevel]
                        result=victory
                        bonus=yes
                        next_scenario=04c_Mal-Ravanals_Capital
                        {NEW_GOLD_CARRYOVER 40}
                    [/endlevel]
                [/command]
            [/option]
            [option]
                label= _ "You are right. It is foolish to go onward — we will turn back."
                [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 undead 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]

                {VARIABLE east_trek yes}

                [endlevel]
                    result=victory
                    next_scenario=04c_Mal-Ravanals_Capital
                    {NEW_GOLD_CARRYOVER 40}
                [/endlevel]
            [/else]
        [/if]
    [/event]

    {FOREIGN_DEFEAT}

    {HERODEATH_GWEDDRY}
    {HERODEATH_DACYN}
[/scenario]
