#textdomain wesnoth-dm
[scenario]
    id=17_A_New_Ally
    name=_ "A New Ally"
    {MEMOIRS_MAP 17_A_New_Ally.map}
    next_scenario=18_The_Portal_of_Doom
    turns=32
    {DEFAULT_SCHEDULE}

    # This scenario makes a reference to HttT: Relgorn is a young
    # dwarf now, but the dwarf leader in HttT's Plunging into the darkness
    # scenario - where he says he met Delf when he was young. In
    # addition history is that both elves and dwarves bought Wesnoth time
    # We could have had a Weldyn siege, but Turin already has done this
    # once in EI...

    {INTRO_AND_SCENARIO_MUSIC wanderer.ogg knalgan_theme.ogg}
    {EXTRA_SCENARIO_MUSIC legends_of_the_north.ogg}
    {EXTRA_SCENARIO_MUSIC the_dangerous_symphony.ogg}

    [story]
        [part]
            story= _ "Delfador took a small escort to the north on a mission to close the portal. But with Iliah-Malal’s army at large north of the Great River, this was a perilous road. It was imperative that Delfador avoid well-trodden paths. This meant a detour..."
            show_title=yes
        [/part]
    [/story]
    {DM_TRACK {TRIUMPH_STAGE1}}

    #wmllint: validate-off
    [side]
        side=1
        controller=human
        recruit={LOYALISTS}
        save_id=Player
        team_name=allies
        user_team_name= _ "Loyalists"
        side_name= _ "Delfador"
        {FLAG_VARIANT loyalist}
        [leader]
            {YOUNG_DELFADOR}
        [/leader]
        {GOLD 160 140 120}
    [/side]
    [event]
        name=prestart
        {RESTORE_WESNOTHIAN_VETERANS}
        {MODIFY_UNIT (side=1) facing nw}
    [/event]

    [side]
        side=2
        controller=ai
        recruit={DWARVES}
        {GOLD 160 140 120}
        {INCOME 8 6 4}
        team_name=allies
        user_team_name= _ "Dwarves"
        {FLAG_VARIANT knalgan}
        # wmllint: who ULREK is Ulrek
        {ULREK}
        canrecruit=yes
        facing=se
        # wmllint: who RELGORN is Relgorn
        [unit]
            {RELGORN}
            ai_special=guardian
            x,y=5,10
            facing=se
        [/unit]
        {NAMED_UNIT 2 (Dwarvish Fighter) 9 7 "Udrin" (_"Udrin") (ai_special=guardian)} {FACING se}
        [ai]
            aggression=0.0
        [/ai]
    [/side]

    [side]
        side=3
        controller=ai
#ifdef EASY
        recruit=Skeleton, Skeleton Archer, Vampire Bat
#endif
#ifdef NORMAL
        recruit=Skeleton, Revenant, Skeleton Archer, Bone Shooter
#endif
#ifdef HARD
        recruit=Skeleton, Skeleton Archer, Revenant, Draug, Banebow, Bone Shooter, Deathblade
#endif
        {GOLD 250 325 400}
        team_name=enemies
        user_team_name= _ "Undead"
        {FLAG_VARIANT undead}
        [leader]
            id=Gruv-Malal
            name=_ "Gruv-Malal"
            type=Necromancer
            facing=sw
        [/leader]
    [/side]
    #wmllint: validate-on

    [event]
        name=prestart
        [objectives]
            side=1
            [objective]
                description=_ "Defeat Gruv-Malal"
                condition=win
            [/objective]
            [objective]
                description=_ "Death of Delfador"
                condition=lose
            [/objective]
            [objective]
                description=_ "Death of Ulrek"
                condition=lose
            [/objective]
            [objective]
                description=_ "Death of Relgorn"
                condition=lose
            [/objective]

            {TURNS_RUN_OUT}

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

    [event]
        name=start
        [message]
            speaker=Gruv-Malal
            message=_"Attack, my loyal soldiers; the more we slay, the more troops for our master!"
        [/message]
        [message]
            speaker=Ulrek
            message=_"Keep fighting them sacks o’ bones."
        [/message]
        [message]
            speaker=Relgorn
            message=_"Ulrek, more enemies approach from the south... Wait, these are humans!"
        [/message]
        [message]
            speaker=Delfador
            message=_"Dwarves, under attack by undead. We must help them."
        [/message]
        [message]
            speaker=Gruv-Malal
            message=_"Then your corpses will also serve my master."
        [/message]
        [message]
            speaker=Delfador
            message=_"Your master’s days are numbered. Yours will end this day!"
        [/message]
    [/event]

    [event]
        name=last breath
        [filter_second]
            id=Delfador
        [/filter_second]

        [scroll_to_unit]
            id=Delfador
        [/scroll_to_unit]
        {DELFADOR_LIGHTNING}
        [message]
            speaker=Delfador
            message=_"I am Delfador. And you are dust!"
        [/message]
    [/event]

    [event]
        name=die
        [filter]
            id=Gruv-Malal
        [/filter]
        [message]
            speaker=Delfador
            message=_"Now we shall rid Wesnoth of the rest of your unholy spawn!"
        [/message]
        [message]
            speaker=Ulrek
            message=_"We are in your debt."
        [/message]
    [/event]

    [event]
        name=victory
        [message]
            speaker=Ulrek
            message=_"Human, ye ha’ fought well. I am Ulrek, chieftain o’ the clan of Norlund. My house is in yer debt today. But who are ye and what do ye do in these lands?"
        [/message]
        [message]
            speaker=Delfador
            message=_"I am Delfador. Friends, a great evil has been unleashed. A portal has been opened to the Land of the Dead near the northernmost extent of these hills, nearly under the eaves of Lintanir Forest. I must close it, or else we are all doomed."
        [/message]
        [message]
            speaker=Ulrek
            message=_"We ha’ seen those undead walking, aye, and fought them too. And no one will ever say my kin ha’ been ungrateful for yer help. I will place my best warriors at yer service. Relgorn, my son, ye will lead the women and children to Knalga. They will be safe there among the rest of my kin. But can ye really close that thing?"
        [/message]
        [message]
            speaker=Relgorn
            message=_"Father, did ye not see these thunderbolts! This was awesome. Even our thundersticks do not strike so powerfully!"
        [/message]
        [message]
            speaker=Delfador
            message=_"My friends, I am in your debt for your kind offer. But we have no time to waste!"
        [/message]
        [message]
            speaker=Ulrek
            message=_"Delfador, the surface path to the north ye’d need to have ta’en, along the Listra, is too dangerous. That valley is swarming with orcs now. We’ll take ye by a safer route, through tunnels under these hills."
        [/message]

        {DWARVES_FOLLOW_DELFADOR}
    [/event]

    # defeat player if Ulrek or Relgorn is killed
    [event]
        name=die
        [filter]
            id=Ulrek
            side=2
        [/filter]
        [message]
            speaker=Delfador
            message=_"With their leader slain we cannot count on dwarvish help to reach Iliah-Malal’s portal! All is lost!"
        [/message]
        [endlevel]
            result=defeat
        [/endlevel]
    [/event]

    [event]
        name=die
        [filter]
            id=Relgorn
        [/filter]
        [message]
            speaker=Ulrek
            message=_"Relgorn fell! Quickly, run for yer lives!"
        [/message]
        [endlevel]
            result=defeat
        [/endlevel]
    [/event]

    {MEMOIRS_DEATHS}
    # wmllint: unwho RELGORN
[/scenario]
