#textdomain wesnoth-low
#ifdef MULTIPLAYER
[multiplayer]
    description= _ "<i>The Legend of Wesmere</i>\nMultiplayer Campaign\nChapter one"
    random_start_time=no
    allow_new_game=yes
#else
    [scenario]
#endif
        name= _ "The Uprooting"
        id=01_The_Uprooting
        next_scenario=02_Hostile_Mountains

        [item]
            image=scenery/signpost.png
            x=1
            y=1
        [/item]

        experience_modifier=100
        {LOW_MAP  Lintanir.map}
        {LOW_MASK 01_The_Uprooting.mask 1 1}

        {TURNS 20 17 14}

        {INTRO_AND_SCENARIO_MUSIC elf-land.ogg breaking_the_chains.ogg}
        {EXTRA_SCENARIO_MUSIC elvish-theme.ogg}
        {EXTRA_SCENARIO_MUSIC nunc_dimittis.ogg}
        {EXTRA_SCENARIO_MUSIC casualties_of_war.ogg}
        {EXTRA_SCENARIO_MUSIC journeys_end.ogg}
        {EXTRA_SCENARIO_MUSIC silvan_sanctuary.ogg}

        {DEFAULT_SCHEDULE}
        {STARTING_VILLAGES 2 50}

        victory_when_enemies_defeated=no

        [story]
            [part]
                delay=4000
                title= _ "<i>The Legend of Wesmere</i>,
Chapter One"
            [/part]
            [part]
                title= _ "Chapter One,
<i>Flight and fight</i>"
            [/part]
            [part]
                delay=4000
                #show_title=yes
                title= _ "The Uprooting"
                {TO_THE_UPROOTING}
            [/part]
            [part]
                story=_ "The great elven heroes Kalenz and Landar were born in a quiet green wood in Lintanir on the fringes of the Great Northern Forest."
            [/part]
            [part]
                story=_ "Though not of noble birth, Kalenz showed early promise in the arts of his people. His quick intelligence gained him more than usual respect among elders normally inclined to pay little heed to anyone younger than a century old."
                delay=4000
                background="story/characters/kalenz.png"
                scale_background=no
            [/part]
            [part]
                story=_ "Landar and Kalenz were friends from childhood. He too attracted the attention of elders, at first because of a knack for mischief and pranks. But there was no real harm in the boy, and his jokes made him popular among the younger elves."
                delay=4000
                background="story/characters/landar.png"
                scale_background=no
            [/part]
            [part]
                story=_ "Perhaps the elders sensed that changing times would require more flexible minds; these were the years when humans from the Green Isle were establishing themselves south of the Great River, and the known world was changing more rapidly than it had for a thousand years before."
                delay=4000
            [/part]
            [part]
                story=_ "Some changes were good. The Elves, awakened as from a long dream, began to increase in population. But some were very bad, and the worst of those was the coming of the orcs, the wreckers, the tree-killers. The years of their long childhoods were a golden age, and the last time of untroubled peace."
                delay=4000
            [/part]
            [part]
                story=_ "The elves had never been a martial people, and they were not prepared for the inevitable war with the orcs. The friends came of age in the very year that Erlornas of Wesmere fought the first orcish raiders. Within the next decade orcish raids greatly increased, and their shadow loomed ever greater over the elves.

This is the story of Kalenz, Landar, and of the Elves in the first days of the humans in Wesnoth."
                delay=8000
                background="story/landscape-battlefield.jpg"
            [/part]
        [/story]

        #### Kalenz's side ####
#define SINGLEPLAYER_GOLD
    {GOLD 240 200 180}
#enddef

#define MULTIPLAYER_GOLD
    {GOLD 120 100 90}
#enddef

        [side]
            side=1
            fog=no
            shroud=no
            {KALENZ}
            # wmllint: recognize Kalenz
            save_id=Kalenz
            controller=human
            team_name=player
            user_team_name= _ "Player"
            extra_recruit=Elvish Fighter, Elvish Archer
            recruit=""
            x=16
            y=15
#ifndef MULTIPLAYER
            [unit]
                {LANDAR}
                # wmllint: recognize Landar
                extra_recruit=Elvish Fighter, Elvish Archer
                x=18
                y=15
            [/unit]
            {SINGLEPLAYER_GOLD}
#else
            {MULTIPLAYER_GOLD}
#endif
            [unit]
                id=Anduilas
                name= _ "Anduilas"
                unrenamable=yes
                type=Elvish Fighter
                [modifications]
                    {TRAIT_LOYAL}
                    {TRAIT_STRONG}
                    {TRAIT_INTELLIGENT}
                [/modifications]
                {IS_LOYAL}
                placement=leader
            [/unit]
        [/side]

        [event]
            name=last breath
            [filter_second]
                id=Kalenz
            [/filter_second]
            [message]
                speaker=second_unit
                message= _ "You trifled with the wrong elf!"
            [/message]
        [/event]
        [event]
            name=last breath
            [filter_second]
                id=Landar
            [/filter_second]
            [message]
                speaker=second_unit
                message= _ "Take that, you orcish scum!"
            [/message]
        [/event]
        #### /Kalenz side ####

        [side]
            side=2
            {ELF_SETUP}
            village_gold=1
            controller=ai
            allow_player=no
            id=Velon
            name= _ "Velon"
            team_name=player
            user_team_name= _ "Player"
            recruit=Elvish Fighter,Elvish Archer
            {GOLD 100 100 100}
            type=Elvish Captain
            profile="portraits/velon.png"
            canrecruit=yes
            team_name=player
            x=5
            y=15
            [modifications]
                {TRAIT_AGED}
                {TRAIT_INTELLIGENT}
            [/modifications]
            {ai/aliases/stable_singleplayer.cfg}
            [ai]
                {AI_SIMPLE_ALWAYS_ASPECT village_value 0}
                {AI_SIMPLE_ALWAYS_ASPECT leader_value 0}
                {AI_SIMPLE_ALWAYS_ASPECT_VALUE avoid (
                    x=1-30,1-30,1-3,7-30
                    y=1-13,17-30,1-30,1-30
                )}
            [/ai]
        [/side]

        [side]
            side=3
            id=Tbaran
            name= _ "T’baran"
            team_name=orcs
            user_team_name= _ "Enemies"
            allow_player=no
            controller=ai
            {ORC_SETUP}
            #{FLAG_VARIANT undead}
            type=Orcish Warrior
            canrecruit=yes
            x=27
            y=14
#ifdef EASY
            recruit=Orcish Archer, Orcish Assassin, Orcish Grunt, Wolf Rider, Orcish Crossbowman, Goblin Knight, Goblin Pillager
#endif
#ifdef NORMAL
            recruit=Orcish Archer, Orcish Assassin, Orcish Grunt, Wolf Rider, Orcish Crossbowman, Goblin Knight, Goblin Pillager, Orcish Slayer
#endif
#ifdef HARD
            recruit=Orcish Archer, Orcish Assassin, Orcish Grunt, Wolf Rider, Orcish Crossbowman, Goblin Knight, Goblin Pillager, Orcish Slayer, Orcish Warrior
#endif
            {GOLD 100 100 100}
            {INCOME 10 30 50}
            {ai/aliases/stable_singleplayer.cfg}
            [ai]
                {AI_NO_SCOUTS}
                {AI_SCALE_ATTACK_DEPTH_BY_DIFFICULTY}
                {AI_SIMPLE_ALWAYS_ASPECT recruitment_ignore_bad_movement yes}
                {AI_SIMPLE_ALWAYS_ASPECT recruitment_pattern "fighter,fighter,archer,fighter,fighter,mixed fighter,scout"}
                {AI_SIMPLE_ALWAYS_ASPECT aggression 0.75}
                {AI_SIMPLE_ALWAYS_ASPECT caution 0}
                {AI_SIMPLE_ALWAYS_ASPECT grouping no}
            [/ai]
        [/side]

        [side]
            allow_player=no
            controller=ai
            side=4
            id=Wrulf
            name= _ "Wrulf"
            team_name=orcs
            user_team_name= _ "Enemies"
            {ORC_SETUP}
            #{FLAG_VARIANT undead}
            type=Orcish Warrior
            canrecruit=yes
            x=7
            y=29
            recruit=Orcish Archer, Orcish Assassin, Orcish Grunt

            {GOLD 100 100 100}
            {INCOME 10 30 50}
            {ai/aliases/stable_singleplayer.cfg}
            [ai]
                {AI_NO_SCOUTS}
                {AI_SIMPLE_ALWAYS_ASPECT recruitment_ignore_bad_movement yes}
                {AI_SIMPLE_ALWAYS_ASPECT recruitment_pattern "fighter,mixed fighter,archer,mixed fighter"}
                {AI_SIMPLE_ALWAYS_ASPECT grouping no}
                {AI_SCALE_ATTACK_DEPTH_BY_DIFFICULTY}

                {AI_SIMPLE_ALWAYS_ASPECT aggression 0.75}
#ifdef EASY
                {AI_SIMPLE_NIGHT_ASPECT leader_aggression 0.5}
#endif
#ifdef NORMAL
                {AI_SIMPLE_NIGHT_ASPECT leader_aggression -0.5}
#endif

                {AI_SIMPLE_DAY_ASPECT caution 0}
                {MODIFY_AI_ADD_CANDIDATE_ACTION 4 main_loop {AI_CA_POISONING}}
            [/ai]
        [/side]

        [side]
            allow_player=no
            controller=ai
            side=5
            team_name=orcs
            user_team_name= _ "Enemies"
            {ORC_SETUP}
            #{FLAG_VARIANT undead}
            type=Orcish Warrior
            id=Qumseh
            name= _ "Qumseh"
            profile=portraits/orcs/transparent/warlord.png
            canrecruit=yes
            x=28
            y=2
#ifdef EASY
            recruit=Orcish Archer, Orcish Assassin, Orcish Grunt, Wolf Rider, Orcish Crossbowman, Goblin Pillager, Goblin Knight
#endif
#ifdef NORMAL
            recruit=Orcish Archer, Orcish Assassin, Orcish Grunt, Wolf Rider, Orcish Crossbowman, Goblin Knight, Orcish Slayer
#endif
#ifdef HARD
            recruit=Orcish Archer, Orcish Assassin, Orcish Grunt, Wolf Rider, Orcish Crossbowman, Orcish Warrior, Goblin Knight, Goblin Pillager, Orcish Slayer
#endif
            {GOLD 100 100 100}
            {INCOME 10 30 50}
            {ai/aliases/stable_singleplayer.cfg}
            [ai]
                {AI_NO_SCOUTS}
                {AI_SCALE_ATTACK_DEPTH_BY_DIFFICULTY}
                {AI_SIMPLE_ALWAYS_ASPECT recruitment_ignore_bad_movement yes}
                {AI_SIMPLE_ALWAYS_ASPECT recruitment_pattern "scout"}
                {AI_SIMPLE_ALWAYS_ASPECT aggression 0.75}
                {AI_SIMPLE_ALWAYS_ASPECT village_value 0}
                {AI_SIMPLE_ALWAYS_ASPECT caution 0}
                {AI_SIMPLE_ALWAYS_ASPECT grouping no}
            [/ai]
        [/side]
        [side]
            allow_player=no
            controller=ai
            side=6
            team_name=orcs
            user_team_name= _ "Enemies"
            {ORC_SETUP}
            #{FLAG_VARIANT undead}
            type=Orcish Warrior
            id=Graur-Tan
            name= _ "Graur-Tan"
            profile=portraits/orcs/transparent/warlord.png
            canrecruit=yes
            x=2
            y=4
#ifdef EASY
            recruit=Orcish Archer, Orcish Assassin, Orcish Grunt, Wolf Rider, Orcish Crossbowman, Goblin Pillager, Goblin Knight
#endif
#ifdef NORMAL
            recruit=Orcish Archer, Orcish Assassin, Orcish Grunt, Wolf Rider, Orcish Crossbowman, Goblin Knight, Orcish Slayer
#endif
#ifdef HARD
            recruit=Orcish Archer, Orcish Assassin, Orcish Grunt, Wolf Rider, Orcish Crossbowman, Orcish Warrior, Goblin Knight, Goblin Pillager, Orcish Slayer
#endif
            {GOLD 100 100 100}
            {INCOME 10 30 50}
            {ai/aliases/stable_singleplayer.cfg}
            [ai]
                {AI_NO_SCOUTS}
                {AI_SCALE_ATTACK_DEPTH_BY_DIFFICULTY}
                {AI_SIMPLE_ALWAYS_ASPECT recruitment_ignore_bad_movement yes}
                {AI_SIMPLE_ALWAYS_ASPECT recruitment_pattern "fighter,scout,fighter,fighter,archer,scout,mixed fighter"}
                {AI_SIMPLE_ALWAYS_ASPECT aggression 0.75}
                {AI_SIMPLE_ALWAYS_ASPECT caution 0}
                {AI_SIMPLE_ALWAYS_ASPECT grouping no}
            [/ai]
        [/side]

#ifdef MULTIPLAYER
        [side]
            side=7
            fog=no
            shroud=no
            {LANDAR}
            save_id=Landar
            controller=human
            team_name=player
            user_team_name= _ "Player"
            extra_recruit=Elvish Fighter, Elvish Archer
            recruit=""
            {MULTIPLAYER_GOLD}
            x=18
            y=15
            [unit]
                #TODO give him a name after the string frezze.
                id=Landulias
                generate_name=yes
                unrenamable=yes
                type=Elvish Archer
                gender=female
                [modifications]
                    #TODO rethink them
                    {TRAIT_DEXTROUS}
                    {TRAIT_LOYAL}
                    {TRAIT_INTELLIGENT}
                [/modifications]
                {IS_LOYAL}
                placement=leader
            [/unit]
        [/side]
#endif

        [event]
            name=start

            [message]
                id=Kalenz
                message= _ "Orcs are pressing on us from all directions! To arms!"
            [/message]
            [message]
                id=Velon
                message= _ "Hold, Kalenz. The Ka’lian council should discuss our response. Maybe we can reach an agreement with them!"
            [/message]
            [message]
                id=Qumseh
                message= _ "Surrender or die, tree-shaggers!"
            [/message]
            [message]
                id=Velon
                message= _ "They are too many. We have no choice but to submit!"
            [/message]
            [message]
                id=Kalenz
                message= _ "Elves must never surrender to these foul beasts! Who will fight them beside me?"
            [/message]
            [message]
                #Changed the text from here on - The objectives changed from
                #reaching the signpost and bonus for the death of a leader
                #to death of an enemy leader for victory and bonus for not
                #loosing velon.
                id=Landar
                message= _ "We will follow you, Kalenz — but where can we go?"
            [/message]
            [message]
                id=Kalenz
                message= _ "We must reach the elvish council in Ka’lian and enlist their help to recapture our home."
            [/message]
            [message]
                id=Landar
                message= _ "We are surrounded!"
            [/message]
            [message]
                id=Kalenz
                message= _ "Then we must storm one of the orcs’ outposts to break the encirclement before more enemies arrive!"
            [/message]
            [message]
                id=Anduilas
                message= _ "Very well, Kalenz — lead us!"
            [/message]

            [scroll_to_unit]
                id=Kalenz
            [/scroll_to_unit]
        [/event]

        [event]
            name=start

            [objectives]
                side=0
                [objective]
                    description= _ "Kill any of the orc leaders"
                    condition=win
                [/objective]
                [objective]
                    {BONUS_OBJECTIVE_CAPTION}
                    description= _ "Keep Velon alive"+{EARLY_FINISH_BONUS_FOOTNOTE}
                    condition=win
                [/objective]
                [objective]
                    description= _ "Death of Kalenz"
                    condition=lose
                [/objective]
                [objective]
                    description= _ "Death of Landar"
                    condition=lose
                [/objective]

                {TURNS_RUN_OUT}

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

        [event]
            name=attack
            [filter_second]
                side=2
            [/filter_second]

            {INCIDENTAL_MUSIC the_king_is_dead.ogg}

            [message]
                id=Velon
                message= _ "We surrender!"
            [/message]
            [message]
                id=Graur-Tan
                message= _ "Did I mention that we take no prisoners? Die!"
            [/message]
            #TODO Maybe that must change for multiplayer
            [message]
                id=Velon
                message= _ "Kalenz was right and I was wrong. Go; join Kalenz while yet you can. I and the remaining elders will cover your retreat as best we may."
            [/message]

#ifndef MULTIPLAYER
            {MODIFY_UNIT (side=2) side 1 }
            #TODO think about it
            #{MODIFY_UNIT (id=Velon) canrecruit no}
            {TRANSFER_VILLAGE_OWNERSHIP 2 1}
#endif
        [/event]

        [event]
            name=victory
            [message]
                id=Velon
                message= _ "Flee, Kalenz... find vengeance for us!"
            [/message]
            [message]
                id=Kalenz
                message= _ "Velon, I swear on the life of Irdya that I will not let you be forgotten while elves yet draw breath to sing."
                [show_if]
                    [have_unit]
                        id=Velon
                    [/have_unit]
                [/show_if]
            [/message]
            [message]
                id=Velon
                message= _ "Swords will aid us more than songs, Kalenz; you saw that before I."
            [/message]
            [message]
                id=Kalenz
                message= _ "Swordsmen you shall have, as swiftly as I can find them and return."
                [show_if]
                    [have_unit]
                        id=Velon
                    [/have_unit]
                [/show_if]
            [/message]

            [message]
                id=Kalenz
                message= _ "Velon has fallen. He counseled weakness, but did not deserved such an ugly death. We shall return with swords to avenge him!"
                [show_if]
                    [not]
                        [have_unit]
                            id=Velon
                        [/have_unit]
                    [/not]
                [/show_if]
            [/message]

            [message]
                canrecruit=yes
                race=orc
                message= _ "You won’t get very far! After them!"
            [/message]
            [kill]
                id=Velon
                animate=no
            [/kill]
        [/event]

        [event]
            name=last breath
            [filter]
                canrecruit=yes
                race=orc
            [/filter]

            [message]
                speaker=unit
                message= _ "Curse you, tree-shaggers! We will feed your young to our wolves!"
            [/message]
        [/event]

        [event]
            name=die
            [filter]
                canrecruit="yes"
                race=orc
            [/filter]

            [message]
                speaker=second_unit
                message= _ "What is this? The orc held plunder!"
            [/message]
#ifdef MULTIPLAYER
            {LOOT 25 1}
            {LOOT 25 7}
#else
            {LOOT 50 1}
#endif

            [if]
                [have_unit]
                    id=Velon
                [/have_unit]
                [then]
                    [endlevel]
                        result=victory
                        bonus=yes
                        {NEW_GOLD_CARRYOVER 40}
                    [/endlevel]
                [/then]
                [else]
                    [endlevel]
                        result=victory
                        bonus=no
                        {NEW_GOLD_CARRYOVER 40}
                    [/endlevel]
                [/else]
            [/if]
        [/event]

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

            {INCIDENTAL_MUSIC sad.ogg}
            [message]
                id=Velon
                message= _ "Flee, Kalenz... Our hopes ride with you..."
            [/message]
        [/event]

        {campaigns/Legend_of_Wesmere/utils/deaths.cfg}

#ifndef MULTIPLAYER
    [/scenario]
#else
[/multiplayer]
#endif

#undef MULTIPLAYER_GOLD
#undef SINGLEPLAYER_GOLD
