#textdomain wesnoth-dm
[scenario]
    id=14_Shadows_in_the_Dark
    name= _ "Shadows in the Dark"
    {MEMOIRS_MAP 14_Shadows_in_the_Dark.map}
    next_scenario=15_Save_the_King
    {TURNS 28 26 24}
    {DEFAULT_SCHEDULE}

    {INTRO_AND_SCENARIO_MUSIC the_deep_path.ogg underground.ogg}
    {EXTRA_SCENARIO_MUSIC battle.ogg}
    {EXTRA_SCENARIO_MUSIC legends_of_the_north.ogg}
    {EXTRA_SCENARIO_MUSIC frantic.ogg}

    [story]
        [part]
            story= _ "Kalenz and his troops fared swiftly south and then westward along the north bank of the Great River. They successfully evaded the orcs, but would soon find there were grimmer foes awaiting them."
        [/part]
    [/story]
    {DM_TRACK {KALENZ_STAGE2}}

    #wmllint: validate-off
    [side]
        side=1
        controller=human
        recruit={ELVES}
        fog=yes
        save_id=Player
        team_name=allies
        user_team_name= _ "Elves"
        side_name= _ "Kalenz"
        {FLAG_VARIANT wood-elvish}
        [leader]
            {KALENZ}
            facing=sw
        [/leader]
        [unit]
            {CHANTAL}
            placement=leader
        [/unit]
        {GOLD 210 180 150}
    [/side]

    [side]
        side=2
        controller=ai
        recruit=Skeleton,Skeleton Archer
        {GOLD 120 150 180}
        {INCOME 0 1 2}
        team_name=enemies
        user_team_name= _ "Undead"
        {FLAG_VARIANT undead}
        [leader]
            id=Rudimil
            name= _"Rudimil"
            type=Death Knight
            facing=sw
        [/leader]
        [ai]
            recruitment_pattern=fighter,archer
            [goal]
                name=target
                [criteria]
                    id=Kalenz
                [/criteria]
                value=10
            [/goal]
        [/ai]
    [/side]

    [side]
        side=3
        controller=ai
        recruit=Vampire Bat,Dark Adept,Walking Corpse,Ghost,Soulless
        {GOLD 120 150 180}
        {INCOME 0 1 2}
        team_name=enemies
        user_team_name= _ "Undead"
        {FLAG_VARIANT undead}
        [leader]
            id=Roth-Malal
            name=_ "Roth-Malal"
            type=Necromancer
            facing=se
        [/leader]
        [ai]
            recruitment_pattern=scout,fighter,archer
        [/ai]
    [/side]

    [side]
        side=4
        controller=ai
#ifdef EASY
        recruit=Skeleton, Skeleton Archer, Vampire Bat
#endif
#ifdef NORMAL
        recruit=Skeleton, Revenant, Skeleton Archer, Bone Shooter, Ghost, Vampire Bat, Blood Bat, Chocobone, Dark Adept
#endif
#ifdef HARD
        recruit=Skeleton, Skeleton Archer, Revenant, Draug, Banebow, Bone Shooter, Deathblade, Ghost, Wraith, Shadow, Nightgaunt, Chocobone, Dark Adept, Spectre, Blood Bat, Vampire Bat
#endif
        {GOLD 120 140 160}
        {INCOME 1 2 3}
        team_name=enemies
        user_team_name= _ "Undead"
        {FLAG_VARIANT undead}
        [leader]
            id=Barth-Malal
            name=_ "Barth-Malal"
            type=Necromancer
            facing=ne
        [/leader]
        [ai]
            recruitment_pattern=scout,fighter,archer
            aggression=0.2
        [/ai]
    [/side]
    #wmllint: validate-on

    [event]
        name=prestart

        {MODIFY_UNIT (side=1) facing sw}

        [objectives]
            side=1
            [objective]
                description= _ "Defeat all enemy leaders"
                condition=win
            [/objective]
            [objective]
                description= _ "Death of Kalenz"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Chantal"
                condition=lose
            [/objective]

            {TURNS_RUN_OUT}

            [gold_carryover]
                bonus=yes
                carryover_percentage=80
            [/gold_carryover]
        [/objectives]

        {OBJ_POTION_HOLY_ALT 16 5  shadows_holywater1}
        {OBJ_POTION_HOLY_ALT 32 5  shadows_holywater2}
        {OBJ_POTION_HOLY_ALT 20 10 shadows_holywater3}
    [/event]

    [event]
        name=start

        [message]
            speaker=Kalenz
            message= _ "This forest looks quiet — too quiet. Proceed carefully, I don’t like this at all."
        [/message]
    [/event]

    [event]
        name=turn 2
        [lift_fog]
            [filter_side]
                side=1
            [/filter_side]
            [filter]
                id=Barth-Malal
            [/filter]
        [/lift_fog]
        [message]
            speaker=Barth-Malal
            message= _ "Living... Soon, you’ll be more troops for my master!"
        [/message]
        [message]
            speaker=Kalenz
            message= _ "Undead! Where did they come from?"
        [/message]
        [message]
            speaker=Chantal
            message= _ "We should try to go west. I sense things are worse on the eastern front."
        [/message]
    [/event]

    [event]
        name=turn 8
        {NAMED_UNIT 2 (Spectre)    51 1 Nameless _"Nameless" (facing=sw)}
        {NAMED_UNIT 2 (Spectre)    51 2 Hraul _"Hraul" (facing=sw)}
        {NAMED_UNIT 2 (Draug)      51 3 Atrag _"Atrag" (facing=sw)}
        {NAMED_UNIT 2 (Banebow)    51 4 Horr _"Horr" (facing=sw)}
        {NAMED_UNIT 2 (Nightgaunt) 50 4 Nfrigt _"Nfrigt" (facing=sw)}
        {NAMED_UNIT 2 (Revenant)   50 3 Rkrin _"Rkrin" (facing=sw)}

        [role]
            side=2,3,4
            canrecruit=yes
            role=enemy_speaker
        [/role]
        [lift_fog]
            [filter_side]
                side=1
            [/filter_side]
            [filter]
                role=enemy_speaker
            [/filter]
        [/lift_fog]
        [message]
            role=enemy_speaker
            message= _ "We have reinforcements!"
        [/message]
        {MODIFY_UNIT (role=enemy_speaker) role ""}
    [/event]

    [event]
        name=turn 11
        {NAMED_UNIT 2 (Spectre)    51 16 Haunt _"Haunt" (facing=sw)}
        {NAMED_UNIT 2 (Spectre)    51 17 Gdal _"Gdal" (facing=sw)}
        {NAMED_UNIT 2 (Draug)      50 16 Oltr _"Oltr" (facing=sw)}
        {NAMED_UNIT 2 (Deathblade) 50 17 Orbl _"Orbl" (facing=sw)}
        {NAMED_UNIT 2 (Nightgaunt) 49 16 Nifigt _"Nifigt" (facing=sw)}
        {NAMED_UNIT 2 (Deathblade) 49 17 Dert _"Dert" (facing=sw)}

        [role]
            side=2,3,4
            canrecruit=yes
            role=enemy_speaker
        [/role]
        [lift_fog]
            [filter_side]
                side=1
            [/filter_side]
            [filter]
                role=enemy_speaker
            [/filter]
        [/lift_fog]
        [message]
            role=enemy_speaker
            message= _ "And now even more reinforcements!"
        [/message]
        {MODIFY_UNIT (role=enemy_speaker) role ""}
    [/event]

    #wmllint: recognize Delfador
    [event]
        name=delfador

        {DELFADOR_REAPPEARS 50 19}
    [/event]

    [event]
        name=turn 12

        [fire_event]
            name=delfador
        [/fire_event]

        [message]
            speaker=Delfador
            message= _ "Foul creatures, it is time for your final rest!"
        [/message]
        [message]
            speaker=Chantal
            message= _ "That is Delfador. Do you see now?"
        [/message]
        [message]
            speaker=Kalenz
            message= _ "I do. He is like a blazing fire to my inner eye. I think you have chosen well, granddaughter; he is indeed the one to whom the Book of Crelanu should pass."
        [/message]
        [message]
            speaker=Chantal
            message= _ "If I were human, I think I would be in love with him."
        [/message]
        [message]
            speaker=Kalenz
            message= _ "If you were human, you would be quite right to be. Strange... they are such surly children in the main, short-lived and crude and quarrelsome. And yet, even our greatest mystics do not shine so brightly as this one."
        [/message]
        [message]
            speaker=Chantal
            message= _ "I hope the Book does not destroy him."
        [/message]
        [message]
            speaker=Kalenz
            message= _ "You speak my thoughts, granddaughter. May it be so."
        [/message]

        [objectives]
            side=1
            [objective]
                description= _ "Defeat all enemy leaders"
                condition=win
            [/objective]
            [objective]
                description= _ "Death of Kalenz"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Delfador"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Chantal"
                condition=lose
            [/objective]

            {TURNS_RUN_OUT}

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

    [event]
        name=moveto
        [filter]
            side=1
            x=38-52
            y=1-5
        [/filter]
        [filter_condition]
            [not]
                [have_unit]
                    id=Delfador
                [/have_unit]
            [/not]
        [/filter_condition]

        # try to impede an elvish victory before Delfador shows up
        [message]
            speaker=Rudimil
            message= _ "The elves have advanced much further than anticipated; Krumful, Unhul, arise!"
        [/message]
        {NAMED_UNIT 2 (Draug)   46 2 Krumful _"Krumful" (facing=sw)}
        [+unit]
            animate=yes
        [/unit]
        {NAMED_UNIT 2 (Spectre) 44 2 Unhul _"Unhul" (facing=sw)}
        [+unit]
            animate=yes
        [/unit]
    [/event]

    [event]
        name=victory

        ## In case we won before Delfador's time to show up...
        [if]
            [not]
                [have_unit]
                    id=Delfador
                [/have_unit]
            [/not]

            [then]
                [fire_event]
                    name=delfador
                [/fire_event]
                [message]
                    speaker=Delfador
                    message= _ "I have arrived too late for the entertainment, it would seem."
                [/message]
            [/then]
        [/if]

        [message]
            speaker=Kalenz
            message= _ "Well met, Delfador. Chantal has told me of you. I am Kalenz, High Lord of the Elves, and we are in your debt today."
        [/message]
        [message]
            speaker=Delfador
            message= _ "It is my honor to meet you. And it relieves my mind to know Chantal is safe and with her kin again."
        [/message]
        [message]
            speaker=Chantal
            message= _ "I am not sure there is safety for anyone in these days, but we all travel the same road and face the same foes."
        [/message]
        [message]
            speaker=Kalenz
            message= _ "Yes. We will follow you to the Ford of Abez, Delfador. Let us hope we are not too late to prevent an orcish victory there."
        [/message]

        {DELFADOR_TAKES_CONTROL}
        [modify_side]
            side=1
            user_team_name= _ "Loyalists"
        [/modify_side]
    [/event]

    {MEMOIRS_DEATHS}
[/scenario]
