#textdomain wesnoth-httt
[scenario]
    id=16_Hasty_Alliance
    name= _ "Hasty Alliance"
    map_data="{campaigns/Heir_To_The_Throne/maps/16_Hasty_Alliance.map}"
    {SCENARIO_MUSIC "underground.ogg"}
    {TURNS 33 30 27}

    {DEEP_UNDERGROUND}

    next_scenario=17_Scepter_of_Fire

    [event]
        name=prestart
        [objectives]
            side=1
            [objective]
                description= _ "Defeat the enemy leader"
                condition=win
            [/objective]
            [objective]
                description= _ "Death of Konrad"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Delfador"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Li'sar"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Kalenz"
                condition=lose
            [/objective]
        [/objectives]
    [/event]

    [story]
        [part]
            story= _ "The last dwarvish settlement far behind them, the party descended into the deepest parts of the hewn caverns. Except for disturbances caused by the occasional goblin, the air in the lower passages was still and tomblike."
            #background="maps/wesnoth-httt.jpg"
            show_title=no
        [/part]
        [part]
            story= _ "Stepping through a low corridor, Konrad and Delfador emerged from the mazelike catacombs into icy blackness. Darkness seemed to crush them. Lights flickered and went out. Even the staff of the elder mage struggled to produce enough light to see by."
            #background="maps/wesnoth-httt.jpg"
            show_title=no
        [/part]
        [part]
            story= _ "A cavernous void stretched out ahead, across which no ceiling or walls were visible. Wind howled and whipped over narrow ledges bridging the depths, almost as if animated by powerful nearby magic... and newly awoken evil."
            #background="maps/wesnoth-httt.jpg"
            show_title=no
        [/part]
    [/story]

    {BIGMAP_HASTY_ALLIANCE}

    [side]
        side=1
        canrecruit=yes
        controller=human
        shroud=yes
        team_name=good

        type=Commander
        description=Konrad
        user_description= _ "Konrad"
        unrenamable=yes
    [/side]

    [side]
        side=2
        canrecruit=yes
        controller=ai

        type=Princess
        description="Li'sar"
        user_description= _ "Li'sar"
        facing=sw
        [ai]
            recruitment_pattern=fighter,fighter,fighter,fighter,mixed fighter
        [/ai]
        recruit=Swordsman,Heavy Infantryman,Pikeman,Red Mage,Ogre
        gold=400
        team_name=good
        experience=62
    [/side]

    [side]
        type=Troll Warrior
        description=Haaf-Garga
        user_description= _ "Haaf-Garga"
        side=3
        canrecruit=yes
        controller=ai
#ifdef EASY
        recruit=Troll,Troll Whelp,Vampire Bat,Wolf Rider
#else
        recruit=Troll,Troll Warrior,Blood Bat,Wolf Rider
#endif
        {GOLD 100 160 220}
        {INCOME 4 8 12}
        [ai]
            {ATTACK_DEPTH 4 5 5}
        [/ai]
    [/side]

    [event]
        name=start

        # {SCATTER_IMAGE (terrain=Uu) 4 scenery/rubble.png}

        #hide Li'sar until she arrives
        [hide_unit]
            x=12
            y=18
        [/hide_unit]

        [recall]
            description=Delfador
        [/recall]
        [recall]
            description=Kalenz
        [/recall]

        [redraw]
        [/redraw]

        [message]
            description=Konrad
            message= _ "Where are we? Which way now? I am tired of this darkness!"
        [/message]
        [message]
            description=Delfador
            message= _ "I am not sure of the way. Let me think for a moment."
        [/message]

        #Li'sar arrives
        [move_unit_fake]
            type=Princess
            side=2
            x=15,14,13,12
            y=17,18,19,18
        [/move_unit_fake]

        [unhide_unit]
        [/unhide_unit]

        [move_unit_fake]
            type=Royal Guard
            side=2
            x=15,14,13,12,11
            y=18,18,18,17,18
        [/move_unit_fake]

        [unit]
            type=Royal Guard
            generate_description=yes
            side=2
            x=11
            y=18
            facing=sw
            [modifications]
                {TRAIT_LOYAL}
            [/modifications]
        [/unit]
        [redraw]
        [/redraw]

        [move_unit_fake]
            type=Royal Guard
            side=2
            x=15,14,13,12,11
            y=18,18,19,18,19
        [/move_unit_fake]

        [unit]
            type=Royal Guard
            generate_description=yes
            side=2
            x=11
            y=19
            facing=sw
            [modifications]
                {TRAIT_LOYAL}
            [/modifications]
        [/unit]
        [redraw]
        [/redraw]

        [message]
            description="Li'sar"
            message= _ "En garde!"
        [/message]
        [message]
            description=Konrad
            message= _ "What in the world are you doing here?"
        [/message]
        [message]
            description="Li'sar"
            message= _ "Tracking you down, of course! You have escaped me for the last time!"
        [/message]
        [message]
            description=Delfador
            message= _ "Foolish girl! We are in the deepest of caverns, probably surrounded by all manner of creatures, and you still want to fight us? You will bring us all to ruin!"
        [/message]
        [message]
            description="Li'sar"
            message= _ "Don't try to trick me! I know why you have come here! But I will put an end to you and your treason here. Then I will get the Scepter, and return to the daylight again!"
        [/message]

        #change the music to being frantic as lots of orcs arrive
        [music]
            name=frantic.ogg
            immediate=yes
        [/music]

#define HASTY_TROLL X Y
    {LOYAL_UNIT 3 (Troll) {X} {Y} (Troll) ( _ "Troll")}
    [redraw]
    [/redraw]
#enddef
#define HASTY_GOBLIN_KNIGHT X Y
    {LOYAL_UNIT 3 (Goblin Knight) {X} {Y} (Goblin Knight) ( _ "Goblin Knight")}
    [redraw]
    [/redraw]
#enddef

        #alot of enemies arrive
        [move_unit_fake]
            type=Troll
            side=3
            x=13,12,11
            y=16,16,16
        [/move_unit_fake]

        {HASTY_TROLL 11 16}

        [move_unit_fake]
            type=Troll
            side=3
            x=13,13
            y=16,17
        [/move_unit_fake]

        {HASTY_TROLL 13 17}

        [move_unit_fake]
            type=Troll
            side=3
            x=15,14
            y=18,18
        [/move_unit_fake]

        {HASTY_TROLL 14 18}

        [move_unit_fake]
            type=Goblin Knight
            side=3
            x=4,5,6
            y=13,14,14
        [/move_unit_fake]

        {HASTY_GOBLIN_KNIGHT 6 14}

        [move_unit_fake]
            type=Goblin Knight
            side=3
            x=3,4,5
            y=16,16,16
        [/move_unit_fake]

        {HASTY_GOBLIN_KNIGHT 5 16}

        [move_unit_fake]
            type=Goblin Knight
            side=3
            x=7,8
            y=20,20
        [/move_unit_fake]

        {HASTY_GOBLIN_KNIGHT 8 20}

        [move_unit_fake]
            type=Troll
            side=3
            x=3,4,5
            y=14,14,15
        [/move_unit_fake]

        {HASTY_TROLL 5 15}

        [move_unit_fake]
            type=Troll
            side=3
            x=5,5,6
            y=14,15,15
        [/move_unit_fake]

        {HASTY_TROLL 6 15}

        #some more trolls that are behind in the caves
        {HASTY_TROLL 3 13}
        {HASTY_TROLL 4 9}
        {HASTY_TROLL 15 13}
        {HASTY_TROLL 17 14}
        {HASTY_TROLL 13 10}

        [message]
            type=Goblin Knight
            message= _ "Surprise! Die, you sun-lovers!"
        [/message]
        [message]
            description=Kalenz
            message= _ "Now we are surrounded! Do you still want to fight us, Princess? Surely that would lead to doom for us all!"
        [/message]
        [message]
            description="Li'sar"
            message= _ "I see we have little choice but to help each other. Let us fight together until we return to the surface. Agreed?"
        [/message]
        [message]
            description=Konrad
            message= _ "Very well, I promise that you will reach the surface again, or we shall all perish together, Princess."
        [/message]
        [message]
            description="Li'sar"
            message= _ "But once we escape from this hole, I have a score to settle with you!"
        [/message]
    [/event] #end of start event

    [event]
        name=victory

        [message]
            description=Konrad
            message= _ "Well, we have helped each other survive so far, Princess. Now let's continue together. What do you say?"
        [/message]
        [message]
            description="Li'sar"
            message= _ "Yes. We agreed to help each other get out of these pits alive, did we not? Let us continue to pool our resources. I pledge to you my gold."
        [/message]

        [message]
            description=Konrad
            message= _ "Thank you, Princess. Come, men. Let us find the Scepter!"
        [/message]

        [store_unit]
            [filter]
                description=Li'sar
            [/filter]

            kill=no
            variable=stored_Lisar
        [/store_unit]

        [unit]
            side=1
            description="Li'sar"
            user_description= _ "Li'sar"
            unrenamable=yes
            type=$stored_Lisar.type
            experience=$stored_Lisar.experience
            {IS_HERO}
            random_traits=no
            [modifications]
                {TRAIT_LOYAL}
            [/modifications]
        [/unit]

        {CLEAR_VARIABLE stored_Lisar}
    [/event]

    #deaths.cfg only handles death of Li'sar is she's on side '1', so handle
    #it explicitly here.
    [event]
        name=die
        [filter]
            description="Li'sar"
        [/filter]
        [message]
            speaker=unit
            message= _ "I can't believe it should end like this!"
        [/message]
        [endlevel]
            result=defeat
        [/endlevel]
    [/event]

    {campaigns/Heir_To_The_Throne/utils/deaths.cfg}
[/scenario]
