#textdomain wesnoth-low
#ifdef MULTIPLAYER
[multiplayer]
    random_start_time=no
#ifndef DEBUG_MODE
    allow_new_game=no
#endif
#else
    [scenario]
#endif

        id=23_End_of_War
        name= _ "End of War"
        experience_modifier=100
        {LOW_MAP 23_End_of_War.map}
        {TURNS 24 21 18}

        {DEFAULT_SCHEDULE}

        {INTRO_AND_SCENARIO_MUSIC sad.ogg heroes_rite.ogg}
        {EXTRA_SCENARIO_MUSIC siege_of_laurelmor.ogg}
        {EXTRA_SCENARIO_MUSIC elvish-theme.ogg}
        {EXTRA_SCENARIO_MUSIC weight_of_revenge.ogg}
        {EXTRA_SCENARIO_MUSIC the_city_falls.ogg}
        {EXTRA_SCENARIO_MUSIC breaking_the_chains.ogg}
        {EXTRA_SCENARIO_MUSIC casualties_of_war.ogg}

        next_scenario=24_Epilogue
        [story]
            #TODO that story needs to be changed for multiplayer
            #We have not seen how the war went because it is no longer predictable
            [part]
                # wmllint: local spelling Gitamoth
                story= _ "It is said that the battle with the North Elves was the beginning of the end for Landar’s revolt. But civil war smoldered on for many more years, neither side mustering enough strength to achieve a decisive victory. Until, eventually, Landar’s increasingly harsh and arrogant ways drove away many of his followers. After assembling all the troops he could, Kalenz marched against his old friend and now mortal enemy, Landar, in the forest of Gitamoth..."
                {TO_END_OF_WAR}
            [/part]
        [/story]

        [side]
            {KALENZ}
            {PLAYABLE}
            # wmllint: recognize Kalenz
            extra_recruit=Elvish Fighter, Elvish Archer, Elvish Scout
            {GOLD 200 180 160}
#ifndef MULTIPLAYER
            #TODO Let's keep cleodil out of multiplayer, shall we?
            [unit]
                {CLEODIL}
                extra_recruit=Elvish Shaman, Elvish Scout, Wose
                #wmllint: recognize Cleodil
                placement=leader
            [/unit]
#endif
        [/side]

        [event]
            name=prestart
            {RECALL_LOYALS}
        [/event]

        [side]
            side=2
            {LANDAR}
            controller=ai
            persistent=yes
            save_id=Landar
#ifdef MULTIPLAYER
            {PLAYABLE}
#endif
            # wmllint: recognize Landar
            canrecruit=yes
#ifdef EASY
            recruit=Elvish Archer, Elvish Fighter, Elvish Hero
#endif
#ifdef NORMAL
            recruit=Elvish Archer, Elvish Fighter, Elvish Hero, Elvish Ranger, Elvish Captain, Elvish Marksman
#endif
#ifdef HARD
            recruit=Elvish Archer, Elvish Fighter, Elvish Hero, Elvish Ranger, Elvish Captain, Elvish Marksman, Elvish Avenger, Elvish Sharpshooter
#endif
            team_name=landar
            user_team_name= _ "Enemies"
            [ai]
                {NO_SCOUTS}
                recruitment_ignore_bad_movement=yes
#ifdef EASY
                recruitment_pattern=fighter, archer, fighter
#else
                recruitment_pattern=fighter, archer, mixed fighter
#endif
            [/ai]
            {GOLD 250 520 710}
            {INCOME 4 8 12}
        [/side]

        #### /Side setup ####

        #### Scenario Objectives ####
        [event]
            name=prestart

            [objectives]
                side=1
                [objective]
                    description= _ "Defeat Landar"
                    condition=win
                [/objective]
                [objective]
                    description= _ "Death of Kalenz"
                    condition=lose
                [/objective]
                [objective]
                    description= _ "Death of Cleodil"
                    condition=lose
                [/objective]

                {TURNS_RUN_OUT}

                note={NO_GOLD_CARRYOVER_NOTE}
            [/objectives]
        [/event]

        [event]
            name=start
            [message]
                id=Kalenz
                message= _ "Landar, let us spill no more elvish blood. Give up. We can help you!"
            [/message]
            [message]
                id=Landar
                message= _ "No! It all ends here!"
            [/message]
        [/event]

        [event]
            name=last breath
            # Second_unit (on kalenz's side) kills unit (on landar's side);
            # both came from the player's recall list and so have fought
            # side by side.
            [filter]
                side=2
                role=landar_loyal
            [/filter]
            [filter_second]
                side=1
                role=kalenz_loyal
            [/filter_second]
            [message]
                speaker=second_unit
                message= _ "Forgive me $unit.name|. I will sing your name in praise under the stars!"
            [/message]
            [message]
                speaker=unit
                message= _ "We must all pass, $second_unit.name|. Make your song beautiful..."
            [/message]
        [/event]

        [event]
            name=last breath
            # Same as above but with roles exchanged. One of Landar's men
            # kills his former comrade.
            [filter]
                side=1
                role=kalenz_loyal
            [/filter]
            [filter_second]
                side=2
                role=landar_loyal
            [/filter_second]
            [message]
                speaker=second_unit
                message= _ "Forgive me, $unit.name|, this victory brings me no joy."
            [/message]
            [message]
                speaker=unit
                message= _ "Remember me to the trees, $second_unit.name|."
            [/message]
        [/event]

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

            [message]
                id=Landar
                message= _ "I fall. Perhaps now I can rest!"
            [/message]
            [message]
                id=Kalenz
                message= _ "I am deeply grieved that it came to this, Landar. You were my best friend. I was blind to what the potion was doing to you. I was fighting it myself!"
            [/message]
            [message]
                id=Landar
                message= _ "I know. But you are not at fault, for I did not take just one bottle. I wanted to make sure we could kill the orcish Great Chief, so I went back for a second and drank that one, too. Now I have driven our dwarvish allies away and brought death and disaster to our own people. I have even tried to kill my own friend. I am a disgrace to elven-kind."
            [/message]
            [message]
                id=Kalenz
                message= _ "It was not all your fault. Maybe the curse of Aquagar struck true, or maybe yours was the blood-price fate required of us for victory. Rest well, my friend. Rest well Landar, Hero of the Elves!"
            [/message]
            [endlevel]
                result=victory
                bonus=no
                carryover_report=no
                save=no
                carryover_percentage=0
            [/endlevel]
        [/event]

        {campaigns/Legend_of_Wesmere/utils/deaths.cfg}

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