#textdomain wesnoth-ei
[scenario]
    id=Escape_Tunnel
    name= _ "The Escape Tunnel"
    next_scenario=Unexpected_Appearance
    map_data="{campaigns/Eastern_Invasion/maps/The_Escape_Tunnel.map}"
    {TURNS 26 24 22}
    {UNDERGROUND}

    {INTRO_AND_SCENARIO_MUSIC the_city_falls.ogg underground.ogg}
    {EXTRA_SCENARIO_MUSIC frantic.ogg}
    {EXTRA_SCENARIO_MUSIC revelation.ogg}

    {campaigns/Eastern_Invasion/utils/deaths.cfg}

    [side]
        type=Lieutenant
        id=Gweddry
        name= _ "Gweddry"
        side=1
        canrecruit=yes
        controller=human
        shroud=yes
        team_name=good
        user_team_name=_"Wesnothians"
        {GOLD 200 150 100}
    [/side]

    [side]
        type=Troll
        id=Kabak
        name= _ "Kabak"
        side=2
        canrecruit=yes
        controller=ai
        recruit=Troll Whelp
        {GOLD 60 70 80}
        team_name=monster
        user_team_name=_"Monsters"
    [/side]

    [side]
        type=Dwarvish Steelclad
        id=Knutan
        name= _ "Knutan"
        side=3
        canrecruit=yes
        controller=ai
        recruit=Dwarvish Fighter,Dwarvish Thunderer
        {GOLD 70 60 50}
        team_name=good
        user_team_name=_"Wesnothians"
        [ai]
            grouping=no
            [target]
                side=2
                value=100
            [/target]
            [target]
                side=3
                value=1
            [/target]
        [/ai]
    [/side]

    [side]
        type=Dark Sorcerer
        id=Mal-Bakral
        name= _ "Mal-Bakral"
        side=4
        canrecruit=yes
        controller=ai
        recruit=Vampire Bat,Ghost
        {GOLD 150 200 250}
        team_name=undead
        user_team_name=_"Undead"
        {FLAG_VARIANT undead}
        [ai]
            {NO_SCOUTS}
        [/ai]
    [/side]

    [event]
        name=prestart
        [objectives]
            side=1
            [objective]
                description= _ "Reach the end of the tunnel"
                condition=win
            [/objective]
            [objective]
                description= _ "Death of Gweddry"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Dacyn"
                condition=lose
            [/objective]

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

    #beginning talking
    [event]
        name=start
        [recall]
            id=Dacyn
        [/recall]
        [message]
            speaker=Gweddry
            message= _ "Where are we? I can't see where we are going."
        [/message]
        [message]
            speaker=Dacyn
            message= _ "I do not know. There are trolls in here, which may try to fight us. Now hurry, we have to move quickly with those liches still behind us."
        [/message]
        [message]
            speaker=Gweddry
            message= _ "Wait, before we go anywhere - who were those undead?"
        [/message]
        [message]
            speaker=Dacyn
            message= _ "It doesn't matter. They are much too powerful for us; our only hope is to get away, far away. Perhaps we should go north, and meet with Owaec."
        [/message]
        [unit]
            type=Troll Whelp
            x,y=32,10
            side=2
        [/unit]
    [/event]

    #the signpost
    [item]
        x=29
        y=10
        image=scenery/signpost.png
    [/item]

    [event]
        name=moveto
        [filter]
            x=29
            y=10
            side=1
        [/filter]
        [message]
            speaker=unit
            image=scenery/signpost.png
            message= _ "TROL TREZZUR HOLE: KEEP OWT"	# wmllint: no spellcheck
        [/message]
        [allow_undo]
        [/allow_undo]
    [/event]

    #find the dwarves
    [event]
        name=sighted
        [filter]
            side=3
        [/filter]
        [message]
            speaker=unit
            message= _ "Who goes there?"
        [/message]
        [message]
            speaker=Gweddry
            message= _ "We are soldiers of the king of Wesnoth. Will you help us escape these trolls?"
        [/message]
        [message]
            speaker=unit
            message= _ "Aye, we'll help ye, for we have nae love for the trolls. Anyone attacked by them deserves some help, I think."
        [/message]
        [if]
            [variable]
                name=undead
                equals=yes
            [/variable]
            [then]
                [message]
                    speaker=Dacyn
                    message= _ "Thank you. Now, I invite you to join us. Undead have followed us into these caves, and they will kill you if you stay behind."
                [/message]
            [/then]
            [else]
                [message]
                    speaker=Dacyn
                    message= _ "Thank you. Now, I invite you to join us. Undead are in these lands, and they will find these caves."
                [/message]
            [/else]
        [/if]
        [message]
            speaker=unit
            message= _ "My clan ha' lived in these caves for centuries. We'll no' be scattered now by a few undead."
        [/message]
        [message]
            speaker=Dacyn
            message= _ "Very well. The best of luck in your battle."
        [/message]
    [/event]

    {PICKUPPABLE_ITEM holy_amulet 12 2 side=1 items/ankh-necklace.png
    _"Wearing this amulet will cause every blow you deal to inflict arcane damage!"
    _"I am not suited to using this item! Let another take it." (
        [object]
            name= _ "Holy Amulet"
            image=items/ankh-necklace.png
            duration=forever

            [effect]
                apply_to=attack
                range=melee
                set_type=arcane
            [/effect]
            [effect]
                apply_to=attack
                range=ranged
                set_type=arcane
            [/effect]
        [/object]
    )}

    #treasure chest
    [item]
        x=35
        y=8
        image=items/chest.png
    [/item]

    [event]
        name=moveto
        [filter]
            x=35
            y=8
            side=1
        [/filter]
        [sound]
            name=gold.ogg
        [/sound]
        [message]
            speaker=unit
            message= _ "There is a great fortune in this chest of treasure! I can count two hundred pieces of gold."
        [/message]
        [gold]
            side=1
            amount=200
        [/gold]
        [removeitem]
        [/removeitem]
    [/event]

    #Mal-Bakral arrives
    [event]
        name=turn 6
        [set_variable]
            name=undead
            value=yes
        [/set_variable]
        [terrain]
            x=2,3,4,2
            y=4,4,4,5
            terrain=Uu^Ii
        [/terrain]
        [unit]
            type=Revenant
            side=4
            x=2
            y=5
        [/unit]
        [unit]
            type=Revenant
            side=4
            x=4
            y=5
        [/unit]
        [unit]
            type=Revenant
            side=4
            x=2
            y=4
            ai_special=guardian
        [/unit]
        [unit]
            type=Revenant
            side=4
            x=4
            y=4
            ai_special=guardian
        [/unit]

#ifdef HARD
        [unit]
            type=Bone Shooter
            side=4
            x=3
            y=5
        [/unit]
        [unit]
            type=Bone Shooter
            side=4
            x=3
            y=4
            ai_special=guardian
        [/unit]

#endif
        [remove_shroud]
            x,y=3,3
        [/remove_shroud]
        [teleport]
            [filter]
                id=Mal-Bakral
            [/filter]
            x,y=3,3
        [/teleport]
        [message]
            speaker=Mal-Bakral
            message= _ "We have found you, fleshbag! Prepare to die!"
        [/message]
        [message]
            speaker=Dacyn
            message= _ "They follow us... we must get out of this tunnel. It looks like it is leading east. That is unfortunate, for it will take us further from Weldyn. But it is our only option."
        [/message]
    [/event]

    [event]
        name=moveto
        [filter]
            x=39
            y=6
            id=Gweddry
        [/filter]
        [message]
            speaker=Gweddry
            message= _ "We have reached the end of the tunnel. I see daylight above us!"
        [/message]
        [clear_variable]
            name=undead
        [/clear_variable]
        [endlevel]
            result=victory
            bonus=yes
            {NEW_GOLD_CARRYOVER 40}
        [/endlevel]
    [/event]
[/scenario]
