#textdomain wesnoth-dm
[scenario]
    name=_"The Gate Between Worlds"
    id=10_The_Gate_Between_Worlds
    next_scenario=11_Wasteland
    {MEMOIRS_MAP 10_The_Gate_Between_Worlds.map}
    turns=24

    {LAND_OF_THE_DEAD}

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

    [side]
        {YOUNG_DELFADOR}
        side=1
        save_id=Player
        persistent=yes
        controller=human
        recruit=Ghost
        team_name=allies
        user_team_name= _ "Loyalists"
    [/side]

    {STARTING_VILLAGES 1 5}

    [side]
        {ILIAH_MALAL (Necromancer)}
        facing=se
        side=2
        controller=ai
        recruit=Vampire Bat,Dark Adept,Thug
        team_name=enemies
        user_team_name= _ "Undead"
        {GOLD 120 200 250}
        {FLAG_VARIANT undead}
    [/side]

    {STARTING_VILLAGES 2 5}

    {MEMOIRS_DEATHS}

    #############################
    # A bit of hackery to get the map border to look right, after
    # Iliah-Malal has opened the portal.  The map initially includes
    # a bit of grassland to the northwest.  We remove that here, but
    # when the portal opens, the grassland will appear to continue
    # off the edge of the map.
    #############################
    [event]
        name=prestart
        [objectives]
            side=1
            [objective]
                description=_"Defeat Iliah-Malal"
                condition=win
            [/objective]
            [objective]
                description=_"Death of Delfador"
                condition=lose
            [/objective]

            {TURNS_RUN_OUT}

            [gold_carryover]
                bonus=yes
                carryover_percentage=80
            [/gold_carryover]
        [/objectives]
        [terrain]
            terrain=Mm
            x=1
            y=1-2
        [/terrain]
    [/event]

    #############################
    # starting dialog
    #############################
    [event]
        name=start

        {MODIFY_UNIT (id=Delfador) facing nw}
        [role]
            type=Ghost,Wraith,Shadow,Ghoul,Necrophage,Ghast
            role=dead_sidekick
        [/role]
        [recall]
            role=dead_sidekick
        [/recall]
        {MODIFY_UNIT (role=dead_sidekick) facing nw}

        [message]
            speaker=Iliah-Malal
            message=_"So, this is the one my minions told me of... the living man who walks here among the dead. You have come in time to see my greatest achievement — an end to death itself!"
        [/message]

        [message]
            speaker=Delfador
            message=_"That’s impossible! You must be insane!"
        [/message]

        [message]
            speaker=Iliah-Malal
            message=_"Have not you yourself traveled between the realms of life and death? Behold!"
        [/message]

        {MODIFY_UNIT (id=Iliah-Malal) facing nw}
        # open the portal
        [animate_unit]
            [filter]
                id=Iliah-Malal
            [/filter]
            flag=attack
            hits=yes
            [primary_attack]
                name=shadow wave
            [/primary_attack]
            [facing]
                x,y=6,4
            [/facing]
        [/animate_unit]
        [sound]
            name=rumble.wav
        [/sound]
#define TERRAFORM CX CY GX GY
    {MEMOIRS_TREMOR}
    [terrain]
        terrain=_s  # wmllint: ignore
        x={CX}
        y={CY}
    [/terrain]
    [terrain]
        terrain=Gg
        x={GX}
        y={GY}
    [/terrain]
#enddef
        [terrain]
            terrain=_s  # wmllint: ignore
            x=0
            y=0
        [/terrain]
        {TERRAFORM (0,1,1) (1,1,0) (0) (0)}
        {TERRAFORM (0,1,2) (2,2,1) (0,1,1) (1,1,0)}
        {TERRAFORM (1,2,3,3) (3,2,2,1) (0,1,2) (2,2,1)}
        {TERRAFORM (2,3,4,4) (3,3,2,1) (1,2,3,3) (3,2,2,1)}
        {TERRAFORM (4) (3) (2,3,4,4) (3,3,2,1)}
#undef TERRAFORM
        {MEMOIRS_TREMOR}
        [terrain]
            terrain=Gg
            x=4
            y=3
        [/terrain]
        {MEMOIRS_TREMOR}

        [message]
            role=dead_sidekick
            scroll=no
            message=_"Iliah-Malal has created a portal to the land of the living! How I long to go through it and see the sun again..."
        [/message]

        [message]
            speaker=Iliah-Malal
            scroll=no
            message=_"Now, my living followers, I summon you! See that death is nothing, and fear not to fight for me!"
        [/message]

        [move_unit_fake]
            type=Thug
            side=2
            x=1,2,3,4,5,6,7
            y=1,1,2,2,3,3,4
        [/move_unit_fake]
        {NAMED_UNIT 2 (Thug) 7 4 Vobryn _"Vobryn" (facing=se)}
        [move_unit_fake]
            type=Dark Adept
            side=2
            x=1,2,2,3,3,4,5,6
            y=1,1,2,3,4,4,5,5
        [/move_unit_fake]
        {NAMED_UNIT 2 (Dark Adept) 6 5 Tur _"Tur" (facing=se)}
        [move_unit_fake]
            type=Thug
            side=2
            x=1,2,3,4,4,5,6
            y=1,1,2,2,3,4,4
        [/move_unit_fake]
        {NAMED_UNIT 2 (Thug) 6 4 Meorraent _"Meorraent" (facing=se)}
        {MODIFY_UNIT (id=Iliah-Malal) facing se}

        [message]
            speaker=Delfador
            message=_"This is a great evil. The dead will not find peace by passing through your gateway, Iliah-Malal, for you cannot give them life again. You have not brought an end to death, but to life itself!"
        [/message]

        [message]
            speaker=Iliah-Malal
            message=_"You will see things differently at the point of a sword, my friend. Minions! Kill the unbeliever... he will join us then."
        [/message]
    [/event]

    #############################
    # closing dialog
    #############################
    [event]
        name=last breath
        [filter]
            id=Iliah-Malal
        [/filter]

        [message]
            speaker=narrator
            message=_"Iliah-Malal’s body lay still for a moment, then stirred!"
            image=wesnoth-icon.png
        [/message]

        {ADVANCE_UNIT  id=Iliah-Malal Necromancer}
        [redraw]
        [/redraw]

        [delay]
            time=800
        [/delay]

        {MOVE_UNIT id=Iliah-Malal 1 1}
        [redraw]
        [/redraw]

        [message]
            speaker=Iliah-Malal
            message=_"Follow me if you dare..."
        [/message]

        [message]
            speaker=Delfador
            message=_"This portal Iliah-Malal has created is a great and terrible work of magic. I must catch him, and somehow force him to close it!"
        [/message]
        [endlevel]
            result=victory
        [/endlevel]
    [/event]
[/scenario]
