#textdomain wesnoth-httt
[scenario]
    id=24_Battle_for_Wesnoth
    name= _ "The Battle for Wesnoth"
    map_data="{campaigns/Heir_To_The_Throne/maps/24_Battle_for_Wesnoth.map}"
    turns=60

    {DEFAULT_SCHEDULE}

    next_scenario=25_HttT_Epilogue

    {INTRO_AND_SCENARIO_MUSIC "revelation.ogg" "battle-epic.ogg"}
    {EXTRA_SCENARIO_MUSIC "battle.ogg"}
    {EXTRA_SCENARIO_MUSIC "vengeful.ogg"}
    {EXTRA_SCENARIO_MUSIC "siege_of_laurelmor.ogg"}
    {EXTRA_SCENARIO_MUSIC "legends_of_the_north.ogg"}
    {EXTRA_SCENARIO_MUSIC "suspense.ogg"}
    {EXTRA_SCENARIO_MUSIC "the_city_falls.ogg"}

    {HTTT_TRACK {JOURNEY_24_NEW} }

    [event]
        name=prestart
        [objectives]
            side=1
            [objective]
                description= _ "Defeat Asheviere"
                condition=win
            [/objective]
            [objective]
                description= _ "Death of Konrad"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Delfador"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Li’sar"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Kalenz"
                condition=lose
            [/objective]

            {TURNS_RUN_OUT}
            {IS_LAST_SCENARIO}
        [/objectives]
    [/event]

    [story]
        [part]
            story= _ "Here we overlook the city of Weldyn. The great city. The ancient city. The city of evil. The city of good. The city of men."
            background=story/arrival_of_the_heir.png
        [/part]
        [part]
            story= _ "I have not looked upon this city for seventeen years. Seventeen years ago, when I should have been at the height of my power. But my strength failed me. I failed, and I cannot atone for it."
            background=story/arrival_of_the_heir.png
        [/part]
        [part]
            story= _ "The battle had been long and hard. We had been defeated. Eldred was slain, but I knew that Asheviere’s wrath would be great. That many innocents would be slain. I had to save the monarchy. I had to save the princes. I made haste to Weldyn, before the guards of Asheviere could get there, to carry out their evil orders."
            background=story/arrival_of_the_heir.png
        [/part]
        [part]
            story= _ "But I failed. I was too late. I entered the chambers of the youngest prince, Prince Konrad, just as one of the evil ones ran him through. All was lost. The heirs were slain. Only Asheviere and her daughter had any claim to the throne."
            background=story/arrival_of_the_heir.png
        [/part]
        [part]
            story= _ "Of course, you are surprised by this, but it is the truth. In haste, I vanquished the evil ones who had committed this foul deed. Then I took the little prince’s broken body, and away I rode. Far away, to the land of the elves."
            background=story/arrival_of_the_heir.png
        [/part]
        [part]
            # wmllint: local spelling Parandra
            story= _ "By strange and mysterious fortune, the Elf Lady Parandra had come across a human child. She knew not where he had come from, only that the orcs would have eaten him if it weren’t for her intervention. The elves felt that great fortune smiled upon this man-child. Perhaps that is why this most truthful of peoples agreed to my plan."
            background=story/arrival_of_the_heir.png
        [/part]
        [part]
            story= _ "After burying the little prince, we agreed never to speak of him again. Instead, this orphan child we would call Konrad, and he would be brought up to be king. I would say that I had slain the guards before they had carried out their evil deed, instead of after. No one would ever have to know. And no one did know for certain, until now."
            background=story/arrival_of_the_heir.png
        [/part]
        [part]
            story= _ "I had thought that we could one day make you king, Konrad. But now I see that fate has made a different choice. That despite all of Asheviere’s evil, this Li’sar is fit for the throne. She is the rightful queen, from a long line of kings, stretching all the way back to the seafarers of old from the west."
            background=story/arrival_of_the_heir.png
        [/part]
        [part]
            story= _ "Now, let us not tarry here any longer! The dawn breaks! The time has come for the heir to the throne to claim it!"
            background=story/arrival_of_the_heir.png
        [/part]
    [/story]

    {HTTT_TRACK {JOURNEY_24_NEW} }

    [side]
        type=Commander
        id=Konrad
        name= _ "Konrad"
        unrenamable=yes
        profile=portraits/konrad-human.png
        side=1
        canrecruit=yes
        controller=human
        gold=400
        team_name=elves
        user_team_name=_"Rebels"
        {FLAG_VARIANT long}
    [/side]

    [side]
        type=Orcish Warlord
        id=Haliel-Maga
        name= _ "Haliel-Maga"
        side=2
        canrecruit=yes
        recruit=Orcish Warrior,Goblin Knight,Goblin Pillager,Orcish Crossbowman,Orcish Assassin,Troll
        gold=300
        [ai]
            {ATTACK_DEPTH 5 5 6}
            recruitment_pattern=scout,fighter,mixed fighter,archer
        [/ai]
        team_name=evil
        user_team_name=_"Asheviere"
        {FLAG_VARIANT6 ragged}
    [/side]

    [side]
        type=General
        id=Heford
        name= _ "Heford"
        side=3
        canrecruit=yes
        recruit=Horseman,Dragoon,Royal Guard,Longbowman,Heavy Infantryman
        [ai]
            {ATTACK_DEPTH 5 5 6}
        [/ai]
        team_name=evil
        user_team_name=_"Asheviere"
        {GOLD 175 300 400}
        {FLAG_VARIANT loyalist}
    [/side]

    [side]
        type=Cavalier
        id=Sir Kalm
        name= _ "Sir Kalm"
        side=4
        canrecruit=yes
        recruit=Horseman,Dragoon,Cavalier,Cavalryman
        [ai]
            recruitment_pattern=scout,fighter
            {ATTACK_DEPTH 5 5 6}
        [/ai]
        team_name=evil
        user_team_name=_"Asheviere"
        {GOLD 175 300 400}
        {FLAG_VARIANT loyalist}
    [/side]

    [side]
        type=Dark Queen
        id=Asheviere
        name= _ "Asheviere"
        side=5
        canrecruit=yes
        recruit=Royal Guard,Heavy Infantryman,Dragoon,Longbowman,Duelist,Halberdier
        {GOLD 300 400 500}
        [ai]
            {ATTACK_DEPTH 5 6 6}
        [/ai]
        team_name=evil
        user_team_name=_"Asheviere"
        {FLAG_VARIANT loyalist}
    [/side]

    # Asheviere gets all the villages around Weldyn.
    {STARTING_VILLAGES 5 40}

    [event]
        name=prestart

        [if]
            [variable]
                name=clan_bayar
                numerical_equals=1
            [/variable]
            [then]
                {NAMED_LOYAL_UNIT 1 (Grand Knight) 39 4 (Lord Bayar) (_ "Lord Bayar")}
            [/then]
        [/if]
        [if]
            [variable]
                name=clan_daryn
                numerical_equals=1
            [/variable]
            [then]
                {NAMED_LOYAL_UNIT 1 (Grand Knight) 39 3 (Sir Daryn) (_ "Sir Daryn")}
            [/then]
        [/if]
        [if]
            [variable]
                name=clan_ruga
                numerical_equals=1
            [/variable]
            [then]
                {NAMED_LOYAL_UNIT 1 (Grand Knight) 39 9 (Sir Ruga) (_ "Sir Ruga")}
            [/then]
        [/if]
        [if]
            [variable]
                name=clan_alric
                numerical_equals=1
            [/variable]
            [then]
                {NAMED_LOYAL_UNIT 1 (Grand Knight) 39 8 (Sir Alric) (_ "Sir Alric")}
            [/then]
        [/if]

        {NEED_DELFADOR placement=leader}
        {NEED_KALENZ placement=leader}
        {NEED_LISAR placement=leader}
        [role]
            type=Grand Knight
            side=1
            role=clanboss
        [/role]
    [/event]

    [event]
        name=start

        [message]
            speaker=Asheviere
            message= _ "So, these rebels come at last to face me, while most of my army is off fighting the fickle clans."
        [/message]
        [message]
            role=clanboss
            message= _ "Wretched wench. Your army is tasting death as we speak. The clans have arrived to unseat you, pretender!"
        [/message]
        [message]
            speaker="Li'sar"
            message= _ "Surrender, mother. The land’s blood is spent. I have come to take my rightful place."
        [/message]
        [message]
            speaker=Asheviere
            message= _ "Ahh. My own daughter, a turncoat. So it is true. Such treason my reign must endure! But endure it will."
        [/message]
        [message]
            speaker=Delfador
            message= _ "How long must the people endure your rule? Give the throne to your daughter. She is the rightful heir. We even hold the Sceptre to prove it!"
        [/message]
        [message]
            speaker=Asheviere
            {ASHEVIERE_VARIATION mad}
            message= _ "Delfador! My old tormentor! Treason! Men! Seize them! Kill them! Kill them all!"
        [/message]
    [/event]

    [event]
        name=attacker_hits
        [filter]
            [not]
                type=Gryphon

                [or]
                    id="Li'sar"
                [/or]

                [or]
                    id=Delfador
                [/or]
            [/not]
        [/filter]
        [filter_second]
            id=Asheviere
        [/filter_second]
        [message]
            speaker=unit
            message= _ "Take this, witch!"
        [/message]
    [/event]

    [event]
        name=last breath

        [filter]
            id=Asheviere
        [/filter]

        [object]
            silent=yes

            [filter]
                id=Asheviere
            [/filter]

            [effect]
                apply_to=variation
                name=defeated
            [/effect]
        [/object]

        [delay]
            time=1
        [/delay]

        [animate_unit]
            flag=drop

            [filter]
                id=Asheviere
            [/filter]
        [/animate_unit]
    [/event]

    [event]
        name=last breath
        [filter]
            id=Asheviere
        [/filter]
        [filter_second]
            id="Li'sar"
        [/filter_second]
        [message]
            speaker="Li'sar"
            message= _ "Mother, I swore to end your reign of evil, and now I shall."
        [/message]
        [message]
            speaker=Asheviere
            {ASHEVIERE_VARIATION defeated}
            message= _ "Daughter, I built this kingdom for you. It has all been for you!"
        [/message]
        [message]
            speaker="Li'sar"
            {LISAR_VARIATION mad}
            message= _ "Even now, can you not tell the truth? Your greed has corrupted your soul. You are a monster! A murderess! It pains me to kill you, mother, but you have chosen your own fate. For Wesnoth!"
        [/message]
        [message]
            speaker=narrator
            image="wesnoth-icon.png"
            message= _ "Li’sar strikes a killing blow!"
        [/message]
    [/event]

    [event]
        name=last breath
        [filter]
            id=Asheviere
        [/filter]
        [filter_second]
            id=Konrad
        [/filter_second]
        [message]
            speaker=Konrad
            message= _ "You have hunted me across the countryside, indeed across the years. Here I am, Dark Queen."
        [/message]
        [message]
            speaker=Asheviere
            {ASHEVIERE_VARIATION defeated}
            message= _ "I was sure I had killed you, yet you haunt me still. Be gone, demon! I banish you, ghost!"
        [/message]
        [message]
            speaker=Konrad
            {KONRAD_VARIATION mad}
            message= _ "Oh, wretched lady, I am very real. The land has suffered from your greed and ambition. You will now be held to account for your misdeeds. For the young Prince Konrad! For WESNOTH!"
        [/message]
        [message]
            speaker=narrator
            image="wesnoth-icon.png"
            message= _ "Konrad strikes a killing blow!"
        [/message]
    [/event]

    [event]
        name=last breath
        [filter]
            id=Asheviere
        [/filter]
        [filter_second]
            id=Delfador
        [/filter_second]
        [message]
            speaker=Delfador
            message= _ "As I destroyed your son, I now destroy you."
        [/message]
        [message]
            speaker=Asheviere
            {ASHEVIERE_VARIATION defeated}
            message= _ "You were always defiant, wizard, and no one has thwarted my plans as determinedly as you."
        [/message]
        [message]
            speaker=Delfador
            message= _ "I have always been a humble servant of the Crown, and remain such even now."
        [/message]
        [message]
            speaker=Asheviere
            {ASHEVIERE_VARIATION defeated}
            message= _ "Delfador! You utterly disgust me, you sniveling worm. How dare you confront me, your queen?"
        [/message]
        [message]
            speaker=Delfador
            # wmllint: local spelling Archmagi
            message= _ "How dare I? I, High Provost of the Council of Archmagi..."
        [/message]
        [message]
            speaker=Delfador
            # wmllint: local spelling An-Usrukhar
            message= _ "... bearer of the staff of An-Usrukhar, guardian of the book of Crelanu ..."
        [/message]
        [message]
            speaker=Delfador
            message= _ "... Mage Protector of The Kingdom Of The Peoples Of The West-North, Chief Advisor to the <i>Crown</i>..."
        [/message]
        [message]
            speaker=Delfador
            message= _ "... and personal counselor to my King and my <i>friend</i>, Garard the Second, whom you most <i>foully</i> betrayed..."
        [/message]
        [message]
            speaker=Delfador
            {DELFADOR_VARIATION mad}
            message= _ "I am Delfador the Great and TODAY YOU MEET YOUR ATONEMENT!"
        [/message]
        [message]
            speaker=narrator
            image="wesnoth-icon.png"
            message= _ "In a horrific inferno of magical rage, Asheviere is completely annihilated!"
        [/message]

        [scroll_to_unit]
            id=Delfador
        [/scroll_to_unit]
        [color_adjust]
            red=-100
            green=-100
            blue=-100
        [/color_adjust]
        [sound]
            name=fire.wav
        [/sound]
        [color_adjust]
            red=200
            green=0
            blue=0
        [/color_adjust]
        [sound]
            name=lightning.ogg
        [/sound]
        [color_adjust]
            red=100
            green=100
            blue=150
        [/color_adjust]
        [color_adjust]
            red=0
            green=0
            blue=0
        [/color_adjust]
    [/event]

    [event]
        name=last breath
        [filter]
            id=Asheviere
        [/filter]
        [filter_second]
            [not]
                id=Konrad

                [or]
                    id="Li'sar"
                [/or]

                [or]
                    id=Delfador
                [/or]
            [/not]
        [/filter_second]
        [message]
            speaker=Asheviere
            {ASHEVIERE_VARIATION defeated}
            message= _ "Treason! The evil ones have slain me!"
        [/message]
    [/event]

    # Workaround for a bug which might cause the die animation to get skipped
    [event]
        name=last breath

        [filter]
            id=Asheviere
        [/filter]

        [delay]
            time=1
        [/delay]
    [/event]

    [event]
        name=die

        [filter]
            id=Asheviere
        [/filter]

        [music]
            name="main_menu.ogg"
            immediate=yes
            append=no
        [/music]
        [message]
            speaker=Delfador
            message= _ "And so passes Asheviere, the dark queen of Wesnoth."
        [/message]
        [message]
            speaker=Konrad
            message= _ "We have won at last! Li’sar! You will be queen!"
        [/message]
        [message]
            speaker="Li'sar"
            message= _ "Yes, but I won’t ever forget what you have done for me, Konrad, Delfador, and Kalenz."
        [/message]
        [message]
            speaker=Kalenz
            message= _ "So much blood. So much death. For what? A title?"
        [/message]
        [message]
            speaker="Li'sar"
            message= _ "For justice, Elf Lord. We fight because if we do not, evil would prevail. But, I implore you to let the dead have their rest. We have taken victory. Tomorrow is a new day, friends... let us build this kingdom anew."
        [/message]
        [endlevel]
            result=victory
            carryover_report=no
            save=no
        [/endlevel]
    [/event]

    {campaigns/Heir_To_The_Throne/utils/deaths.cfg}
[/scenario]
