#textdomain wesnoth-ei
[scenario]
    id=03_An_Unexpected_Appearance
    name= _ "An Unexpected Appearance"
    map_data="{campaigns/Eastern_Invasion/maps/03_An_Unexpected_Appearance.map}"
    next_scenario=04a_An_Elven_Alliance
    turns=20

    {DEFAULT_SCHEDULE}

    {INTRO_AND_SCENARIO_MUSIC breaking_the_chains.ogg vengeful.ogg}
    {EXTRA_SCENARIO_MUSIC the_king_is_dead.ogg}
    {EXTRA_SCENARIO_MUSIC wanderer.ogg}

    {campaigns/Eastern_Invasion/utils/deaths.cfg}

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

    [side]
        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,Walking Corpse
        [ai]
            recruitment_pattern=scout,fighter,fighter,archer
        [/ai]
        {GOLD 80 110 140}
        {FLAG_VARIANT undead}
        team_name=undead
        user_team_name=_"Undead"
    [/side]

#ifdef HARD
    {LIMIT_CONTEMPORANEOUS_RECRUITS 2 (Vampire Bat) 4}
#else
    {LIMIT_CONTEMPORANEOUS_RECRUITS 2 (Vampire Bat) 2}
#endif

    {STARTING_VILLAGES 2 7}

    [side]
        type=Dark Adept
        id=Mal-Tar
        name= _ "Mal-Tar"
        facing=sw
        experience=24
        side=3
        canrecruit=yes
        recruit=Walking Corpse
        team_name=undead
        user_team_name=_"Undead"
        {GOLD 10 20 30}
        {FLAG_VARIANT undead}
    [/side]

    # As long as Mal-Tar sits on his keep, ensure that he can't survive long by
    # getting lucky.
    {FORCE_CHANCE_TO_HIT side=1 id=Mal-Tar 100 (
        [have_unit]
            id=Mal-Tar

            [filter_location]
                terrain=Ke
            [/filter_location]
        [/have_unit]
    )}

    [side]
        type=Dark Sorcerer
        id=Mal-Kallat
        name= _ "Mal-Kallat"
        facing=sw
        side=4
        canrecruit=yes
        recruit=Vampire Bat,Skeleton,Skeleton Archer,Walking Corpse
        [ai]
            recruitment_pattern=scout,scout,fighter,fighter,archer
        [/ai]
        team_name=undead
        user_team_name=_"Undead"
        {GOLD 75 100 150}
        {FLAG_VARIANT undead}
    [/side]

#ifdef HARD
    {LIMIT_CONTEMPORANEOUS_RECRUITS 4 (Vampire Bat) 4}
#else
    {LIMIT_CONTEMPORANEOUS_RECRUITS 4 (Vampire Bat) 2}
#endif

    {STARTING_VILLAGES 4 9}

    [event]
        name=prestart

        [item]
            x=21
            y=12
            image=scenery/trapdoor-open.png
        [/item]

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

        [objectives]
            side=1
            [objective]
                description= _ "Defeat either enemy dark sorcerer"
                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=Gweddry
            message= _ "We have escaped from those dark tunnels! But where are we now?"
        [/message]
        [message]
            speaker=Dacyn
            message= _ "We are in the middle of the eastern mountains, in a mountain pass leading east and west. We need to head north, to meet Owaec, but we cannot go through the mountains... we must go east, or west, and hope we can get around them."
        [/message]
        [message]
            speaker=Mal-Kallat
            message= _ "Hahaha! We have you surrounded!"
        [/message]
        [message]
            speaker=Mal-Skraat
            message= _ "Why don’t we see if the new recruit can handle them. After all, there are only two!"
        [/message]
        [message]
            speaker=Mal-Tar
            message= _ "No!! They’ll kill me!"
        [/message]
        [message]
            speaker=Mal-Kallat
            message= _ "That would be your problem, then."
        [/message]
        [message]
            speaker=Gweddry
            message= _ "These undead are toying with us! This adept is weak — we may be able to take his castle."
        [/message]
        [message]
            speaker=Dacyn
            message= _ "A good idea. Then, we must kill either of the dark sorcerers. I would prefer to attack the western one, so we can get closer to Wesnoth."
        [/message]
    [/event]

    [event]
        name=last breath
        [filter]
            id=Mal-Skraat
        [/filter]
        [message]
            speaker=Mal-Skraat
            message= _ "No! You have defeated me, and can re-enter Wesnoth!"
        [/message]
        [set_variable]
            name="first_fork"
            value="west"
        [/set_variable]
        [endlevel]
            result=victory
            next_scenario=04a_An_Elven_Alliance
            bonus=yes
            {NEW_GOLD_CARRYOVER 40}
        [/endlevel]
    [/event]

    [event]
        name=last breath
        [filter]
            id=Mal-Kallat
        [/filter]
        [message]
            speaker=Mal-Skraat
            message= _ "You have defeated my brother, but I will follow you and kill you!"
        [/message]
        [set_variable]
            name="first_fork"
            value="east"
        [/set_variable]
        [endlevel]
            result=victory
            next_scenario=04b_The_Undead_Border_Patrol
            bonus=yes
            {NEW_GOLD_CARRYOVER 40}
        [/endlevel]
    [/event]

    {EARLY_DEFEAT}
[/scenario]
