#textdomain wesnoth-thot

[scenario]
    id=06_High_Pass
    name= _ "High Pass"
    map_data="{campaigns/The_Hammer_of_Thursagan/maps/06_High_Pass.map}"
    {TURNS 22 18 12}
    next_scenario=07_Mages_and_Drakes
    victory_when_enemies_defeated=no

    {DEFAULT_SCHEDULE}

    # 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}
    {EXTRA_SCENARIO_MUSIC northern_mountains.ogg}
    {EXTRA_SCENARIO_MUSIC casualties_of_war.ogg}

    {THOT_TRACK {JOURNEY_STAGE6}}

    # wmllint: validate-off
    [side]
        side=1
        controller=human
        recruit="Dwarvish Fighter, Dwarvish Thunderer,Dwarvish Guardsman, Dwarvish Scout"
        {GOLD 100 80 60}
        team_name="northern_alliance"
        user_team_name=_"Alliance"
        {FLAG_VARIANT knalgan}

        # wmllint: recognize Aiglondur
        {CHARACTER_STATS_AIGLONDUR}

        shroud=yes
        facing=ne
    [/side]
    # wmllint: validate-on

    [side]
        side=2
        recruit=Gryphon
        {GOLD 60 80 100}
        {INCOME 2 2 2}
        team_name=wildthings
        user_team_name= _ "Monsters"

        type=Gryphon
        id=Kaara
        name= _ "Kaara"
        canrecruit=yes

        facing=s

        [ai]
            {ATTACK_DEPTH 1 3 5}
            passive_leader=yes
            [avoid]
                x,y=$magehut.x,$magehut.y
            [/avoid]
        [/ai]
    [/side]

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

        [ai]
            [avoid]
                x,y=$magehut.x,$magehut.y
            [/avoid]
        [/ai]
    [/side]

#define WILDTHING X Y
    [set_variable]
        name=typeofenemy
        rand=Wolf,Ogre,Troll
    [/set_variable]

    [unit]
        side=3
        x,y={X},{Y}
        type=$typeofenemy
        generate_name=yes
        random_traits=yes
    [/unit]

    [fire_event]
        name=spawn_extra_wolf
        [primary_unit]
            x,y={X},{Y}
        [/primary_unit]
    [/fire_event]

    {CLEAR_VARIABLE typeofenemy}
#enddef

    {PLACE_IMAGE (scenery/signpost.png) 30 11}

    [event]
        name=prestart

        {VARIABLE magehut.x 19}
        {VARIABLE magehut.y 10}

        [objectives]
            side=1
            [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 = _ "Death of Ratheln"
                condition=lose
                [show_if]
                    [have_unit]
                        id=Ratheln
                    [/have_unit]
                [/show_if]
            [/objective]

            {TURNS_RUN_OUT}

            [gold_carryover]
                bonus=yes
                carryover_percentage=40
            [/gold_carryover]
        [/objectives]

        [recall]
            id=Angarthing
        [/recall]

        {MODIFY_UNIT (side=1) facing ne}
    [/event]

    [event]
        name=start

        [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]

        [remove_shroud]
            [filter_side]
                side=1
            [/filter_side]
            x=29-31,30
            y=11-12,10
        [/remove_shroud]

        {HIGHLIGHT_IMAGE 30 11 scenery/signpost.png ()}

        [place_shroud]
            [filter_side]
                side=1
            [/filter_side]
            x=29-31,30
            y=11-12,10
        [/place_shroud]

        {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]

#ifdef EASY
    # Compensate that you get less experience points on easy.
    [event]
        name=turn 15

        {WILDTHING 29 14}
    [/event]
#endif

    [event]
        name=spawn_extra_wolf
        first_time_only=no
        [filter_condition]
            [variable]
                name=typeofenemy
                equals=Wolf
            [/variable]
        [/filter_condition]

        [unit]
            x,y=$x1,$y1
            type=Wolf
            side=3
        [/unit]

#ifndef EASY
        [unit]
            x,y=$x1,$y1
            type=Wolf
            side=3
        [/unit]
#endif
    [/event]

    # If the user hasn't found Ratheln by a reasonable time, nudge a little.
    [event]
        {QUANTITY name (turn 12) (turn 10) (turn 8)}

        [filter_condition]
            [not]
                [have_unit]
                    #wmllint: recognize Ratheln
                    id=Ratheln
                [/have_unit]
            [/not]
        [/filter_condition]

        [role]
            role=keen nose
            type_adv_tree=Dwarvish Scout
            [else]
                [role]
                    role=keen nose
                    id=Angarthing
                [/role]
            [/else]
        [/role]

        [message]
            role=keen nose
            message= _ "There’s a scent of scorched gryphon meat in the air, emanating from that hut yonder. We should investigate."
        [/message]

        [remove_shroud]
            [filter_side]
                side=1
            [/filter_side]
            x,y=19,10
            radius=1
        [/remove_shroud]

        {HIGHLIGHT_IMAGE 19 10 items/gohere.png ()}

        [remove_item]
            x,y=19,10
        [/remove_item]
    [/event]

    [event]
        name=enter_hex
        first_time_only=yes
        [filter]
            side=1
            [filter_location]
                # The player was given a hint to check this particular hut out.
                x,y=19,10
                {QUANTITY radius 4 3 2}
            [/filter_location]
        [/filter]

        [cancel_action][/cancel_action]

        [fire_event]
            name=meeting a mage
        [/fire_event]

        [redraw]
            clear_shroud=yes
            side=1
        [/redraw]

        [show_objectives][/show_objectives]
    [/event]

    [event]
        name=meeting a mage

        [unit]
            side=1
            x,y=19,11

            # wmllint: recognize Ratheln
            {CHARACTER_STATS_RATHELN}
            facing=sw
        [/unit]

        # In case the area was not yet visible.
        [remove_shroud]
            [filter_side]
                side=1
            [/filter_side]
            x,y=19,11
            radius=1
        [/remove_shroud]

        [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]
        # Unsetting the variables already here would result in the AI avoiding everything.
        {VARIABLE magehut.x 999}
        {VARIABLE magehut.y 999}
    [/event]

    # In this scenario only, losing Ratheln is fatal.
    # This avoids continuity problems in the next one.
    [event]
        name=last breath
        [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]
        {QUANTITY name (turn 16) (turn 14) (turn 9)}

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

    [event]
        name=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,y=30,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]

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

    [event]
        name=victory

        # In case the player didn't pick up Ratheln.
        [fire_event]
            name=meeting a mage
        [/fire_event]
        {CLEAR_VARIABLE magehut}
    [/event]

    # No need for Ratheln's death event here since he has a custom one this scenario.
    {HERODEATH_AIGLONDUR}
    {HERODEATH_ANGARTHING}
[/scenario]

#undef WILDTHING
