#textdomain wesnoth-dm
# wmlindent: opener "{MEMOIRS_DEAD_HOUSE "
# wmlindent: closer "{MEMOIRS_DEAD_HOUSE_END"
# wmlindent: start ignoring
#define MEMOIRS_DEAD_HOUSE X Y TYPE ID NAME_STRING
    [event]
        name=moveto
        [filter]
            id=Delfador
            x={X}
            y={Y}
        [/filter]
        [if]
            [variable]
                name=met_Rorthin
                equals=1
            [/variable]
            [then]
                [unit]
                    type={TYPE}
                    id={ID}
                    name={NAME_STRING}
                    side=3
                    x={X}
                    y={Y}
                [/unit]
#enddef
#define MEMOIRS_DEAD_HOUSE_END
            [/then]
        [/if]
    [/event]
#enddef
# wmlindent: stop ignoring

#define MEMOIRS_SURPRISE_1 X Y TYPE ID STRING
    [event]
        name=moveto
        [filter]
            id=Delfador
            x={X}
            y={Y}
        [/filter]
        [unit]
            type={TYPE}
            id={ID}
            name={STRING}
            side=2
            x={X}
            y={Y}
        [/unit]
        [unit]
            type={TYPE}
            side=2
            x={X}
            y={Y}
        [/unit]
        [message]
            speaker={STRING}
            message=_"Do you serve Iliah-Malal, living man?"
            [option]
                message=_"Yes, I serve him."
                [command]
                    [message]
                        speaker={STRING}
                        message=_"Then you will not mind if we kill you! Hahahahah!"
                    [/message]
                [/command]
            [/option]
            [option]
                message=_"No, I do not."
                [command]
                    [message]
                        speaker={STRING}
                        message=_"Then you will die forever!"
                    [/message]
                [/command]
            [/option]
        [/message]
    [/event]
#enddef

#define MEMOIRS_SURPRISE_2 X Y TYPE ID STRING
    [event]
        name=moveto
        [filter]
            id=Delfador
            x={X}
            y={Y}
        [/filter]
        [unit]
            type={TYPE}
            id={ID}
            name={STRING}
            side=2
            x={X}
            y={Y}
        [/unit]
        [unit]
            type={TYPE}
            side=2
            x={X}
            y={Y}
        [/unit]
        [message]
            speaker={STRING}
            message=_"Iliah-Malal commands your death!"
        [/message]
    [/event]
#enddef

#define MEMOIRS_SURPRISE_3 X Y TYPE
    [event]
        name=moveto
        [filter]
            id=Delfador
            x={X}
            y={Y}
        [/filter]
        [unit]
            type={TYPE}
            side=2
            x={X}
            y={Y}
        [/unit]
        [unit]
            type={TYPE}
            side=2
            x={X}
            y={Y}
        [/unit]
        [message]
            speaker=Arakar
            message=_"Destroy the intruder, my minions!"
        [/message]
    [/event]
#enddef

#define MEMOIRS_WARNING X Y RADIUS
    [event]
        name=moveto
        first_time_only=yes
        [filter]
            id=Delfador
            x={X}
            y={Y}
            radius={RADIUS}
        [/filter]
        [message]
            speaker=Delfador
            message=_"Something does not feel right about those villages..."
        [/message]
    [/event]
#enddef

#define MEMOIRS_LAND_OF_THE_DEAD_VICTORY X Y
    [item]
        x={X}
        y={Y}
        image=scenery/signpost.png
    [/item]
    [event]
        name=moveto
        first_time_only=no
        [filter]
            id=Delfador
            x={X}
            y={Y}
        [/filter]
        [if]
            [variable]
                name=delf_has_staff
                equals=true
            [/variable]
            [then]
                {CLEAR_VARIABLE delf_has_staff}
                [endlevel]
                    result=victory
                    bonus=no
                [/endlevel]
            [/then]
            [else]
                [message]
                    id=Delfador
                    message=_ "I must find that artifact of which the ghost spoke; it sounds too powerful a thing to be left in Iliah-Malal’s hands."
                [/message]
            [/else]
        [/if]
    [/event]
#enddef

[scenario]
    name=_ "Houses of the Dead"
    id=09_Houses_of_the_Dead
    next_scenario=10_The_Gate_Between_Worlds
    {MEMOIRS_MAP 09_Houses_of_the_Dead.map}
    turns=64

    disallow_recall=yes
    victory_when_enemies_defeated=no
    {LAND_OF_THE_DEAD}

    # Could use "The Deep Path", but monotony is what we want here
    {SCENARIO_MUSIC underground.ogg}

    [side]
        {YOUNG_DELFADOR}
        profile="portraits/young_delfador.png"
        type=Journeyman Mage
        canrecruit=yes
        team_name=player
        user_team_name= _ "Player"
        shroud=yes
        # Go back to stock flag, since we no longer recruit loyalist units
    [/side]

    [side]
        type=Death Knight
        id=Arakar
        side=2
        canrecruit=yes
        controller=ai
        team_name=foe
        recruit=Skeleton
        {GOLD 0 0 15}
        {INCOME 0 2 2}
        [ai]
            recruitment_pattern=fighter
            aggression=1.0
            [target] # they're not interested in killing ghosts
                id=Delfador
                value=50
            [/target]
            [target]
                side=3
                value=0
            [/target]
        [/ai]
        {FLAG_VARIANT undead}
    [/side]

    [side]
        side=3
        no_leader=yes
        controller=ai
        team_name=player
        user_team_name= _ "Player"
        [ai]
            # don't pick fights with the skeletons
            leader_value=0.0
            aggression=-0.5
            # try to get to Delfador and protect him
            # TODO target is aimed at enemy units. I don’t know what happens when used with an ally.
            [target]
                id=Delfador
                value=8.0
            [/target]
            [protect_unit]
                id=Delfador
                radius=6
                value=40.0
            [/protect_unit]
        [/ai]
        [unit]
            id=Rorthin
            name= _ "Rorthin"
            type=Ghost
            side=3
            #x,y=34,18
            x,y=26,21
        [/unit]
    [/side]

    [story]
        [part]
            story=_ "It was one of those moments that altered the destiny of the world. The orc warrior held many possibilities in his hand. He could simply have taken Delfador’s head. Had that occurred, the orcs might have overrun the whole of Wesnoth and ruled it for ages. But what he chose, thinking it rare sport to abuse one of the hated human mages, was to strike Delfador with his gauntleted fist."
        [/part]
        [part]
            story=_ "The blow interrupted Delfador’s meditation. He began to topple over to the ground, but before his head reached it he vanished as though he had never been there at all."
        [/part]
    [/story]

    {MEMOIRS_DEATHS}

    [event]
        name=prestart
        [objectives]
            side=1
            [objective]
                description=_ "Move Delfador to the signpost"
                condition=win
            [/objective]
            [objective]
                description=_ "Death of Delfador"
                condition=lose
            [/objective]

            {TURNS_RUN_OUT}

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

        [set_variable]
            name=delf_has_staff
            value=false
        [/set_variable]
    [/event]

    [event]
        name=start
        [message]
            speaker=narrator
            message=_"Delfador opens his eyes and realizes he is <i>alone</i> in the <i>dark</i>."
            image=wesnoth-icon.png
        [/message]
    [/event]

    {STARTING_VILLAGES 2 10}

    {MEMOIRS_LAND_OF_THE_DEAD_VICTORY 15 1}
    {MEMOIRS_SECRET_PASSAGE  32 5  2 8}
    {MEMOIRS_ITEM_STAFF 3 7}

    {MEMOIRS_SURPRISE_1 8 4 Skeleton Rattles (_"Rattles")}
    {MEMOIRS_SURPRISE_2 10 3 Skeleton Bones (_"Bones")}
    {MEMOIRS_SURPRISE_3 6 3 Skeleton}
    {MEMOIRS_WARNING 9 4 6}

    {MEMOIRS_DEAD_HOUSE 36 18 Ghoul Penella ( _ "Penella")}
        # wmllint: recognize Penella
        [message]
            speaker=Penella
            message=_"Do not fear me, Delfador. It is my doom to appear as you see me. I was a serf of a cruel lord. He demanded great taxes to fight many wars... then plague came... my family were starving, and we were forced to eat the flesh of those who had died."
        [/message]
        [allow_recruit]
            type=Ghoul
            side=1
        [/allow_recruit]
    {MEMOIRS_DEAD_HOUSE_END}
    {MEMOIRS_DEAD_HOUSE 16 13 Ghost Roddry ( _ "Roddry")}
        [message]
            # wmllint: recognize Roddry
            speaker=Roddry
            message=_"Have you encountered the skeletons? Their castle lies north of here. It is difficult to attack, but there is a secret entrance in the valley beyond Sythan’s village."
        [/message]
    {MEMOIRS_DEAD_HOUSE_END}
    {MEMOIRS_DEAD_HOUSE 22 12 Shadow Nameless ( _ "Nameless")}
        # wmllint: recognize Nameless
        [message]
            speaker=Nameless
            message=_"I died a long time ago. I have forgotten my name."
        [/message]
    {MEMOIRS_DEAD_HOUSE_END}
    {MEMOIRS_DEAD_HOUSE 23 3 Ghost Melinna ( _ "Melinna")}
        # wmllint: recognize Melinna
        [message]
            speaker=Melinna
            message=_"Iliah-Malal says that he can open a portal to the world of the living. Those who follow him will walk the earth as they did in life."
        [/message]
        [message]
            speaker=Delfador
            message=_"Why are the dead so restless? This should be a place of rest and peace for you."
        [/message]
        [message]
            speaker=Melinna
            message=_"Once, I was happy here, but Iliah-Malal made me see this land as the eyes of the living see it... a place of rock and dust."
        [/message]
    {MEMOIRS_DEAD_HOUSE_END}
    {MEMOIRS_DEAD_HOUSE 34 11 Ghost Sythan ( _ "Sythan")}
        # wmllint: recognize Sythan
        [message]
            speaker=Sythan
            message=_"I was once a great lord... I commanded armies! Iliah-Malal promised I would lead again."
        [/message]
    {MEMOIRS_DEAD_HOUSE_END}
    {MEMOIRS_DEAD_HOUSE 22 16 Ghost Hereld ( _ "Hereld")}
        # wmllint: recognize Hereld
        [message]
            speaker=Hereld
            message=_"Beware the skeletons! They are not the spirits of dead men, but the creations of evil magic."
        [/message]
        [message]
            speaker=Delfador
            message=_"What else do you know of the skeletons?"
        [/message]
        [message]
            speaker=Hereld
            message=_"It is said that they guard a powerful magical artifact. Roddry knows more than I do; he lives to the west."
        [/message]
    {MEMOIRS_DEAD_HOUSE_END}

    [event]
        name=victory
        {MODIFY_UNIT id=Rorthin side 1}
        {MODIFY_UNIT id=Penella side 1}
        {MODIFY_UNIT id=Roddry side 1}
        {MODIFY_UNIT id=Nameless side 1}
        {MODIFY_UNIT id=Sythan side 1}
        {MODIFY_UNIT id=Hereld side 1}
        {MODIFY_UNIT id=Melinna side 1}
    [/event]

    [event]
        name=die
        [filter]
            id=Rorthin
        [/filter]
        [set_variable]
            name=Rorthin
            value=1
        [/set_variable]
    [/event]

    [event]
        name=start
        [set_recruit]
            recruit=""
            side=1
        [/set_recruit]
        [message]
            speaker=Delfador
            message=_"This is surely the land of the dead... and it seems I am still alive. But then, as Leollyn warned, I can never return! I suppose I may as well explore."
        [/message]
    [/event]

    [event]
        name=moveto
        first_time_only=no

        [if]
            [have_unit]
                id=Rorthin
                [filter_vision]
                    visible=yes
                    viewing_side=1
                [/filter_vision]
            [/have_unit]
            [then]
                [fire_event]
                    name=rorthin
                [/fire_event]
            [/then]
        [/if]
    [/event]

    [event]
        name=rorthin
        first_time_only=yes

        [message]
            speaker=Rorthin
            message=_"A living man... so it is as Iliah-Malal says..."
        [/message]
        [message]
            speaker=Delfador
            message=_"Speak again, spirit! Tell me of yourself. Who is this Iliah-Malal?"
        [/message]
        [message]
            speaker=Rorthin
            message=_"My name is Rorthin. I died long ago, in a great battle... I have almost forgotten... Iliah-Malal is a living man, like you, who walks among the dead. He promises life to all those who follow him."
        [/message]
        [message]
            speaker=Delfador
            message=_"I would very much like to meet Iliah-Malal. Where can I find him?"
        [/message]
        [message]
            speaker=Rorthin
            message=_"Follow the dry river, then the road to the signpost in the north. I will guide you. Enter the houses of the dead as you pass, for others here may help you."
        [/message]
        [set_variable]
            name=met_Rorthin
            value=1
        [/set_variable]
        #TODO is there some speak about ghosts in the recruitment?
        [allow_recruit]
            type=Ghost
            side=1
        [/allow_recruit]
    [/event]

    [event]
        name=moveto
        [filter]
            id=Delfador
            x=2,3,4,2,3,4,2,3
            y=6,6,6,7,7,7,8,8
        [/filter]

        # wmllint: local spelling An-Usrukhar eyeblink
        [message]
            #po: The Tomb Guardian's dialogue should sound especially archaic
            #po: and imperious. If your language has special forms for superior
            #po: addressing inferior, use them here.
            speaker=narrator
            message=_"WHO ENTERS THE TOMB OF AN-USRUKHAR?"
            image="portraits/tomb-guardian.png"
        [/message]
        [message]
            speaker=Delfador
            message=_"I... I am Delfador, a mage of Wesnoth."
        [/message]
        [message]
            speaker=narrator
            #po: "bestrode" = past tense of archaic verb "bestride", literally
            #po: meaning to straddle but with a secondary sense of "to
            #po: dominate", and connotations of gigantism.
            message=_"I am the will of An-Usrukhar, greatest of mages, he who bestrode Irdya in the morning of time, who sleeps now in a death beyond death until the unmaking of the world."
            image="portraits/tomb-guardian.png"
        [/message]
        [message]
            speaker=Delfador
            message=_"I am only a man, a living man seeking a way home from the house of the dead."
        [/message]
        [message]
            speaker=narrator
            message=_"Living...? I see that it is so. Your breath stirs dust that has lain untouched since the Primal Aeon. And it was foretold that one like you would come."
            image="portraits/tomb-guardian.png"
        [/message]
        [message]
            speaker=Delfador
            message=_"Foretold?"
        [/message]
        [message]
            speaker=narrator
            #po: "Aeon" is a variant form of the word English word "eon", used
            #po: for a long and indefinite span of time. The variant has
            #po: mystical connotations.
            message=_"Foretold in the Primal Aeon, years past beyond your counting. An-Usrukhar the Great, he of whom I am but the tiniest shade and fragment, foresaw in the Mirror of Evanescent Time that a living man would come here to be tested. AND I AM THE TEST!"
            image="portraits/tomb-guardian.png"
        [/message]
        [message]
            speaker=Delfador
            #po: "coil" is an archaism. In the English of around 1600, it was
            #po: used to refer to a difficulty or entanglement. Translate
            #po: freely.
            message=_"I have felt the coils of prophecy on me before. I am beginning to dislike them."
        [/message]
        [message]
            speaker=narrator
            message=_"It is only given to the small not to feel the hand of fate on their shoulder; the great must suffer its weight whether they will or no. Delfador, mage of Wesnoth, ARE YOU A SERVANT OF THE LIGHT?"
            image="portraits/tomb-guardian.png"
        [/message]
        [message]
            speaker=Delfador
            message=_"I serve my king and my kingdom."
        [/message]
        [message]
            speaker=narrator
            #po: The Tomb Guardian speaks closer to literal truth here than
            #po: Delfador can possibly know. It is now 470YW; in 501YW,
            #po: Garard II will be murdered by his wife and son, and the
            #po: usurpation of Asheviere will begin.
            message=_"Your king will die in an eyeblink and your kingdom in the drawing of a breath. Delfador, I ask you again, ARE YOU A SERVANT OF THE LIGHT?"
            image="portraits/tomb-guardian.png"
        [/message]
        [message]
            speaker=Delfador
            message=_"I serve my people and my land."
        [/message]
        [message]
            speaker=narrator
            #po: "matter" is used here with an archaic meaning, roughly
            #po: that of "ground" or "essence".  This sense survives in
            #po: modern English in constructions like "It matters a lot."
            message=_"Peoples vanish and lands wither under the pitiless gaze of eternity; the true matter of the world is deeper. Delfador, I ask you a third time, and on your answer hangs your life: ARE YOU A SERVANT OF THE LIGHT?"
            image="portraits/tomb-guardian.png"
        [/message]
        [message]
            speaker=Delfador
            message=_"I... I serve life against death. Love against fear. Light against darkness."
        [/message]
        [delay]
            time=1250
        [/delay]
        {FLASH_WHITE ()}
        [message]
            speaker=narrator
            message=_"IT IS WELL. Take up, O servant of light, the Staff of An-Usrukhar. The trials before you will be great. So is its power."
            image="portraits/tomb-guardian.png"
        [/message]
    [/event]
[/scenario]
