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

    {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."
            delay=4000
        [/part]
    [/story]
    {DM_TRACK {KALENZ_STAGE2}}

    #wmllint: validate-off
    [side]
        # wmllint: recognize Kalenz
        side=1
        no_leader=yes
        controller=human
        persistent=yes
        save_id=Player
        team_name=allies
        user_team_name= _ "Elves"
        recruit={ELVES}
        fog=yes
        {FLAG_VARIANT wood-elvish}
    [/side]
    #wmllint: validate-on

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

    [side]
        type=Necromancer
        id=Roth-Malal
        name=_ "Roth-Malal"
        facing=se
        side=3
        canrecruit=yes
        controller=ai
        recruit=Vampire Bat,Dark Adept,Walking Corpse,Ghost,Soulless
        [ai]
            recruitment_pattern=scout,fighter,archer
        [/ai]
        team_name=enemies
        user_team_name= _ "Undead"
        {GOLD 120 200 250}
        {FLAG_VARIANT undead}
    [/side]

    [side]
        type=Necromancer
        id=Barth-Malal
        name=_ "Barth-Malal"
        facing=ne
        side=4
        team_name=enemies
        user_team_name= _ "Undead"
        controller=ai

        {GOLD 50 90 170}
        {INCOME 1 2 4}

        canrecruit=yes
        [ai]
            recruitment_pattern=scout,fighter,archer
            aggression=0.2
        [/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
        {FLAG_VARIANT undead}
    [/side]

    [event]
        name=prestart

        [recall]
            id=Kalenz
            x,y=24,8
        [/recall]
        [recall]
            id=Chantal
        [/recall]
        {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 16 5  shadows_holywater1}
        {OBJ_POTION_HOLY 32 5  shadows_holywater2}
        {OBJ_POTION_HOLY 20 10 shadows_holywater3}
    [/event]

    [event]
        name=start

        [message]
            id=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]
            id=Barth-Malal
            message= _ "Living... Soon, you’ll be more troops for my master!"
        [/message]
        [message]
            id=Kalenz
            message= _ "Undead! Where did they come from?"
        [/message]
        [message]
            id=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 more help!"
        [/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 help!"
        [/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]
            id=Delfador
            message= _ "Foul creatures, it is time for your final rest!"
        [/message]
        [message]
            id=Chantal
            message= _ "That is Delfador. Do you see, now?"
        [/message]
        [message]
            id=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]
            id=Chantal
            message= _ "If I were human, I think I would be in love with him."
        [/message]
        [message]
            id=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]
            id=Chantal
            message= _ "I hope the Book does not destroy him."
        [/message]
        [message]
            id=Kalenz
            message= _ "You speak my thought, 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]

        # do not allow an elvish victory before Delfador shows up

        {NAMED_UNIT 2 (Draug)   42 3 Krumful _"Krumful" (facing=sw)}
        {NAMED_UNIT 2 (Spectre) 42 2 Unhul _"Unhul" (facing=sw)}
    [/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]
                    id=Delfador
                    message= _ "I arrive too late for the entertainment, it would seem."
                [/message]
            [/then]
        [/if]

        [message]
            id=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]
            id=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]
            id=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]
            id=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]
