#textdomain wesnoth-trow
[scenario]
    id=17c_Troll_Hole
    name= _ "Troll Hole"
    next_scenario=16_The_Kalian
    map_data="{campaigns/The_Rise_Of_Wesnoth/maps/17c_Troll_Hole.map}"

    {TURNS 39 36 33}
    {UNDERGROUND}

    {SCENARIO_MUSIC underground.ogg}

    # No story
    {TROW_GC_TRACK {JOURNEY_17C_NEW} }

    {TROW_DEATHS}

    [side]
        type=Noble Commander
        id=Prince Haldric
        name= _ "Prince Haldric"
        unrenamable=yes
        side=1
        canrecruit=yes
        gold=200
        controller=human
        shroud=yes
        team_name=Haldric
        user_team_name=_"Refugees"
        {INCOME 8 4 2}
        {FLAG_VARIANT loyalist}
    [/side]

    [side]
        type=Troll Warrior
        id=Erart
        name= _ "Erart"
        side=2
        canrecruit=yes
        {GOLD 80 140 200}
        {INCOME 2 4 8}
        team_name=Troll
        user_team_name=_"Trolls"
        recruit=Troll Whelp,Troll,Troll Rocklobber
        [ai]
            {NO_SCOUTS}
            recruitment_pattern=fighter,fighter,mixed fighter
            aggression=0.75
            {ATTACK_DEPTH 3 5 5}
        [/ai]
    [/side]

    {STARTING_VILLAGES 2 10}

    [side]
        type=Troll Warrior
        id=Raol
        name= _ "Raol"
        side=3
        canrecruit=yes
        {GOLD 80 140 200}
        {INCOME 2 4 8}
        team_name=Troll
        user_team_name=_"Trolls"
        recruit=Troll Whelp,Troll,Troll Rocklobber
        [ai]
            {NO_SCOUTS}
            recruitment_pattern=fighter,fighter,mixed fighter
            aggression=0.75
            {ATTACK_DEPTH 3 5 5}
        [/ai]
    [/side]

    {STARTING_VILLAGES 3 10}

    [side]
        type=Troll Warrior
        id=Rilg
        name= _ "Rilg"
        side=4
        canrecruit=yes
        {GOLD 80 140 200}
        {INCOME 2 4 8}
        team_name=Troll
        user_team_name=_"Trolls"
        recruit=Troll Whelp,Troll,Troll Rocklobber
        [ai]
            {NO_SCOUTS}
            recruitment_pattern=fighter,fighter,mixed fighter
            aggression=0.75
            {ATTACK_DEPTH 3 5 5}
        [/ai]
    [/side]

    {STARTING_VILLAGES 4 10}

    [side]
        type=Troll Warrior
        id=Gulg
        name= _ "Gulg"
        side=5
        canrecruit=yes
        {GOLD 80 140 200}
        {INCOME 2 4 8}
        team_name=Troll
        user_team_name=_"Trolls"
        recruit=Troll Whelp,Troll,Troll Rocklobber
        [ai]
            {NO_SCOUTS}
            recruitment_pattern=fighter,fighter,mixed fighter
            aggression=0.75
            {ATTACK_DEPTH 3 5 5}
        [/ai]
    [/side]

    {STARTING_VILLAGES 5 10}

#ifdef EASY
    {LIMIT_CONTEMPORANEOUS_RECRUITS 2,3,4,5 "Troll" 1}
    {LIMIT_CONTEMPORANEOUS_RECRUITS 2,3,4,5 "Troll Rocklobber" 1}
#else
    {LIMIT_CONTEMPORANEOUS_RECRUITS 2,3,4,5 "Troll" 2}
    {LIMIT_CONTEMPORANEOUS_RECRUITS 2,3,4,5 "Troll Rocklobber" 2}
#endif

    {campaigns/The_Rise_Of_Wesnoth/utils/trow-nlmsg.cfg}

    [event]
        name=prestart

        {PLACE_IMAGE (scenery/rubble.png) 3 14}
        {PLACE_IMAGE (scenery/rubble.png) 25 19}
        {PLACE_IMAGE (scenery/rubble.png) 15 3}
        {PLACE_IMAGE (scenery/rubble.png) 17 27}

        {LOYAL_UNIT 2 (Tentacle of the Deep) 15 11}
        {LOYAL_UNIT 3 (Tentacle of the Deep) 14 19}

#ifdef NORMAL
        {LOYAL_UNIT 4 (Tentacle of the Deep) 11 15}
        {LOYAL_UNIT 5 (Tentacle of the Deep) 19 17}
#endif
#ifdef HARD

        {LOYAL_UNIT 4 (Tentacle of the Deep) 11 15}
        {LOYAL_UNIT 5 (Tentacle of the Deep) 19 17}
        {LOYAL_UNIT 2 (Tentacle of the Deep) 11 17}
        {LOYAL_UNIT 3 (Tentacle of the Deep) 19 15}
#endif

        {RANDOM 1..4}
        [if]
            [variable]
                name=random
                numerical_equals=1
            [/variable]
            [then]
                [kill]
                    id=Erart
                [/kill]
                {GUARD_UNIT (Giant Spider) () ( _ "Fang") 3 5 5}
                [kill]
                    id=Raol
                [/kill]
                {GUARD_UNIT (Giant Spider) () ( _ "Fang") 2 25 5}
            [/then]
        [/if]
        [if]
            [variable]
                name=random
                numerical_equals=2
            [/variable]
            [then]
                [kill]
                    id=Raol
                [/kill]
                {GUARD_UNIT (Giant Spider) () ( _ "Fang") 2 25 5}
                [kill]
                    id=Rilg
                [/kill]
                {GUARD_UNIT (Giant Spider) () ( _ "Fang") 5 5 25}
            [/then]
        [/if]
        [if]
            [variable]
                name=random
                numerical_equals=3
            [/variable]
            [then]
                [kill]
                    id=Rilg
                [/kill]
                {GUARD_UNIT (Giant Spider) () ( _ "Fang") 5 5 25}
                [kill]
                    id=Gulg
                [/kill]
                {GUARD_UNIT (Giant Spider) () ( _ "Fang") 4 25 25}
            [/then]
        [/if]
        [if]
            [variable]
                name=random
                numerical_equals=4
            [/variable]
            [then]
                [kill]
                    id=Gulg
                [/kill]
                {GUARD_UNIT (Giant Spider) () ( _ "Fang") 4 25 25}
                [kill]
                    id=Erart
                [/kill]
                {GUARD_UNIT (Giant Spider) () ( _ "Fang") 3 5 5}
            [/then]
        [/if]

        [recall]
            id=Lady Jessene
            x=14
            y=15
        [/recall]
        [recall]
            id=Burin the Lost
            x=16
            y=14
        [/recall]
        [recall]
            id=Minister Edren
            x=15
            y=16
        [/recall]

        [objectives]
            side=1
            [objective]
                description= _ "Defeat all enemy leaders"
                condition=win
            [/objective]
            [objective]
                description= _ "Death of Prince Haldric"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Lady Jessene"
                condition=lose
            [/objective]

            {TURNS_RUN_OUT}

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

    [event]
        name=start
        [message]
            speaker=narrator
            message= _ "It isn’t long before Haldric and his companions enter the Brown Hills. An elven guide leads them to a gaping cave mouth, and they descend into the darkness."
            image=wesnoth-icon.png
        [/message]

        [message]
            speaker=Prince Haldric
            message= _ "Does anybody actually know anything about Trolls?"
        [/message]

        [message]
            speaker=Burin the Lost
            message= _ "I indeed do. They are ugly and mean, and will try to crush you like a bug. They heal very quickly."
        [/message]

        [message]
            speaker=Lady Jessene
            message= _ "Hmm... Do we really need to know that much about the trolls? I think it’s safe to say that the elves wouldn’t have sent us down here if they were at all friendly."
        [/message]

        [message]
            speaker=Prince Haldric
            message= _ "Fair enough. Well, let’s get them!"
            image=portraits/haldric-mad.png
        [/message]
    [/event]

    [event]
        name=time over
        [message]
            speaker=Prince Haldric
            message= _ "We have failed... More of the trolls’ kin are arriving through the entrance."
            image=portraits/haldric-surprised.png
        [/message]
    [/event]

    [event]
        name=die
        [filter]
            id=Erart
        [/filter]
        {LOOT 50 1}
    [/event]

    [event]
        name=die
        [filter]
            id=Raol
        [/filter]
        {LOOT 50 1}
    [/event]

    [event]
        name=die
        [filter]
            id=Rilg
        [/filter]
        {LOOT 50 1}
    [/event]

    [event]
        name=die
        [filter]
            id=Gulg
        [/filter]
        {LOOT 50 1}
    [/event]

    [event]
        name=enemies defeated
        [message]
            speaker=Prince Haldric
            message= _ "The trolls are beaten, but they were no easy opponents. It is no wonder why the elves pressed us to do their dirty work."
        [/message]

        {VARIABLE_OP num_done add 1}

        [set_variable]
            name=troll_hole
            value=1
        [/set_variable]

        [set_variable]
            name=last_done
            value="Hole"
        [/set_variable]

        {CLEAR_VARIABLE random}

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