#textdomain wesnoth-dm
[scenario]
    id=19_showdown_in_the_northern_swamp
    name= _ "Showdown in the Northern Swamp"
    next_scenario=20_prince_of_wesnoth
    {MEMOIRS_MAP showdown.map}
    {TURNS 24 28 32}

    {DEFAULT_SCHEDULE}

    {INTRO_AND_SCENARIO_MUSIC northerners.ogg the_deep_path.ogg}
    {EXTRA_SCENARIO_MUSIC revelation.ogg}
    {EXTRA_SCENARIO_MUSIC heroes_rite.ogg}
    {EXTRA_SCENARIO_MUSIC underground.ogg}

    [story]
        [part]
            story= _ "With the portal closed, Iliah-Malal was weakened. He retreated into the Swamp of Dread to recover his strength and attempt another conjuration. Delfador's troop, hurrying west by secret Dwarvish ways and stealthily crossing the Listra by night, found the necromancer there, on the brink of raising another army amidst the fetid reek."
            delay=4000
        [/part]
        [part]
            story= _ "Using dwarvish and elvish messengers, Delfador was able to communicate the news to the King and ask for help. Mustering all the troops he could find, Lionel marched north to join Delfador for the battle that would decide the fate of Wesnoth."
            delay=4000
        [/part]
        [part]
            show_title=yes
            {TO_SHOWDOWN_IN_THE_NORTHERN_SWAMP}
        [/part]
    [/story]

    ##### Delfador's side #####
    #wmllint: validate-off
    [side]
        {YOUNG_DELFADOR}
        type=Journeyman Mage
        canrecruit=yes
        # wmllint: recognize Delfador
        recruit={LOYALISTS},White Mage,Red Mage
        shroud=yes
        team_name=goodies
    [/side]
    #wmllint: validate-on

    [event]
        name=start
        {KALENZ_REJOINS_DELFADOR 26 22}
        {UNDEAD_REJOIN_DELFADOR}
    [/event]
    ##### /Delfador's side #####

    [side]
        side=2
        type=General
        id=Lionel
        name=_ "Lionel"
        canrecruit=yes
        recruit=Spearman,Horseman,Bowman,Cavalryman,Heavy Infantryman
        shroud=yes
        team_name=goodies
    [/side]

    # The strategic challenge should be getting these to cooperate well
    [side]
        type=Lich
        id=Iliah-Malal
        name= _"Iliah-Malal"
        side=3
        canrecruit=yes
        controller=ai
        team_name=undead
#ifdef EASY
        recruit=Skeleton, Skeleton Archer, Vampire Bat, Ghost
#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 200 250 300}
        {INCOME 0 2 2}
        [ai]
            recruitment_pattern=scout,fighter,archer
            [target]
                id=Delfador
                value=10
            [/target]
        [/ai]
    [/side]

    [side]
        type=Necromancer
        id=Maldun
        name=_ "Maldun"
        side=4
        canrecruit=yes
        controller=ai
        recruit=Vampire Bat,Dark Adept,Walking Corpse,Ghost,Soulless
        #  [ai]
        #      recruitment_pattern=scout,fighter,archer
        #  [/ai]
        team_name=undead
        {GOLD 120 200 250}
    [/side]

    [side]
        type=Death Knight
        id=Alderoth
        name=_ "Alderoth"
        side=5
        team_name=undead
        controller=ai

        {GOLD 100 140 220}
        {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
    [/side]

    [event]
        name=prestart

        [objectives]
            side=1
            [objective]
                description= _ "Defeat all enemies"
                condition=win
            [/objective]
            [objective]
                description= _ "Death of Delfador"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Lionel"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Kalenz"
                condition=lose
            [/objective]
            [objective]
                description= _ "Turns run out"
                condition=lose
            [/objective]
            note={EARLY_FINISH_BONUS_NOTE}
        [/objectives]

        {OBJ_POTION_HOLY 26 19 showdown_holywater1}
        {OBJ_POTION_HOLY 30 20 showdown_holywater2}
        {OBJ_POTION_HOLY 29 20 showdown_holywater3}

        [remove_shroud]
            side=1
        [/remove_shroud]
    [/event]

    [event]
        name=start

        [message]
            speaker=Iliah-Malal
            message= _ "So we meet again, Delfador. You were a fool to turn down my offer. None of your allies will save you now."
        [/message]
        [message]
            speaker=Delfador
            message= _ "You have ravaged your own soul with your corrupt arts, and your words are empty wind; I fear them not."
        [/message]
        [message]
            speaker=Iliah-Malal
            message= _ "Is he not amusing, my creatures? He puffs himself up as though he were Delfador the Mighty, Delfador the Powerful, Delfador the Great...rather than a jumped-up hedge wizard I shall shortly crush beneath my heel."
        [/message]
        [message]
            speaker=Delfador
            message= _ "Delfador the Great, eh? And so it comes to pass as the four Oracles foretold. I accept your name-gift, Iliah-Malal."
        [/message]
        [message]
            speaker=Iliah-Malal
            message= _ "Oracles? What nonsense you babble...after you die, I will raise your corpse and compel you to tell me how to reopen my portal!"
        [/message]
        [message]
            speaker=Delfador
            message= _ "One of us will find a final death here. I do not think it will be me."
        [/message]
        [if]
            {HAVE_UNDEAD_VETERANS}
            [then]
                [set_variable]
                    name=undead_veterans
                    name=true
                [/set_variable]
                [message]
                    speaker=narrator
                    message= _ "In this scenario only, you may recall your veterans from the Land of the Dead. The killing blow against Iliah-Malal can only be struck by one of them."
                    image=wesnoth-icon.png
                [/message]
                # An undead can kill him
                [event]
                    name=last breath
                    [filter]
                        id=Iliah-Malal
                    [/filter]
                    [filter_second]
                        race=undead
                    [/filter_second]

                    [message]
                        speaker=Delfador
                        message= _ "Now your days are ended!"
                    [/message]
                    [message]
                        speaker="Iliah-Malal"
                        message=_ "The power of death is mine! When you strike me down I arise stronger than before!"
                    [/message]
                    [message]
                        speaker=Delfador
                        message= _ "Not this time. For I have gazed upon the dark heart of necromancy in the Book of Crelanu, and found there your final doom at the hands of the dead themselves."
                    [/message]
                    {DELFADOR_LIGHTNING}

                    # We're counting on the lich-scream as Ihiah-Malal
                    # dies to end the scene.
                [/event]

                # But nobody else can.
                [event]
                    name=last breath
                    first_time_only=no
                    [filter]
                        id=Iliah-Malal
                    [/filter]
                    [filter_second]
                        [not]
                            race=undead
                        [/not]
                    [/filter_second]

                    [message]
                        speaker="Iliah-Malal"
                        message=_ "The power of death is mine! When you strike me down I arise stronger than before!"
                    [/message]

                    # He gets the standard +3 hitpoints and full heal.
                    {ADVANCE_UNIT (id="Iliah-Malal") ()}
                [/event]
            [/then]
            [else]
                [set_variable]
                    name=undead_veterans
                    name=false
                [/set_variable]
                # Delfador can kill him
                [event]
                    name=last breath
                    [filter]
                        id=Iliah-Malal
                    [/filter]
                    [filter_second]
                        id=Delfador
                    [/filter_second]

                    [message]
                        speaker=Delfador
                        message= _ "Now your days are ended!"
                    [/message]
                    [message]
                        speaker="Iliah-Malal"
                        message=_ "The power of death is mine! When you strike me down I arise stronger than before!"
                    [/message]
                    [message]
                        speaker=Delfador
                        message= _ "Not this time. For I have gazed upon the dark heart of necromancy in the Book of Crelanu, AND I REMAIN OF THE LIGHT!"
                    [/message]
                    {DELFADOR_LIGHTNING}

                    # We're counting on the lich-scream as Ihiah-Malal
                    # dies to end the scene.
                [/event]

                # But nobody else can.
                [event]
                    name=last breath
                    first_time_only=no
                    [filter]
                        id=Iliah-Malal
                    [/filter]
                    [filter_second]
                        [not]
                            id=Delfador
                        [/not]
                    [/filter_second]

                    [message]
                        speaker="Iliah-Malal"
                        message=_ "The power of death is mine! When you strike me down I arise stronger than before!"
                    [/message]

                    # He gets the standard +3 hitpoints and full heal.
                    {ADVANCE_UNIT (id="Iliah-Malal") ()}
                [/event]
            [/else]
        [/if]
    [/event]

    [event]
        name=recall
        first_time_only=yes
        [filter]
            race=undead
        [/filter]

        [message]
            speaker=Lionel
            message= _ "Delfador...you raise undead?!?"
        [/message]
        [message]
            speaker=Delfador
            message= _ "No. I did not raise them from our dead; I offered some who fought beside me in the otherworld a way here, and they come to us of their own will. Today they fight for the living."
        [/message]
    [/event]

    [event]
        name=turn 2
        [message]
            speaker=Delfador
            message= _ "I have prepared some holy water. Sprinkle it on your impact weapon and smash those foul creatures into dust!"
        [/message]

        [message]
            speaker=Iliah-Malal
            message= _ "Powers of darkness, enshroud this field!"
        [/message]

        [place_shroud]
            side=1
        [/place_shroud]
        [place_shroud]
            side=2
        [/place_shroud]
    [/event]
    [event]
        name=turn 3
        [message]
            speaker=Delfador
            message= _ "Darkness shall be dispelled!"
        [/message]

        [remove_shroud]
            side=1
        [/remove_shroud]
        [message]
            speaker=Iliah-Malal
            message= _ "No!"
        [/message]
        [message]
            speaker=Delfador
            message= _ "Let the light shine forth!"
        [/message]
        [message]
            speaker=Iliah-Malal
            message= _ "Your sorcery matters little. Your army will fall like wheat to the sickle before my undead legions."
        [/message]
        [message]
            speaker=Delfador
            message= _ "Your mindless minions will be no match for the spirit and fire of the living."
        [/message]

        [message]
            speaker=Lionel
            message= _ "Delfador, as the King ordered I place all troops under your command. They will follow you to death, if necessary, and so will I!"
        [/message]

        [message]
            speaker=Delfador
            message= _ "Lionel, it is an honor to go into battle beside you. Now let us fight for life over death!"
        [/message]

        [if]
            [variable]
                name=undead_veterans
                equals=true
            [/variable]
            #wmllint: local spelling un-life
            [then]
                [message]
                    speaker=Delfador
                    message= _ "Remember one of our undead must strike the final blow, for Iliah-Malal's un-life can only be ended by the touch of un-life."
                [/message]
            [/then]
            [else]
                [message]
                    speaker=Delfador
                    message= _ "Remember that I must strike the final blow, for Iliah-Malal's un-life must be ended by a spell I have specially crafted to the task."
                [/message]
            [/else]
        [/if]
        {SUBSUME_SIDE_AND_VILLAGES 2}
    [/event]

    # wmllint: recognize Kalenz
    [event]
        name=victory

        [message]
            speaker=Delfador
            message= _ "Evil has been vanquished on this day. May this victory bring lasting peace."
        [/message]
        [if]
            [have_unit]
                id=Kalenz
            [/have_unit]
            [then]
                [message]
                    speaker=Kalenz
                    message= _ "You have earned the name the accursed one gave you...Delfador the Great."
                [/message]
            [/then]
            [else]
                [role]
                    side=1
                    role=Admirer5
                [/role]
                [message]
                    speaker=Admirer5
                    message= _ "You have earned the name the accursed one gave you...Delfador the Great."
                [/message]
            [/else]
        [/if]
        [if]
            [have_unit]
                side=1
                race=undead
            [/have_unit]
            [then]
                [message]
                    speaker=Delfador
                    message= _ "You who fought beside me in the Land of the Dead and chose the side of the living on this day, return now to your peace and rest."
                [/message]

                [kill]
                    side=1
                    race=undead
                [/kill]
            [/then]
        [/if]
        [message]
            speaker=Lionel
            message=_"And the portal, it is sealed for good?"
        [/message]
        [message]
            speaker=Delfador
            message=_"Yes, it is. But it was too great a work of magic to be entirely undone; there is a flaw still remaining, a trace of Iliah-Malal's way between worlds. Raising undead will be a little easier in the future than it has been before. Those who come after us will have to be vigilant against the corruption of the dark arts, and show themselves worthy of the land they live in."
        [/message]

        {CLEAR_VARIABLE undead_veterans}

        # This is set-up for the next scenario, where Kalenz leads side 1 again
        {DELFADOR_DEPARTS_AGAIN}
    [/event]
    {MEMOIRS_DEATHS}
[/scenario]
