#textdomain wesnoth-l
[scenario]
    id=06_The_Grey_Woods
    name= _ "The Grey Woods"
    next_scenario=07_The_Hunters
    victory_when_enemies_defeated=yes
    map_data="{campaigns/Liberty/maps/06_The_Grey_Woods.map}"
    {TURNS 50 44 42}
    {DEFAULT_SCHEDULE_SECOND_WATCH}

    # terrain=* only works inside an event.
    [event]
        name=prestart
        [time_area]
            terrain=U*,U*^*,Ce,Cud,Kud,Ql,Xu
            x,y=27-34,4-9
            {UNDERGROUND}
        [/time_area]
    [/event]

    {INTRO_AND_SCENARIO_MUSIC "underground.ogg" "the_deep_path.ogg"}
    {EXTRA_SCENARIO_MUSIC "elvish-theme.ogg"}
    {EXTRA_SCENARIO_MUSIC "suspense.ogg"}
    {EXTRA_SCENARIO_MUSIC "knalgan_theme.ogg"}

    {LIBERTY_BIGMAP {JOURNEY_06_NEW} }

    [side]
        type=Bandit
        id=Baldras
        side=1
        canrecruit=yes
        controller=human
        recruit=Thug,Footpad,Poacher
        {GOLD 200 150 100}
#ifdef EASY
        shroud=no
        fog=yes
        share_vision=all
#endif
#ifdef NORMAL
        shroud=yes
        fog=yes
        share_vision=all
#endif
#ifdef HARD
        shroud=yes
        fog=yes
        share_vision=shroud
#endif
        team_name=good_guys
        user_team_name=_"Rebels"
    [/side]

    {AI_CONTROLLER () 1 2 ()}

    [side]
        type=Shadow Lord
        id=Helicrom
        name= _ "Helicrom"
        profile=portraits/helicrom.png
        facing=sw
        side=2
        canrecruit=yes
        recruit=Rogue Mage,Shadow Mage,Thief,Trapper,Huntsman,Outlaw,Fugitive
        {GOLD 300 250 200}
        controller=ai
        [ai]
            recruitment_pattern=mixed fighter,mixed fighter,fighter,mixed fighter,archer
        [/ai]
        shroud=yes
        fog=yes
        share_vision=all
        team_name=good_guys
        user_team_name=_"Rebels"

        [ai]
            village_value=0.5
            leader_value=1
            [goal]
                name=protect_unit
                [criteria]
                    side=1
                [/criteria]
                protect_radius=8
                value=2.0
            [/goal]
        [/ai]
    [/side]

    {STARTING_VILLAGES 2 9}

    [side]
        type=Necromancer
        id=Mal-Jarrof
        name= _ "Mal-Jarrof"
        side=3
        canrecruit=yes
        recruit=Skeleton,Skeleton Archer,Ghost,Walking Corpse,Ghoul
        controller=ai
        {GOLD 80 100 100}
        shroud=no
        fog=no
        team_name=evil_ones
        user_team_name=_"Evil"
        {FLAG_VARIANT undead}
    [/side]

    [side]
        type=Necromancer
        id=Mal-Jerod
        name= _ "Mal-Jerod"
        side=4
        canrecruit=yes
        recruit=Skeleton,Revenant,Skeleton Archer,Ghost,Walking Corpse
        controller=ai
        {GOLD 80 100 100}
        shroud=no
        fog=no
        team_name=evil_ones
        user_team_name=_"Evil"
        {FLAG_VARIANT undead}
    [/side]

    [side]
        type=Lich
        id=Sel-Mana
        name= _ "Sel-Mana"
        facing=sw
        side=5
        canrecruit=yes
        recruit=Skeleton,Dark Adept,Skeleton Archer,Soulless,Vampire Bat
        controller=ai
        {GOLD 80 100 100}
        shroud=no
        fog=no
        team_name=evil_ones
        user_team_name=_"Evil"
        {FLAG_VARIANT undead}
    [/side]
    #
    # Prestart events
    #
    [event]
        name=prestart

        [objectives]
            side=1
            [objective]
                description= _ "Defeat the lich and its minions"
                condition=win
            [/objective]
            [objective]
                description= _ "Death of Baldras"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Harper"
                condition=lose
            [/objective]

            {TURNS_RUN_OUT}

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

            {AI_CONTROLLER_NOTE}
        [/objectives]

        #Initialize switch
        {VARIABLE Helicrom_dead 0}

        #
        # Give Helicrom some free underlings and the villages in his camp
        #
        {GENERIC_UNIT 2 (Rogue Mage) 13 6}
        {GENERIC_UNIT 2 (Shadow Mage) 11 7}

        #
        # Give the SE Lich some baddies to shake things up
        #
        {GENERIC_UNIT 5 Wraith 37 36}
#ifdef HARD
        {GENERIC_UNIT 5 Shadow 36 36}
#endif

        [item]
            x,y=8,19
            image=items/burial.png
        [/item]
        [item]
            x,y=37,39
            image=items/bonestack.png
        [/item]
        [item]
            x,y=35,31
            image=items/burial.png
        [/item]
        [item]
            x,y=33,35
            image=items/bones.png
        [/item]
    [/event]

    #
    # Starting conversation and actions
    #
    [event]
        name=start
        {MOVE_UNIT id=Baldras 7 4}
        [recall]
            id=Harper
        [/recall]
        [redraw]
            side=1
        [/redraw]
        [message]
            speaker=Baldras
            message= _ "The leader, I presume."
        [/message]
        [message]
            speaker=Helicrom
            message= _ "I am Helicrom, and you should not be so glib. I control dangerous men. My henchmen can slip unseen through any city, rob a man while he sleeps, or attack a caravan head-on. It’s not noble work, but our pursuits require plenty of gold."
        [/message]
        [message]
            speaker=Baldras
            message= _ "Your pursuits?"
        [/message]
        [message]
            speaker=Helicrom
            message= _ "The former King’s magic ministry kept a tight control on the training and employment of mages in Wesnoth. Those of us who dared to... depart from the curriculum, you might say, were dealt with harshly. We are outcasts because we seek to master shadow magic. Our secrecy and security are not cheap."
        [/message]
        [message]
            speaker=Baldras
            message= _ "I have heard of you. Necromancers. Barely-human scum, I say."
        [/message]
        [message]
            speaker=Helicrom
            message= _ "Wrong. Necromancers become slaves to their lich masters and eventually lose their humanity. We have proven that practicing the dark arts need not lead down that path to damnation. We remain human, and seek the mystical secret of balance between the ways of light and darkness. We dance between both ways, adhering to neither."
        [/message]
        [message]
            speaker=Baldras
            message= _ "I... see, I think. Why do you want to help us?"
        [/message]
        [message]
            speaker=Helicrom
            message= _ "We don’t. You have sought us out. But, I do know of your situation and am willing to help. Any weakening of the Throne of Wesnoth, whether it be occupied by King or Queen, aids us."
        [/message]
        [message]
            speaker=Helicrom
            message= _ "Carcyn is always foggy as of late because these woods have recently become home to a lich and two of its underling necromancers. Our experiments may have actually aroused it from sleep... We’re not sure."
        [/message]
        [message]
            speaker=Baldras
            message= _ "So now you need to defend your rear as well as your front... I see your predicament. My men will wipe this land clean if you can help us defend our homeland."
        [/message]
    [/event]

    [event]
        name=die
        [filter]
            id=Sel-Mana
        [/filter]
        [if]
            [have_unit]
                side=3
                canrecruit=yes
            [/have_unit]

            [or]
                [have_unit]
                    side=4
                    canrecruit=yes
                [/have_unit]
            [/or]

            [then]
                [message]
                    speaker=Helicrom
                    message= _ "Finally, that creature is dead, yet its foolish minions resist."
                [/message]
            [/then]

            [else]
                [message]
                    speaker=Baldras
                    message= _ "The lich is destroyed and its minions dead."
                [/message]
            [/else]
        [/if]
    [/event]

    [event]
        name=enemies defeated

        [if]
            [variable]
                name=Helicrom_dead
                numerical_equals=1
            [/variable]
            [then]
                [message]
                    speaker=narrator
                    message= _ "The defeat of the evil lich infesting the Grey Woods was a bittersweet victory. With Helicrom dead, the guild of shadow magic was thrown into disarray."
                    image="wesnoth-icon.png"
                [/message]
                [message]
                    speaker=narrator
                    message= _ "The remaining members were very grateful and offered Baldras a sizable sum of gold for his help. It was not the help he was hoping for, but he knew it would have to be enough for the coming conflict."
                    image="wesnoth-icon.png"
                [/message]
                [sound]
                    name=gold.ogg
                [/sound]
                [gold]
                    side=1
                    amount=500
                [/gold]
                [set_variable]
                    name=Helicrom_status
                    value=1
                [/set_variable]
            [/then]

            [else]
                [message]
                    speaker=Helicrom
                    message= _ "With the undead driven out, we may live here in relative peace and pursue our studies. For this, Baldras, I am grateful."
                [/message]
                [message]
                    speaker=Baldras
                    message= _ "Studies? Peace? You mean to continue feeding on the lawful citizens of Wesnoth. There will be no peace for them."
                [/message]
                [message]
                    speaker=Helicrom
                    message= _ "No one here is in a position to be dispensing moral judgments. Regardless, you have done great service to us today, and we owe you a debt. I will help you to the utmost of my ability."
                [/message]
                [message]
                    speaker=Helicrom
                    message= _ "I was planning on giving you gold. Any good army is well financed, and with the lich gone we can now spare it."
                [/message]
                [message]
                    speaker=Helicrom
                    message= _ "But, I think it would help you more if I lent you some of my men to join you on your adventures. The Queen has been sending mages out here, and my men are itching for some payback."
                [/message]
                [message]
                    speaker=Helicrom
                    message= _ "On the other hand, if I keep the full force of my organization here, we might be able to regroup and join you on the battlefield when the time comes."
                [/message]
                [message]
                    speaker=Helicrom
                    message= _ "I leave it to you to decide."
                    [option]
                        label= _ "I will take the gold. How does 500 sound?"
                        [command]
                            [message]
                                speaker=Helicrom
                                message= _ "Agreed. Good luck and farewell to you, Master Baldras."
                            [/message]

                            [sound]
                                name=gold.ogg
                            [/sound]

                            [gold]
                                side=1
                                amount=500
                            [/gold]

                            [set_variable]
                                name=Helicrom_status
                                value=1
                            [/set_variable]
                        [/command]
                    [/option]

                    # Note: don't mess with the alignment in the next message key.
                    [option]
                        label= _ "Send your men with us. They will be valuable help as we prepare for the assault from the Wesnoth army garrison."
                        [command]
                            [message]
                                speaker=Helicrom
                                message= _ "Done. My finest mages and thieves are at your disposal. Use them well."
                            [/message]

                            [allow_recruit]
                                side=1
                                type=Thief,Rogue Mage,Shadow Mage
                            [/allow_recruit]

                            [set_variable]
                                name=Helicrom_status
                                value=2
                            [/set_variable]
                        [/command]
                    [/option]
                    [option]
                        label= _ "I wish you to join us in battle against the Queen’s forces."
                        [command]
                            [message]
                                speaker=Helicrom
                                message= _ "All right. I need time to clean up this forest and recall my men from the countryside. We will be ready to march in seven days. All now hinges on you! Until then..."
                            [/message]

                            [set_variable]
                                name=Helicrom_status
                                value=3
                            [/set_variable]
                        [/command]
                    [/option]
                [/message]
            [/else]
        [/if]

        {CLEAR_VARIABLE Helicrom_dead}

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

    #
    # Loss conditions - turns run out
    #
    [event]
        name=time over
        [message]
            speaker=Baldras
            message= _ "We have spent too much time here. Surely the Queen’s forces have returned to Dallben. Our mission is unfinished, but we must return to fight a suicide battle."
        [/message]
        [endlevel]
            result=defeat
        [/endlevel]
    [/event]

    {LIBERTY_DEATHS}

    {VILLAGE_BURNED}

    #
    # Helicrom dies - you don't lose but your benefits are not so good.
    #
    [event]
        name=last breath
        [filter]
            id=Helicrom
        [/filter]
        [message]
            speaker=Helicrom
            message= _ "My men... have failed to protect me! I perish..."
        [/message]
        {VARIABLE Helicrom_dead 1}
    [/event]
[/scenario]
