#textdomain wesnoth-thot
[scenario]
    name=_"High Pass"
    id="06_High_Pass"
    next_scenario="07_Mages_and_Drakes"
    victory_when_enemies_defeated=no
    map_data="{@campaigns/The_Hammer_of_Thursagan/maps/high_pass.map}"
    {DEFAULT_SCHEDULE}
    {TURNS 24 18 12}	# BALANCE

    # The map should be a twisty, narrow path through rugged snow-capped
    # mountains. The objective will be to get Aiglondur through to the
    # other side. The opponents will be gryphons, wolves, and the elements.
    # We should try to get creative with representing the effects of extreme
    # cold, perhaps something like the dehydration effect in UtBS. And the
    # time-limit should be tight.

    {SCENARIO_MUSIC "heroes_rite.ogg"}	# No story part
    {EXTRA_SCENARIO_MUSIC "wanderer.ogg"}
    {EXTRA_SCENARIO_MUSIC "knolls.ogg"}

    [story]
        [part]
            show_title=yes
            {TO_HIGH_PASS}
        [/part]
    [/story]

    [side]
        type="Dwarvish Fighter"
        id="Aiglondur"
        name=_"Aiglondur"
        canrecruit="1"
        side="1"
        controller="human"
        team_name="northern_alliance"
        user_team_name=_"Alliance"
        {FLAG_VARIANT knalgan}
        fog="no"
        shroud=yes
        recruit="Dwarvish Fighter, Dwarvish Thunderer,Dwarvish Guardsman"
        {GOLD 100 80 60}	# BALANCE
    [/side]

    [side]
        type=Gryphon
        id=Kaara
        name= _ "Kaara"
        side=2
        canrecruit=yes
        team_name=wildthings
        user_team_name=_"Monsters"
        recruit=Gryphon
        {GOLD 60 80 100}	# BALANCE
        [ai]
            {ATTACK_DEPTH 1 3 5}
            passive_leader=yes
        [/ai]
    [/side]

    {@campaigns/The_Hammer_of_Thursagan/utils/herodeaths.cfg}

    [side]
        # The wild things
        side=3
        no_leader=yes
        team_name=wildthings
        user_team_name=_"Monsters"
    [/side]

#define WILDTHING X Y
    [set_variable]
        name=typeofenemy
        random=Wolf,Ogre,Troll
    [/set_variable]
    [unit]
        x,y={X},{Y}
        generate_name=yes
        random_traits=yes
        type=$typeofenemy
        side=3
    [/unit]
    [if]
        [variable]
            name=typeofenemy
            equals=Wolf
        [/variable]
        [then]
            [unit]
                x,y={X},{Y}
                type=Wolf
                side=3
            [/unit]
#ifdef NORMAL
            [unit]
                x,y={X},{Y}
                type=Wolf
                side=3
            [/unit]
#endif
#ifdef HARD
            [unit]
                x,y={X},{Y}
                type=Wolf
                side=3
            [/unit]
#endif
        [/then]
    [/if]
    [clear_variable]
        name=typeofenemy
    [/clear_variable]
#enddef

    [event]
        name="start"
        {PLACE_IMAGE (scenery/signpost.png) 30 11}

        [recall]
            id="Angarthing"
        [/recall]

        [message]
            speaker="Angarthing"
            message=_"Behold, the High Pass. By the old maps, we are halfway to Kal Kartha here."
        [/message]
        [message]
            speaker="Aiglondur"
            message=_"We must push through quickly; there is a vicious storm coming in behind us. Being caught in a blizzard on those heights would be no laughing matter."
        [/message]

        [objectives]
            side="1"
            silent="no"
            [objective]
                description=_"Move Aiglondur to the signpost at the east end of the pass"
                condition="win"
            [/objective]
            [objective]
                description=_"Death of Aiglondur"
                condition="lose"
            [/objective]
            [objective]
                description=_"Death of Angarthing"
                condition="lose"
            [/objective]
            [objective]
                description=_"Time runs out"
                condition="lose"
            [/objective]

            note={EARLY_FINISH_BONUS_NOTE}+{NEW_GOLD_CARRYOVER_NOTE_40}
        [/objectives]

        {WILDTHING 8 7}
        {WILDTHING 8 12}
    [/event]

    [event]
        name=turn 3
        {WILDTHING 8 7}
        {WILDTHING 8 12}
    [/event]

    [event]
        name=turn 6
        {WILDTHING 12 6}
        {WILDTHING 13 11}
    [/event]

    [event]
        name=turn 9
        {WILDTHING 17 12}
        {WILDTHING 18 9}
    [/event]

    [event]
        name=turn 12
        {WILDTHING 25 9}
        {WILDTHING 27 14}
    [/event]

#define RATHELN_ENCOUNTER
#enddef

    # If user hasn't found Ratheln by a reasonable time, nudge a little.
    [event]
        name=turn 8

        [if]
            [have_unit]
                #wmllint: recognize Ratheln
                id=Ratheln
            [/have_unit]

            [else]
                [message]
                    speaker="Angarthing"
                    message=_"That hut near the top of the pass...something is glowing inside it. We should investigate."
                [/message]
            [/else]
        [/if]
    [/event]

    [event]
        name=moveto
        first_time_only=yes
        [filter]
            side=1
            # Should be triggered regardless of how the Dwarves move through.
            # It will look a little odd if they've all decided to slog through
            # the mountains to the extreme north or south, but that is quite
            # unlikely.
            x=18-21
            y=4-21
        [/filter]

        [if]
            [have_unit]
                id=Ratheln
            [/have_unit]
            [else]
                [unit]
                    type=Arch Mage
                    id=Ratheln
                    profile=portraits/ratheln.png
                    name= _ "Ratheln"
                    side=1
                    [modifications]
                        {TRAIT_LOYAL}
                        {TRAIT_STRONG}
                    [/modifications]
                    {IS_HERO}
                    unrenamable=yes
                    x=19
                    y=11
                [/unit]

                [message]
                    speaker="Ratheln"
                    message=_"Hail, I am Ratheln. If you're traveling down the pass, please take me with you. I am near freezing and starving to death up here."
                [/message]

                [message]
                    speaker="Angarthing"
                    message=_"Pardon my curiosity, but what is a fire-mage doing freezing to death?"
                [/message]

                [message]
                    speaker="Ratheln"
                    message=_"In case you haven't noticed, there is a serious shortage of both firewood and food in this gods-forsaken slot. And the damned gryphons descend on me whenever I stir out of this shack. I've had nothing to eat but flash-roasted gryphon for the last three weeks."
                [/message]

                [message]
                    speaker="Aiglondur"
                    message=_"Where were you bound when you got stuck here?"
                [/message]

                [message]
                    speaker="Ratheln"
                    message=_"There is a school of mages near the east end of the pass. They've an opening for an instructor, and they're expecting me."
                [/message]

                [message]
                    speaker="Angarthing"
                    message=_"Let's take him with us, Aiglondur. We know little about the country beyond to the east; we've had few reports on it since before the orcs took Knalga. Those mages should know at least rumors."
                [/message]

                [message]
                    speaker="Aiglondur"
                    message=_"Aye. And I'd not leave anyone who had done my kin no harm stranded to starve."
                [/message]
            [/else]
        [/if]
    [/event]

    # In this scenario only, losing Ratheln is fatal.
    # This avoids continuity problems in the next one.
    [event]
        name=die
        [filter]
            id="Ratheln"
        [/filter]
        [message]
            speaker=Ratheln
            message= _ "This is no fit death for a mage of fire!"
        [/message]

        [message]
            speaker="Angarthing"
            message=_"The snow has redoubled its fury, as if his presence had been holding it back. I do not see a way forward for us."
        [/message]

        [endlevel]
            result=defeat
        [/endlevel]
    [/event]

    [event]
        name=turn 9

        [message]
            speaker="Aiglondur"
            message=_"It has begun to snow. Move, everyone! To be trapped here would be death."
        [/message]
    [/event]

    [event]
        event=time over

        [message]
            speaker="Aiglondur"
            message=_"We're snowed in. Our mission has failed, even if we live until the spring."
        [/message]
    [/event]

    [event]
        name=moveto
        first_time_only=yes
        [filter]
            id=Aiglondur
            x=30
            y=11
        [/filter]

        [message]
            speaker="Aiglondur"
            message=_"We're through the pass!"
        [/message]

        [message]
            speaker="Angarthing"
            message=_"That may not be a blessing. Something frightened those orcs we fought among the bandit villages, enough to make them push west into Alliance territory. Don't you wonder what it was?"
        [/message]

        [message]
            speaker="Aiglondur"
            message=_"Aye. But I've a grim feeling we might be going to discover that in person."
        [/message]

        {REMOVE_HERO_ICON id=Ratheln}

        [endlevel]
            result=victory
            bonus=yes
            {NEW_GOLD_CARRYOVER 40}
        [/endlevel]
    [/event]
[/scenario]
