#textdomain wesnoth-Genesis

[scenario]
    id=20_Royal_Palace
    name= _ "Royal Palace"
    map_data="{~add-ons/Genesis/episode1/maps/20a_Royal_Palace.map}"
    next_scenario=21_Ashen_Hearts
    disallow_recall=yes
    victory_when_enemies_defeated=no
    turns=-1
    {DEFAULT_SCHEDULE_24H}

    {SCENARIO_MUSIC knolls.ogg}
    {EXTRA_SCENARIO_MUSIC nunc_dimittis.ogg}
    {EXTRA_SCENARIO_MUSIC siege_of_laurelmor.ogg}
    {STORYTXT_ROYAL_PALACE}

    [side]
        {PLAYER_FAE}
        {NO_GOLD_SIDE}
        side=1
        recruit=
        shroud=yes
    [/side]

    [side]
        {HUMAN_ENEMY}
        side=2
        no_leader=yes
    [/side]

    [side]
        side=3
        no_leader=yes
        team_name=humans
        color=white
        user_team_name= _ "team_name^Magi"
    [/side]

    [side]
        {YUURE_SIDE}
        side=4
        hidden=yes
    [/side]

    [event]
        name=prestart

        {GUARDIAN_ID ("Swordsman") 2 21 27 ("guard1") ("male")}
        {GUARDIAN_ID ("Swordsman") 2 23 27 ("guard2") ("male")}
        {GUARDIAN_NOID ("Shock Trooper") 2 37 9}
        {GUARDIAN_ID ("Shock Trooper") 2 38 9 ("loreguard") ("male")}
        {GUARDIAN_NOID ("Shock Trooper") 2 16 10}
        {GUARDIAN_NOID ("Shock Trooper") 2 22 16}
        {GUARDIAN_NOID ("Swordsman") 2 23 11}
        {GUARDIAN_NOID ("Swordsman") 2 16 16}
        {GUARDIAN_ID ("Royal Guard") 2 12 11 ("gardenguard") ("male")}
        {GUARDIAN_NOID ("Swordsman") 2 17 8}
        {GUARDIAN_NOID ("Swordsman") 2 19 8}
        {GUARDIAN_NOID ("Royal Guard") 2 10 3}
        {GUARDIAN_NOID ("Royal Guard") 2 17 3}
        {GUARDIAN_NOID ("Royal Guard") 2 19 3}

        # magi spawn
        {GUARDIAN_NOID ("Red Mage") 3 15 5}
        {GUARDIAN_NOID ("Red Mage") 3 21 5}
        {GUARDIAN_ID ("Red Mage") 3 18 3 ("palacemage") ("male")}

        [set_recruit]
            side=1
            recruit=
        [/set_recruit]

        [store_unit]
            [filter]
                id=Talya
            [/filter]
            variable=talya
        [/store_unit]
        [store_unit]
            [filter]
                id=Esther
            [/filter]
            variable=esther
        [/store_unit]
        [store_unit]
            [filter]
                id=Haart
            [/filter]
            variable=haart
        [/store_unit]
        [kill]
            id=Talya,Esther,Haart
        [/kill]
        [unstore_unit]
            variable=aryel
            x,y=25,33
        [/unstore_unit]
        [unstore_unit]
            variable=yumi
            x,y=26,33
        [/unstore_unit]
        {CLEAR_VARIABLE aryel}
        {CLEAR_VARIABLE yumi}

        [set_variable]
            name=part1
            value=1
        [/set_variable]
        [set_variable]
            name=part2
            value=0
        [/set_variable]
    [/event]

    [event]
        name=start

        [message]
            speaker=Aryel
            message= _ "Alright, Yumi. When we get up to the palace, let me do the talking. Like Esther said before, we should sort this out without fighting them if possible. If that doesn't work, we'll take them together."
        [/message]
        [message]
            speaker=Yumi
            message= _ "(nods)"
        [/message]
        [move_unit]
            id=Aryel
            to_x,to_y=24,29
        [/move_unit]
        [move_unit]
            id=Yumi
            to_x,to_y=25,30
        [/move_unit]
        [redraw]
            side=1
            clear_shroud=yes
        [/redraw]
        [message]
            speaker=guard1
            message= _ "Halt! Who goes th- faeries!"
        [/message]
        [message]
            speaker=Aryel
            message= _ "We're not here to fight-"
        [/message]
        [message]
            speaker=guard2
            message= _ "The faeries have returned! To arms, to arms!"
        [/message]
        [message]
            speaker=Aryel
            message= _ "(sighs) So much for that. I blew it already. Looks like we've got to fight our way to the palace."
        [/message]

        {PLACE_IMAGE items/chest.png 37 27}
        {PLACE_IMAGE items/crystal-glyph-message.png 37 4}
        {PLACE_IMAGE items/crystal-glyph-message.png 41 4}
        {PLACE_IMAGE items/crystal-glyph-message.png 37 2}
        {PLACE_IMAGE items/crystal-glyph-message.png 41 2}

        [objectives]
            {OBJECTIVE_VICTORY  ( _ "Reach the Royal Palace")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Aryel")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Yumi")}
            {OBJECTIVE_NOTE ( _ "There are a few small bonuses that can be obtained on this map.")}
        [/objectives]
    [/event]

    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            id=Aryel
            [filter_location]
                x=37,37,41,41
                y=2,4,2,4
            [/filter_location]
        [/filter]

        [message]
            speaker=Aryel
            message= _ "I can't understand this. Maybe Yumi should take a look at these glyphs."
        [/message]
    [/event]
    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            id=Yumi
            x,y=37,4
        [/filter]

        [message]
            speaker=narrator
            message= _ "There are ten elements of creation. Ten Guardians govern each of these elements, with ten worlds imbued with their corresponding Seeds. These Guardians guide and protect creation, serving as the stewards of progress toward a perfect universe. This is their purpose, as dictated by the caretaker of the Tree of Life, Yarae."
        [/message]
    [/event]
    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            id=Yumi
            x,y=41,4
        [/filter]

        [message]
            speaker=narrator
            message= _ "The Tree of Life is a mythical entity that contains all aspects of creation. It provides the energy for nearly all life in the current universe, and imbues most living beings with their respective souls. Legends say that at the end of their civilization, the First Gods created the Tree of Life as a means to create a new universe after the destruction of their own."
        [/message]
    [/event]
    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            id=Yumi
            x,y=41,2
        [/filter]

        [message]
            speaker=narrator
            message= _ "The void refers to both the empty space between worlds, as well as that which lies outside of creation itself. Encompassed within it is an eponymous force that is the antithesis of creation. Where there is creation, there is destruction. As all can be made, all can be lost. It is a force that, when released completely, can utterly annihilate anything."
        [/message]
    [/event]
    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            id=Yumi
            x,y=37,2
        [/filter]

        [message]
            speaker=narrator
            message= _ "When the first few Guardians were created, Yarae shared the story of creation with them. He spoke of how his civilization was destroyed by a cataclysmic force, how he and a few others used the entirety of their culture's knowledge to create the Tree of Life. They used its energies to bring forth a new universe, which Yarae personally guided in its infancy."
        [/message]
        [message]
            speaker=narrator
            message= _ "He told them this story in hopes that they would aid him in a quest to stop the new universe from falling to the same fate as the old one. This is the story of creation as told by Yarae, the grand architect of the new universe."
        [/message]
    [/event]

    [event]
        name=moveto
        [filter]
            side=1
            id=Aryel
            [filter_location]
                x,y=5,27
                radius=1
            [/filter_location]
        [/filter]
        [filter_condition]
            [variable]
                name=part1
                numerical_equals=1
            [/variable]
        [/filter_condition]

        [message]
            speaker=Aryel
            message= _ "(washes hair)"
        [/message]
    [/event]
    [event]
        name=moveto
        [filter]
            side=1
            id=Yumi
            [filter_location]
                x,y=5,27
                radius=1
            [/filter_location]
        [/filter]
        [filter_condition]
            [variable]
                name=part1
                numerical_equals=1
            [/variable]
        [/filter_condition]

        [message]
            speaker=Yumi
            message= _ "(stares at reflection)"
        [/message]
    [/event]
    [event]
        name=moveto
        [filter]
            side=1
            x,y=37,27
        [/filter]
        [filter_condition]
            [variable]
                name=part1
                numerical_equals=1
            [/variable]
        [/filter_condition]

        [message]
            speaker=Aryel
            message= _ "Shiny. I guess this could be useful."
        [/message]

        [message]
            speaker=narrator
            message= _ "You received some gold!"
        [/message]
        [store_gold]
            [filter_side]
                side=1
            [/filter_side]
            variable=side1gold
        [/store_gold]
        {VARIABLE_OP side1gold add 100}
        [modify_side]
            side=1
            gold=$side1gold
        [/modify_side]
        {CLEAR_VARIABLE side1gold}
        {REMOVE_IMAGE 37 27}
    [/event]
    [event]
        name=moveto
        [filter]
            side=1
            id=Aryel
            x,y=6,10
        [/filter]
        [filter_condition]
            [variable]
                name=part1
                numerical_equals=1
            [/variable]
        [/filter_condition]

        [message]
            speaker=Aryel
            message= _ "It's so warm! This tree is filled with energy."
        [/message]

        [store_unit]
            [filter]
                id=Aryel
            [/filter]
            variable=aryel
        [/store_unit]
        {VARIABLE_OP aryel.max_hitpoints add 3}
        [unstore_unit]
            variable=aryel
            find_vacant=no
        [/unstore_unit]
        {CLEAR_VARIABLE aryel}

        [message]
            speaker=Aryel
            message= _ "I feel different."
        [/message]
    [/event]
    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
        [/filter]

        [if]
            [have_unit]
                side=2,3,4,5,6
                [filter_vision]
                    side=1
                [/filter_vision]
            [/have_unit]
            [then][/then]
            [else]
                {MODIFY_UNIT (x,y=$x1,$y1) moves 6}
                {MODIFY_UNIT (x,y=$x1,$y1) attacks_left 1}
            [/else]
        [/if]
    [/event]

    [event]
        name=moveto

        [filter]
            x,y=18,1
            side=1
        [/filter]
        [filter_condition]
            [variable]
                name=part1
                numerical_equals=1
            [/variable]
        [/filter_condition]
        [set_variable]
            name=part1
            value=0
        [/set_variable]

        [message]
            speaker=Aryel
            message= _ "You ready?"
        [/message]
        [message]
            speaker=Yumi
            message= _ "(nods)"
        [/message]
        {DELAY 500}
        [store_unit]
            [filter]
                id=Aryel
            [/filter]
            variable=aryel
        [/store_unit]
        [store_unit]
            [filter]
                id=Yumi
            [/filter]
            variable=yumi
        [/store_unit]
        [kill]
            id=Aryel,Yumi
        [/kill]
        [kill]
            side=2,3,4,5,6
        [/kill]
        {FADE_SCREEN}
        {DELAY 550}
        {PLAY_SOUND "dragonstick.ogg"}
        {DELAY 750}
        {REMOVE_IMAGE 37 27}
        {REMOVE_IMAGE 37 4}
        {REMOVE_IMAGE 41 4}
        {REMOVE_IMAGE 37 2}
        {REMOVE_IMAGE 41 2}

        [replace_map]
            map="{~add-ons/Genesis/episode1/maps/20b_Royal_Palace.map}"
            expand=yes
            shrink=yes
        [/replace_map]
        [place_shroud]
            side=1
            x=1-24
            y=1-26
        [/place_shroud]

        {GUARDIAN_ID "Shock Trooper" 2 12 22 "spawn_12_22" "male"}
        {GUARDIAN_NOID "Swordsman" 2 7 20}
        {GUARDIAN_NOID "Swordsman" 2 17 20}
        {GUARDIAN_NOID "Shock Trooper" 2 12 17}
        {GUARDIAN_NOID "Swordsman" 2 11 17}
        {GUARDIAN_NOID "Swordsman" 2 13 17}
        {GUARDIAN_NOID "Longbowman" 2 7 15}
        {GUARDIAN_NOID "Longbowman" 2 17 15}
        {GUARDIAN_NOID "Longbowman" 2 16 9}
        {GUARDIAN_NOID "Longbowman" 2 8 9}
        {GUARDIAN_NOID "Shock Trooper" 2 12 9}
        {GUARDIAN_NOID "Swordsman" 2 11 9}
        {GUARDIAN_NOID "Swordsman" 2 13 9}
        {GUARDIAN_NOID "Royal Guard" 2 9 4}
        {GUARDIAN_ID "Royal Guard" 2 12 5 "spawn_12_5" "male"}
        {GUARDIAN_NOID "Royal Guard" 2 15 4}

        [unit]
            side=3
            id=mageoflight20
            generate_name=yes
            type=Mage of Light
            random_traits=no
            animate=yes
            [modifications]
                {TRAIT_LOYAL}
                {TRAIT_RESILIENT}
                {TRAIT_QUICK}
            [/modifications]
            random_gender=yes
            ai_special=guardian
            x,y=10,2
        [/unit]
        [unit]
            side=3
            id=archmage20
            generate_name=yes
            type=Arch Mage
            random_traits=no
            animate=yes
            [modifications]
                {TRAIT_LOYAL}
                {TRAIT_RESILIENT}
                {TRAIT_QUICK}
            [/modifications]
            random_gender=yes
            ai_special=guardian
            x,y=14,2
        [/unit]

        [unstore_unit]
            variable=aryel
            x,y=14,24
            find_vacant=no
            advance=no
        [/unstore_unit]
        {SCROLL_TO 14 24}
        [redraw]
            side=1
            clear_shroud=yes
        [/redraw]
        [kill]
            id=Aryel
        [/kill]

        {UNFADE_SCREEN}

        [unstore_unit]
            variable=aryel
            x,y=14,24
            find_vacant=no
            advance=no
        [/unstore_unit]
        [unstore_unit]
            variable=yumi
            x,y=15,25
            find_vacant=no
            advance=no
        [/unstore_unit]
        [unhide_unit]
            [filter][/filter]
        [/unhide_unit]
        {MODIFY_UNIT (id=Aryel) moves 6}
        {MODIFY_UNIT (id=Aryel) attacks_left 1}
        {MODIFY_UNIT (id=Yumi) moves 6}
        {MODIFY_UNIT (id=Yumi) attacks_left 1}
        {CLEAR_VARIABLE aryel}
        {CLEAR_VARIABLE yumi}
        [redraw]
            side=1
            clear_shroud=yes
        [/redraw]
        {DELAY 500}
        [message]
            speaker=spawn_12_22
            message= _ "Intruders! To arms!"
        [/message]
        [message]
            speaker=Aryel
            message= _ "Whoa there. This doesn't have to turn into a bloodbath if you don't resist-"
        [/message]
        [message]
            speaker=spawn_12_22
            message= _ "I need backup! The faeries are planning to assassinate the king! Help!"
        [/message]
        [message]
            speaker=Aryel
            message= _ "... of course, if you have a death wish, that's a different story. I'll be glad to help you on your way to the afterlife."
        [/message]

        [objectives]
            {OBJECTIVE_VICTORY  ( _ "Find the King of Caerleon")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Aryel")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Yumi")}
        [/objectives]
        [set_variable]
            name=part2
            value=1
        [/set_variable]
    [/event]

    [event]
        name=sighted
        first_time_only=yes
        [filter]
            type=Longbowman
        [/filter]
        [filter_second]
            side=1
        [/filter_second]
        [filter_condition]
            [variable]
                name=part2
                numerical_equals=1
            [/variable]
        [/filter_condition]

        [message]
            speaker=unit
            message= _ "Faeries! Get them! Alert the king! Protect him at all costs!"
        [/message]
        [message]
            speaker=Aryel
            message= _ "You're not protecting anyone from us with those pathetic skills of yours, buddy."
        [/message]
    [/event]
    [event]
        name=sighted
        first_time_only=yes
        [filter]
            id=spawn_12_5
        [/filter]
        [filter_second]
            side=1
        [/filter_second]
        [filter_condition]
            [variable]
                name=part2
                numerical_equals=1
            [/variable]
        [/filter_condition]

        {DELAY 500}

        [remove_shroud]
            side=1
            x,y=12,3
            radius=5
        [/remove_shroud]

        [message]
            speaker=unit
            message= _ "My liege! The faeries draw closer! What shall we do?"
        [/message]
        {SCROLL_TO 12 2}
        [unit]
            side=2
            id=Grahm
            name= _ "Lord Grahm"
            type=Grand Marshal
            random_traits=no
            animate=yes
            x,y=12,2
        [/unit]
        [message]
            speaker=Grahm
            message= _ "Stand your ground, men! We must show no fear!"
        [/message]
        [message]
            speaker=Aryel
            message= _ "Yeah, like you can stop us."
        [/message]
        [move_unit]
            id=Aryel
            to_x,to_y=12,4
        [/move_unit]
        [move_unit]
            id=Yumi
            to_x,to_y=13,5
        [/move_unit]
        [message]
            speaker=Grahm
            message= _ "Do not falter before these vile adversaries!"
        [/message]
        [message]
            speaker=Aryel
            message= _ "(sighs) For the last time, we don't have to be your enemies!"
        [/message]
        [message]
            speaker=Grahm
            message= _ "What kind of fool do you take me for? You claim to not be our foes, yet you attack our troops, break into our city, kill my guards-"
        [/message]
        [message]
            speaker=Aryel
            message= _ "Yeah, and you attacked us first. You practically hunted us the whole way across these northlands-"
        [/message]
        [message]
            speaker=Grahm
            message= _ "You liar!"
        [/message]
        [message]
            speaker=Aryel
            message= _ "What's wrong with all of you? You can't honestly believe that we'd just attack you for no reason! Come on, you mages, you won't let him use you like this, right?"
        [/message]
        [message]
            speaker=archmage20
            message= _ "I don't know... we have heard countless reports of your brutality against our people, and Lord Grahm has ruled us wisely and justly for a great many years..."
        [/message]
        [message]
            speaker=mageoflight20
            message= _ "And you are here, breaking into the palace threatening our lives with your profane sorceries. You cannot possibly pretend to be diplomatic while terrorizing us like this..."
        [/message]
        [message]
            speaker=Aryel
            message= _ "And you can't attack us and expect that we'd do nothing about it! Like seriously, you even kidnapped my friend here, and- Yumi?"
        [/message]
        [message]
            speaker=Yumi
            message= _ "(eyes glow)"
        [/message]
        {FADE_SCREEN}
        {DELAY 350}
        {PLAY_SOUND "magic-faeriefire.ogg"}
        {DELAY 550}
        {PLAY_SOUND "magic-faeriefire.ogg"}
        {DELAY 350}
        [message]
            speaker=Grahm
            message= _ "No! What are you doing! You evil monsters! You-!"
        [/message]
        {PLAY_SOUND "human-die-1.ogg"}
        {DELAY 350}
        {PLAY_SOUND "human-die-2.ogg"}
        {DELAY 350}
        {PLAY_SOUND "human-die-3.ogg"}
        {DELAY 350}
        [kill]
            side=2
        [/kill]
        [message]
            speaker=Aryel
            message= _ "Yumi- wait! What are you doing? You can't just kill all of them!"
        [/message]
        {DELAY 350}
        {PLAY_SOUND "magic-faeriefire.ogg"}
        {DELAY 350}
        {PLAY_SOUND "human-die-2.ogg"}
        {DELAY 350}
        {PLAY_SOUND "human-die-1.ogg"}
        {DELAY 350}
        [fade_out_music][/fade_out_music]
        {REPLACE_SCENARIO_MUSIC silence.ogg}
        {DELAY 750}
        [message]
            speaker=Aryel
            message= _ "Yumi?"
        [/message]
        {DELAY 500}

        [fade_out_music][/fade_out_music]
        [replace_schedule]
            {DARK_INDOORS}
        [/replace_schedule]
        {UNFADE_SCREEN}
        {REPLACE_SCENARIO_MUSIC silence.ogg}
        {APPEND_MUSIC           into_the_shadows.ogg}

        [unit]
            id=Luna
            type=Illusory Angel
            animate=no
            side=4
            x,y=12,2
            random_traits=no
            generate_name=no
            gender=female
        [/unit]
        {SPAWN ("Demon Nightmare") 4 12 5}
        {SPAWN ("Demon Dreamweaver") 4 15 4}
        {SPAWN ("Demon Dreamweaver") 4 9 4}
        [redraw][/redraw]
        [message]
            speaker=archmage20
            message= _ "No way. T-this is some kind of joke, right?"
        [/message]
        [message]
            speaker=mageoflight20
            message= _ "M-my liege... this can't be real..."
        [/message]
        [message]
            speaker=Aryel
            message= _ "(eyes narrow) So this was the game all along. The humans weren't insane. They were replaced right from the start."
        [/message]
        [message]
            speaker=Luna
            message= _ "Your reality is but an illusion."
        [/message]
        [message]
            speaker=Aryel
            message= _ "What do you want? Why are you invading our world? Why are you after us?"
        [/message]
        [message]
            speaker=Luna
            message= _ "Why don't you ask your friend over there? She knows."
        [/message]
        [message]
            speaker=Aryel
            message= _ "(turns) She does?"
        [/message]
        [message]
            speaker=Luna
            message= _ "Of course she does. She knows things that even I do not know."
        [/message]
        [message]
            speaker=Aryel
            message= _ "(shakes head) Somehow, I'm not surprised."
        [/message]
        [message]
            speaker=Aryel
            message= _ "This is getting out of hand."
        [/message]
        [message]
            speaker=Luna
            message= _ "So it seems."
        [/message]
        [message]
            speaker=Aryel
            message= _ "(annoyed) Ugh. Yumi, we're seriously going to have a good long talk after we've finished our business here-"
        [/message]
        [message]
            speaker=Yumi
            message= _ "(eyes glow brighter)"
        [/message]
        {DELAY 350}
        {PLAY_SOUND "magic-faeriefire.ogg"}
        {DELAY 350}
        [harm_unit]
            [filter]
                id=Luna
            [/filter]
            amount=10
            animate=yes
            kill=no
            fire_event=no
        [/harm_unit]
        {DELAY 350}
        {PLAY_SOUND "magic-faeriefire.ogg"}
        {DELAY 350}
        [harm_unit]
            [filter]
                id=Luna
            [/filter]
            amount=15
            animate=yes
            kill=no
            fire_event=no
        [/harm_unit]
        {DELAY 350}
        [message]
            speaker=Aryel
            message= _ "You're not even listening to me! (grabs)"
        [/message]
        [message]
            speaker=Yumi
            message= _ "(gasps)"
        [/message]
        {DELAY 350}
        {PLAY_SOUND "magic-dark-miss.ogg"}
        {DELAY 600}
        {PLAY_SOUND "magic-dark-miss.ogg"}
        {DELAY 350}
        {COLOR_ADJUST -255 -255 -255}
        [hide_unit]
            side=1,2,3,4
            [not]
                id=Aryel,Yumi,Luna
            [/not]
        [/hide_unit]
        {DELAY 350}
        [message]
            speaker=Luna
            message= _ "You won't catch me like that."
        [/message]
        [message]
            speaker=Aryel
            message= _ "You get back here! Stop running!"
        [/message]
        [kill]
            id=Luna
        [/kill]
        {UNFADE_SCREEN}

        [message]
            speaker=Aryel
            message= _ "Aaand she's gone. I swear... I'm actually about to lose my mind here."
        [/message]
        [unit]
            side=4
            id=boss1
            type=Demon Incubus
            gender=male
            generate_name=yes
            random_traits=no
            animate=yes
            x,y=12,2
        [/unit]
        [message]
            speaker=boss1
            message= _ "I shall be happy to aid your descent into madness."
        [/message]
        [message]
            speaker=Aryel
            message= _ "(snaps) And I'll be happy to send you to the wastes of oblivion, whelp."
        [/message]

        [message]
            speaker=boss1
            message= _ "Such confidence does not befit one with your abilities."
        [/message]
        [message]
            speaker=Aryel
            message= _ "You'll find that it's well-founded."
        [/message]
        [message]
            speaker=boss1
            message= _ "Are you sure?"
        [/message]
        [unit]
            side=4
            type=Demon Nightmare
            random_gender=yes
            generate_name=no
            random_traits=yes
            animate=yes
            x,y=8,9
        [/unit]
        [unit]
            side=4
            type=Demon Nightmare
            random_gender=yes
            generate_name=no
            random_traits=yes
            animate=yes
            x,y=16,9
        [/unit]
        [unit]
            side=4
            type=Demon Dreamweaver
            random_gender=yes
            generate_name=no
            random_traits=yes
            animate=yes
            x,y=12,9
        [/unit]

        [message]
            speaker=Aryel
            message= _ "... oh. (sighs)"
        [/message]
        [message]
            speaker=Aryel
            message= _ "Life always has to be so complicated."
        [/message]
        [message]
            speaker=Aryel
            message= _ "You there, humans. If you don't want to get shredded to pieces by these demons, help us out a little."
        [/message]
        [message]
            speaker=mageoflight20
            message= _ "But-"
        [/message]
        [message]
            speaker=Aryel
            message= _ "Do you want to live or not?"
        [/message]
        [message]
            speaker=mageoflight20
            message= _ "Yes, but-"
        [/message]
        [message]
            speaker=archmage20
            message= _ "Shush! Yes, we'll help you. Let's fight off those demons!"
        [/message]
        [message]
            speaker=Aryel
            message= _ "Good. Let's get this little charade over with."
        [/message]
        [modify_unit]
            [filter]
                id=archmage20,mageoflight20
            [/filter]
            side=1
        [/modify_unit]

        # recruiting code for this scenario
        [set_menu_item]
            id=recruit_manifestation
            description= _ "Recruit Manifestation"
            image="attacks/wail.png~SCALE(18,18)"
            [show_if]
                [variable]
                    name=side_number
                    numerical_equals=1
                [/variable]
            [/show_if]
            [filter_location]
                [not]
                    [filter][/filter]
                [/not]
                [filter_adjacent_location]
                    [filter]
                        side=1
                        id=Yumi
                    [/filter]
                [/filter_adjacent_location]
            [/filter_location]
            [command]
                [store_gold]
                    [filter_side]
                        side=1
                    [/filter_side]
                    variable=side1gold
                [/store_gold]
                [if]
                    [variable]
                        name=side1gold
                        less_than=5
                    [/variable]
                    [then]
                        {MESSAGE_NOT_ENOUGH_GOLD}
                    [/then]
                    [else]
                        [unit]
                            side=1
                            type=Manifestation
                            x,y=$x1,$y1
                            moves,attacks_left=0,0
                            animate=yes
                            upkeep=free
                            [modifications]
                                {TRAIT_LOYAL}
                            [/modifications]
                        [/unit]
                        [redraw]
                            side=1
                            clear_shroud=yes
                        [/redraw]
                        {VARIABLE_OP side1gold sub 5}
                        [modify_side]
                            side=1
                            gold=$side1gold
                        [/modify_side]
                        [store_unit]
                            [filter]
                                id=Yumi
                            [/filter]
                            variable=yumi_tmp
                        [/store_unit]
                        {VARIABLE_OP yumi_tmp.moves sub 1}
                        [unstore_unit]
                            variable=yumi_tmp
                        [/unstore_unit]
                        {CLEAR_VARIABLE yumi_tmp}
                        {CLEAR_VARIABLE side1gold}
                    [/else]
                [/if]
            [/command]
        [/set_menu_item]

        [objectives]
            {OBJECTIVE_VICTORY  ( _ "Defeat all of the demons")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Aryel")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Yumi")}
            {OBJECTIVE_NOTE ( _ "You may recruit by right clicking on a hex next to Yumi.")}
        [/objectives]
    [/event]
    [event]
        name=last breath
        [filter]
            id=boss1
        [/filter]

        [filter_condition]
            [variable]
                name=part2
                numerical_equals=1
            [/variable]
        [/filter_condition]
        [message]
            speaker=Aryel
            message= _ "Back to the abyss with you!"
        [/message]
        {DELAY 250}
    [/event]

#define DRAW_DARKNESS
        [store_locations]
            variable=blood_hex
            terrain=*
            [not]
                terrain=Gd^Fetd,Btym,Btym^Sy|
            [/not]
            [filter_adjacent_location]
                terrain=Woby
                count=1-3
            [/filter_adjacent_location]
        [/store_locations]
        [for]
            array=blood_hex
            [do]
                [set_variable]
                    name=change_terrain
                    rand=1..8
                [/set_variable]
                [if]
                    [variable]
                        name=change_terrain
                        less_than=6
                    [/variable]
                    [then]
                        [terrain]
                             x,y=$blood_hex[$i].x,$blood_hex[$i].y
                            terrain=Woby
                        [/terrain]
                    [/then]
                [/if]
                {CLEAR_VARIABLE change_terrain}
            [/do]
        [/for]
        {CLEAR_VARIABLE blood_hex}
        [store_locations]
            variable=blood_hex
            terrain=*
            [not]
                terrain=Gd^Fetd,Btym,Btym^Sy|
            [/not]
            [filter_adjacent_location]
                terrain=Woby
                count=4-6
            [/filter_adjacent_location]
        [/store_locations]
        [for]
            array=blood_hex
            [do]
                [set_variable]
                    name=change_terrain
                    rand=1..14
                [/set_variable]
                [if]
                    [variable]
                        name=change_terrain
                        less_than=6
                    [/variable]
                    [then]
                        [terrain]
                             x,y=$blood_hex[$i].x,$blood_hex[$i].y
                            terrain=Woby
                        [/terrain]
                    [/then]
                [/if]
                {CLEAR_VARIABLE change_terrain}
            [/do]
        [/for]
        {CLEAR_VARIABLE blood_hex}
        [redraw][/redraw]
#enddef
     [event]
        name=last breath
        first_time_only=yes
        [filter]
            side=2
        [/filter]
        [filter_second]
            id=Aryel
        [/filter_second]
        [filter_condition]
            [variable]
                name=part2
                numerical_equals=1
            [/variable]
        [/filter_condition]

        [message]
            speaker=unit
            message= _ "N-no! Please, mercy!"
        [/message]
        [message]
            speaker=Aryel
            message= _ "Consider it mercy that I'm granting you a quick death."
        [/message]
    [/event]
    [event]
        name=die

        [filter]
            side=4
        [/filter]
        [filter_condition]
            [not]
                [have_unit]
                    side=4
                [/have_unit]
            [/not]
            [and]
                [variable]
                    name=part2
                    numerical_equals=1
                [/variable]
            [/and]
        [/filter_condition]

        [kill]
            x,y=$x1,$y1
        [/kill]
        [redraw][/redraw]
        [message]
            speaker=Aryel
            message= _ "Glad that's over with-"
        [/message]
        {DELAY 250}
        {REPEAT 2 ({QUAKE_FIXED "rumble.ogg"})}
        [kill]
            side=1
            type=Manifestation
        [/kill]
        {DELAY 1000}
        [message]
            speaker=Aryel
            message= _ "Oh, what is it now?"
        [/message]
        {DELAY 350}
        {REPEAT 1 ({QUAKE_FIXED "rumble.ogg"})}
        {DELAY 350}
        {PLAY_SOUND "magic-dark.ogg"}
        {DELAY 350}
        {SCROLL_TO 12 12}
        [terrain]
            x,y=12,12
            radius=1
            terrain=Woby
        [/terrain]
        [terrain]
            x,y=12,12
            terrain=Gd^Fyok
        [/terrain]
        [redraw][/redraw]

        [unit]
            id=Luna
            type=Illusory Angel
            animate=no
            side=4
            x,y=12,12
            random_traits=no
            generate_name=no
            gender=female
        [/unit]
        [message]
            speaker=Luna
            message= _ "Hello."
        [/message]
        [message]
            speaker=Aryel
            message= _ "You..! How many times are you going to come back before you realize you can't fight us?"
        [/message]
        [message]
            speaker=Luna
            message= _ "As many as it takes."
        [/message]
        [terrain]
            x,y=12,12
            radius=2
            terrain=Woby
        [/terrain]
        [terrain]
            x,y=12,12
            terrain=Gd^Fyok
        [/terrain]
        [redraw][/redraw]
        [message]
            speaker=Aryel
            message= _ "Why do you keep bothering us? Who put you up to this?"
        [/message]
        [message]
            speaker=Luna
            message= _ "I am only a messenger. My goal is to take you to see my master."
        [/message]
        {SCROLL_TO 12 12}
        {DRAW_DARKNESS}
        [message]
            speaker=Aryel
            message= _ "Right, like that's happening."
        [/message]
        [message]
            speaker=Luna
            message= _ "It will, sooner or later."
        [/message]
        {SCROLL_TO 12 12}
        {DRAW_DARKNESS}
        [message]
            speaker=Yumi
            message= _ "(breathes)"
        [/message]
        {PLAY_SOUND "magic-faeriefire.ogg"}
        {DELAY 350}
        {SCROLL_TO 12 12}
        {DRAW_DARKNESS}
        [message]
            speaker=Aryel
            message= _ "Maybe I'm not a threat to you. But you had best not underestimate Yumi."
        [/message]
        {DELAY 350}
        {PLAY_SOUND "magic-faeriefire.ogg"}
        {DELAY 350}
        {SCROLL_TO 12 12}
        {DRAW_DARKNESS}
        [message]
            speaker=Luna
            message= _ "She is powerful, yes. But that will be her undoing."
        [/message]
        [message]
            speaker=Aryel
            message= _ "And yours too."
        [/message]
        {SCROLL_TO 12 12}
        {DELAY 350}
        {PLAY_SOUND "magic-dark.ogg"}
        {DELAY 350}

        [terrain]
            x,y=12,12
            terrain=Qxu
        [/terrain]
        [kill]
            id=Luna
            animate=yes
        [/kill]
        [redraw][/redraw]
        {DELAY 500}
        [terrain]
            x,y=12,12
            radius=1
            terrain=Qxu
        [/terrain]
        [redraw][/redraw]
        {DELAY 650}
        [terrain]
            x,y=12,12
            radius=2
            terrain=Qxu
        [/terrain]
        [redraw][/redraw]
        {DELAY 500}

        [message]
            speaker=Aryel
            message= _ "She got away again, didn't she?"
        [/message]
        [message]
            speaker=Yumi
            message= _ "(nods) She went down into the tunnels below us."
        [/message]
        [message]
            speaker=Aryel
            message= _ "Then we'll have to chase her. But before that, we have to talk."
        [/message]
        [message]
            speaker=Yumi
            message= _ "But-"
        [/message]
        [message]
            speaker=Aryel
            message= _ "Yumi. You can't possibly think that keeping everything to yourself is going to help anyone."
        [/message]
        [message]
            speaker=Yumi
            message= _ "Aryel..."
        [/message]
        [message]
            speaker=Aryel
            message= _ "No. I'm not putting up with this. I'm sick of being kept in the dark about everything. I'm tired of your secrets. And it's not just me, even Esther gets frustrated with you sometimes! Look, Yumi. I need to know what's going on."
        [/message]
        [message]
            speaker=narrator
            message= _ "(silence)"
        [/message]
        [message]
            speaker=Aryel
            message= _ "Yumi... please."
        [/message]
        [message]
            speaker=Yumi
            message= _ "(breathes) Maybe. Just... just not here."
        [/message]
        [message]
            speaker=Aryel
            message= _ "(looks around) Fine. Let's find somewhere where we'll be alone, then you promise me you'll be truthful with me."
        [/message]
        [message]
            speaker=Yumi
            message= _ "(chews lip)"
        [/message]

        [clear_menu_item]
            id=recruit_manifestation
        [/clear_menu_item]
        {CLEAR_VARIABLE part1}
        {CLEAR_VARIABLE part2}
        [endlevel]
            result=victory
            bonus=no
            {NEW_GOLD_CARRYOVER 100}
            next_scenario=21_Ashen_Hearts
        [/endlevel]
    [/event]

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

        [message]
            speaker=mageoflight20
            message= _ "Augh! Noooooo!"
        [/message]
    [/event]
    [event]
        name=last breath
        [filter]
            id=archmage20
        [/filter]

        [message]
            speaker=archmage20
            message= _ "How could this happen..."
        [/message]
    [/event]
    [event]
        name=last breath
        [filter]
            id=Yumi
        [/filter]

        [message]
            speaker=Yumi
            message= _ "(gasp)"
        [/message]
        [endlevel]
            result=defeat
        [/endlevel]
    [/event]
    [event]
        name=last breath
        [filter]
            id=Aryel
        [/filter]

        [message]
            speaker=Aryel
            message= _ "Ah..."
        [/message]
        [endlevel]
            result=defeat
        [/endlevel]
    [/event]
[/scenario]

#undef DRAW_DARKNESS