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

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

    {EI_TRACK {JOURNEY_03_NEW} }

    # wmllint: validate-off
    [side]
        side=1
        controller=human
        {GOLD 200 150 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 110 140}
        team_name=undead
        user_team_name= _ "Undead"
        {FLAG_VARIANT undead}

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

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

        [ai]
            recruitment_pattern=scout,scout,fighter,fighter,archer
        [/ai]

        [ai]
            recruitment_pattern=fighter,archer,scout,scout
            aggression=0.6
            grouping=no
            [goal]
                [criteria]
                    id=Gweddry
                [/criteria]
                value=5
            [/goal]
        [/ai]
    [/side]

    [side]
        side=3
        controller=ai
        recruit=Walking Corpse
        {GOLD 10 20 30}
        team_name=undead
        user_team_name= _ "Undead"
        {FLAG_VARIANT undead}

        type=Dark Adept
        id=Mal-Tar
        name= _ "Mal-Tar"
        canrecruit=yes

        facing=sw
        experience=24

        [ai]
            aggression=1.0
        [/ai]
    [/side]

    [side]
        side=4
        controller=ai
        recruit=Vampire Bat,Skeleton,Skeleton Archer,Ghoul
        {GOLD 75 100 150}
        team_name=undead
        user_team_name= _ "Undead"
        {FLAG_VARIANT undead}

        type=Dark Sorcerer
        id=Mal-Kallat
        name= _ "Mal-Kallat"
        canrecruit=yes

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

        [ai]
            recruitment_pattern=fighter,archer,scout,scout
            aggression=0.6
            grouping=no
            [goal]
                [criteria]
                    id=Dacyn
                [/criteria]
                value=5
            [/goal]
        [/ai]
    [/side]

    {PLACE_IMAGE scenery/trapdoor-open.png 21 12}

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

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

    {STARTING_VILLAGES 2 7}

    {STARTING_VILLAGES 4 9}

    [event]
        name=prestart

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

        [recall]
            id=Dacyn
        [/recall]
    [/event]

    [event]
        name=start

        [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, 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 should attack at once and take his fort."
        [/message]

        [message]
            speaker=Dacyn
            message= _ "Indeed, I see no better option. Then, we must kill either of the dark sorcerers. I would prefer to attack the western one, so we can return 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]

        {VARIABLE first_fork west}

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

        {VARIABLE first_fork east}

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

    {EARLY_DEFEAT}

    {HERODEATH_GWEDDRY}
    {HERODEATH_DACYN}
[/scenario]
