#textdomain wesnoth-nr
[scenario]
    id=compelled
    name= _ "Compelled"
    {SCENARIO_MUSIC "underground.ogg"}

    [story]
        [part]
            story= _ "Note: The work on this branch of the campaign is in progress."
        [/part]

        [part]
            story= _ "Thus, compelled by some strange and irresistible force, Tallin - eyes glazed and mind unthinking - did the will of his new master."
            music=sad.ogg
        [/part]

        [part]
            # wmllint: local spelling grimoires
            story= _ "He was first stripped of his weapons and armor and then cast into solitary confinement. He remained there for months, never being allowed to see the light of day, being fed only enough food to keep him alive. During this time he was forced to study the most dark and forbidden arts, lashed with whips when he could not recite lessons drawn from grimoires no human should ever have opened. His body grew feeble and emaciated and his mind plunged ever deeper into night. And day by day the magical controls Malifor had fastened about Tallin's will grew stronger."
        [/part]

        [part]
            story= _ "Tallin never knew exactly how much time passed, but eventually Malifor's lich-servants declared him fit for service and he was summoned before their dread Master. Through a hideous blood ritual, Malifor gave him the power to animate corpses. He was then sent to a distant network of tunnels to clear out a group of trolls who had taken up residence there."
        [/part]
    [/story]

    map_data="{campaigns/Northern_Rebirth/maps/compelled.map}"

    {TURNS4 43 39 35 31}

    {UNDERGROUND}

    next_scenario=slave_of_undead

    [side]
        type=Peasant
        id=Tallin
        canrecruit=yes
        side=1
        controller=human
        gold=100
        recruit=Walking Corpse
        team_name=mob
        user_team_name=_"Minions"
        shroud=yes
    [/side]

    [side]
        type=Troll
        id=Franik
        name= _ "Franik"
        canrecruit=yes
        side=2
        {GOLD4 20 30 35 40}
        recruit=Troll Whelp
        team_name=trolls
        user_team_name=_"Trolls"
        [ai]
            recruitment_pattern=fighter
        [/ai]
    [/side]

    [side]
        type=Troll
        id=Henie
        name= _ "Henie"
        canrecruit=yes
        side=3
        {GOLD4 20 30 35 40}
        recruit=Troll Whelp
        team_name=trolls
        user_team_name=_"Trolls"
        [ai]
            recruitment_pattern=fighter
        [/ai]
    [/side]

    [event]
        name=prestart
        [objectives]
            side=1
            [objective]
                condition=win
                description=_ "Kill the Troll Leaders"
            [/objective]
            [objective]
                condition=lose
                description=_ "Death of Tallin"
            [/objective]
            [objective]
                condition=lose
                description=_ "Turns run out"
            [/objective]
            note={NO_EARLY_FINISH_BONUS_NOTE}
        [/objectives]

        [store_unit]
            [filter]
                id=Tallin
            [/filter]
            variable=typechange
            kill=yes
        [/store_unit]

        [if]
            [variable]
                name=typechange.type
                equals=Peasant
            [/variable]
            [or]
                [variable]
                    name=typechange.type
                    equals=Spearman
                [/variable]
            [/or]
            [or]
                [variable]
                    name=typechange.type
                    equals=Bowman
                [/variable]
            [/or]
            [then]
                [set_variable]
                    name=typechange.type
                    value=Dark Adept
                [/set_variable]
            [/then]
        [/if]

        [if]
            [variable]
                name=typechange.type
                equals=Longbowman
            [/variable]
            [or]
                [variable]
                    name=typechange.type
                    equals=Swordsman
                [/variable]
            [/or]
            [or]
                [variable]
                    name=typechange.type
                    equals=Pikeman
                [/variable]
            [/or]
            [or]
                [variable]
                    name=typechange.type
                    equals=Javelineer
                [/variable]
            [/or]
            [then]
                [set_variable]
                    name=typechange.type
                    value=Dark Sorcerer
                [/set_variable]
            [/then]
        [/if]

        [if]
            [variable]
                name=typechange.type
                equals=Master Bowman
            [/variable]
            [or]
                [variable]
                    name=typechange.type
                    equals=Royal Guard
                [/variable]
            [/or]
            [or]
                [variable]
                    name=typechange.type
                    equals=Halberdier
                [/variable]
            [/or]
            [then]
                [set_variable]
                    name=typechange.type
                    value=Lich
                [/set_variable]
            [/then]
        [/if]

        [unstore_unit]
            variable=typechange
            find_vacant=yes
        [/unstore_unit]
        {CLEAR_VARIABLE typechange}

        [store_gold]
            side=1
            variable=reset_gold
        [/store_gold]
        {VARIABLE_OP reset_gold multiply -1}
        [gold]
            side=1
            amount=$reset_gold
        [/gold]
        [gold]
            side=1
            amount=200
        [/gold]
        {CLEAR_VARIABLE reset_gold}

        [kill]
            side=1
            [not]
                id=Tallin
            [/not]
        [/kill]
    [/event]

    [event]
        name=start

        {MODIFY_UNIT id=Tallin alignment chaotic}

        [unit]
            type=Giant Spider
            x=19
            y=9
            side=2
            ai_special=guardian
        [/unit]

        [unit]
            type=Giant Spider
            x=3
            y=20
            side=3
            ai_special=guardian
        [/unit]
    [/event]

    [event]
        name=last breath
        [filter]
            id=Tallin
        [/filter]

        [message]
            speaker=Tallin
            image=portraits/Tallin-Evil.png
            message= _ "Argh! I have failed my master."
        [/message]

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