#textdomain wesnoth-dm
[scenario]
    name=_ "A New Ally"
    id=17_a_new_ally
    next_scenario=18_the_portal_of_doom
    {MEMOIRS_MAP new_ally.map}
    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 in order to attempt to close the portal. But with Iliah-Malal's army at large north of the Great River, this was a perilous road. Delfador was constrained to avoid well-trodden paths. This meant a detour ..."
            show_title=yes
            {TO_A_NEW_ALLY}
        [/part]
    [/story]
    # wmllint: recognize Delfador
    [side]
        {YOUNG_DELFADOR}
        type=Journeyman Mage
        canrecruit=yes
        team_name=player
        recruit={LOYALISTS}
    [/side]
    [event]
        name=prestart
        {RESTORE_WESNOTHIAN_VETERANS}
    [/event]

    [side]
        side=2
        {ULREK}
        type=Dwarvish Lord

        controller=ai
        canrecruit=yes
        recruit={DWARVES}

        [ai]
            aggression=0.0
        [/ai]
        {GOLD 150 100 130}
        income=8
        team_name=player
        # wmllint: recognize Relgorn
        {NAMED_UNIT 2 (Dwarvish Fighter) 5 10  "Relgorn" (_"Relgorn") (ai_special=guardian)}
        {MAKE_HERO Relgorn}
        {NAMED_UNIT 2 (Dwarvish Fighter) 9 7 "Udrin" (_"Udrin") (ai_special=guardian)}
    [/side]
    [side]
        type=Necromancer
        id=Gruv-Malal
        name=_ "Gruv-Malal"
        side=3
        canrecruit=yes
        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
        [ai]
            aggression=0.0

            #TODO remove or uncomment or tune

            #recruitment_pattern=scout, mixed fighter, archer
            # there are a lot of close villages
            #villages_per_scout=6

            # attack Delfador more heavily than Leollyn
            #leader_value=2.0
            #[target]
            #    id=Delfador
            #    value=3.0
            #[/target]
        [/ai]
        {GOLD 200 200 300}
        team_name=foe
    [/side]

    [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]
            [objective]
                description=_"Time runs out"
                condition=lose
            [/objective]
            note={EARLY_FINISH_BONUS_NOTE}
        [/objectives]
    [/event]

    #############################
    # opening dialog
    #############################
    [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, attacked 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]

    #############################
    # closing dialog
    #############################
    [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 #
    ###############################################
    #wmllint: recognize Ulrek
    [event]
        name=die
        [filter]
            id=Ulrek
            side=3
            type=Dwarvish Lord
        [/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}
[/scenario]
