#textdomain wesnoth-httt
[scenario]
    id=08_The_Princess_of_Wesnoth
    name= _ "The Princess of Wesnoth"
    map_data="{campaigns/Heir_To_The_Throne/maps/08_The_Princess_of_Wesnoth.map}"
    {TURNS 31 28 25}

    {DEFAULT_SCHEDULE}

    next_scenario=09_The_Valley_of_Death

    {SCENARIO_MUSIC "loyalists.ogg"}
    {EXTRA_SCENARIO_MUSIC "the_city_falls.ogg"}
    {EXTRA_SCENARIO_MUSIC "battle.ogg"}
    {EXTRA_SCENARIO_MUSIC "casualties_of_war.ogg"}
    {EXTRA_SCENARIO_MUSIC "siege_of_laurelmor.ogg"}

    [event]
        name=prestart
        [objectives]
            side=1
            [objective]
                description= _ "Force Li’sar’s surrender (reduce her hitpoints to 0 or lower)"
                condition=win
            [/objective]
            [objective]
                description= _ "Death of Konrad"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Delfador"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Kalenz"
                condition=lose
            [/objective]

            {TURNS_RUN_OUT}

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

    [story]
        [part]
            story= _ "...but one of the orcs survived long enough to send the news to the queen..."
            background=story/story6.png
        [/part]
        [part]
            story= _ "...and she sent her most able commander."
            background=story/story7.png
        [/part]
    [/story]

    {BIGMAP_PRINCESS_OF_WESNOTH}

    [label]
        x,y=12,16
        text=_"Elmar’s Crossing"    # wmllint: no spellcheck
    [/label]

    [label]
        x,y=13,17
        text=_"Elbridge"    # wmllint: no spellcheck
    [/label]

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

    [side]
        type=Princess
        id="Li'sar"
        name= _ "Li’sar"
        profile=portraits/lisar.png
        side=2
        canrecruit=yes
        facing=sw

        {GOLD 140 190 280}
        {INCOME 4 8 12}

#ifdef EASY
        recruit=Cavalryman,Spearman,Swordsman,Mage,Ogre,Bowman
#endif
#ifdef NORMAL
        recruit=Cavalryman,Swordsman,Spearman,Mage,Ogre,Bowman
#endif
#ifdef HARD
        recruit=Cavalryman,Swordsman,Red Mage,Ogre,Lieutenant,Pikeman,Longbowman
#endif

        [ai]
            passive_leader=yes
            #she’s a smart leader and thinks deeply
            {ATTACK_DEPTH 4 5 5}
#ifdef EASY
            recruitment_pattern=scout,mixed fighter,fighter,fighter,archer
#endif
#ifdef NORMAL
            recruitment_pattern=scout,mixed fighter,fighter,fighter,archer
#endif
#ifdef HARD
            recruitment_pattern=scout,mixed fighter,fighter,fighter,fighter,archer
#endif
            [goal]
                name=target
                [criteria]
                    id=Konrad
                [/criteria]
                value=9.0
            [/goal]
            leader_value=6.0
        [/ai]
        team_name=asheviere
        user_team_name=_"Asheviere"
        {FLAG_VARIANT loyalist}
    [/side]

    [event]
        name=prestart

        {PLACE_IMAGE scenery/rock1.png  6  8}
        {PLACE_IMAGE scenery/rock2.png 10 45}
        # {SCATTER_IMAGE (terrain=Gg) 6 scenery/oak-leaning.png}

        [set_variable]
            name=trap_sprung
            value=0
        [/set_variable]

        {PLACE_IMAGE scenery/mine-abandoned.png 4 41}

        [recall]
            id=Delfador
        [/recall]
        [recall]
            id=Kalenz
        [/recall]
        [role]
            type=Elvish Champion,Elvish Marshal,Elvish Captain,Elvish Hero,Knight,Elvish Outrider,Elvish Rider,Paladin,Mage,White Mage,Red Mage
            role=Advisor
        [/role]
        [recall]
            role=Advisor
        [/recall]
    [/event]

    [event]
        name=start
        [message]
            speaker=narrator
            image="wesnoth-icon.png"
            message= _ "On the road to Knalga, the party was opposed by the forces of Asheviere."
        [/message]
        [message]
            speaker="Li'sar"
            message= _ "The Queen has sent me to stop you, impostor!"
        [/message]
        [message]
            role=Advisor
            message= _ "That’s the princess, Li’sar. The daughter of the Queen, and her successor!"
        [/message]
        [message]
            speaker=Konrad
            message= _ "I’m no impostor. It seems that your mother has lied to you."
        [/message]
        [message]
            speaker="Li'sar"
            {LISAR_VARIATION mad}
            message= _ "This is treason! Your lies will perish with you!"
        [/message]
        [message]
            speaker=Delfador
            message= _ "There is no use in reasoning. She will understand only one thing. To arms!"
        [/message]
    [/event]

    [event]
        name=turn 5

        {LOYAL_UNIT 2 (Lieutenant) 27 12}
        {LOYAL_UNIT 2 (Swordsman) 27 12}
        {LOYAL_UNIT 2 (Swordsman) 27 12}

        [message]
            speaker="Li'sar"
            message= _ "This is taking too much time, I had best call some reinforcements!"
        [/message]
    [/event]
    [event]
        name=turn 10
        {LOYAL_UNIT 2 (Lieutenant) 27 12}
        {LOYAL_UNIT 2 (Swordsman) 27 12}
        {LOYAL_UNIT 2 (Swordsman) 27 12}

        [message]
            speaker="Li'sar"
            message= _ "Maybe I was not using enough forces..."
        [/message]
    [/event]
    [event]
        name=last breath
        [filter]
            id="Li'sar"
        [/filter]
        [message]
            speaker=unit
            {LISAR_VARIATION defeat}
            message= _ "I surrender! Don’t hurt me, impostor."
        [/message]
        [message]
            speaker=Konrad
            message= _ "I said before I’m not an impostor, but if you yield, I will spare your life."
        [/message]
        [message]
            speaker=unit
            {LISAR_VARIATION defeat}
            message= _ "Let me go!"
        [/message]
        [message]
            speaker=Konrad
            {KONRAD_VARIATION concerned}
            message= _ "Think about the story of the old king. Ask somebody who knew of him."
        [/message]
        [message]
            speaker=unit
            {LISAR_VARIATION defeat}
            message= _ "The old king? I have heard about that, but I know it is not true. My mother told me."
        [/message]
        [message]
            speaker=Delfador
            message= _ "Your mother has lied to you, child. Now I suggest you reconsider, and either join us, or flee as an exile. There will be a great battle soon, and if you are on the wrong side of it, we may not have the opportunity to spare your life a second time."
        [/message]
        [message]
            speaker=unit
            {LISAR_VARIATION defeat}
            message= _ "I am not a child, and I do not want to talk about it! You said you would spare me, so be on your way. The northern road should be safe for you."
        [/message]
        [message]
            speaker=Konrad
            message= _ "Good day then, Princess. Come, men, to the northern road!"
        [/message]
        [message]
            speaker=unit
            {LISAR_VARIATION defeat}
            message= _ "(Ha ha, little do they know just how many undead have wandered the northern road of late. Surely they are doomed!)"
        [/message]

        {CLEAR_VARIABLE trap_sprung}

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

#define SECOND_WAVE
#ifdef EASY
    [gold]
        side=2
        amount=90
    [/gold]
#endif

#ifdef NORMAL
    [gold]
        side=2
        amount=120
    [/gold]
#endif

#ifdef HARD
    [gold]
        side=2
        amount=150
    [/gold]
#endif
#enddef

    [event]
        name=moveto
        [filter]
            side=1
            x=20-29
            y=1-23
        [/filter]

        [if]
            [variable]
                name=trap_sprung
                numerical_equals=0
            [/variable]

            [then]
                [set_variable]
                    name=trap_sprung
                    value=1
                [/set_variable]
                {SECOND_WAVE}

                [message]
                    speaker="Li'sar"
                    message= _ "I see that your forces draw near, impostor! I’ll not be defeated in my own backyard so easily... Come forth and attack, my loyal duelist!"
                [/message]

                [sound]
                    name=dagger-swish.wav
                [/sound]

                [move_unit_fake]
                    type=Duelist
                    side=2
                    x=4,4,5,6,6
                    y=41,42,42,41,40
                [/move_unit_fake]

                {NAMED_LOYAL_UNIT 2 (Duelist) 6 40 (Ronry) ( _ "Ronry")}

                [scroll_to_unit]
                    x=6
                    y=40
                [/scroll_to_unit]
#ifdef NORMAL
                {LOYAL_UNIT 2 (Fencer) 6 41}
#endif
#ifdef HARD
                {LOYAL_UNIT 2 (Fencer) 6 41}
                {LOYAL_UNIT 2 (Fencer) 5 42}
#endif

                [message]
                    speaker=Ronry
                    message= _ "I’ll seize their keep, my Lady!"
                [/message]
            [/then]
            [else]
                [allow_undo]
                [/allow_undo]
            [/else]
        [/if]
    [/event]

    [event]
        name=moveto
        [filter]
            side=1
            x=4
            y=41
        [/filter]

        [if]
            [variable]
                name=trap_sprung
                numerical_equals=0
            [/variable]

            [then]
                [set_variable]
                    name=trap_sprung
                    value=1
                [/set_variable]
                {SECOND_WAVE}

                [message]
                    speaker=unit
                    message= _ "It sounds like there is something in the mine shaft."
                [/message]

                [sound]
                    name=dagger-swish.wav
                [/sound]

                {NAMED_LOYAL_UNIT 2 (Duelist) 4 41 (Ronry) ( _ "Ronry")}

                [scroll_to_unit]
                    x=4
                    y=41
                [/scroll_to_unit]

                [message]
                    speaker="Li'sar"
                    message= _ "You’ve discovered my ploy! It doesn’t matter, I’ll still rout you!"
                [/message]

#ifdef NORMAL
                {LOYAL_UNIT 2 (Fencer) 4 41}
#endif
#ifdef HARD
                {LOYAL_UNIT 2 (Fencer) 4 41}
                {LOYAL_UNIT 2 (Fencer) 4 41}
#endif

                [message]
                    speaker=Ronry
                    message= _ "The trap is foiled, but I’ll still flush this rabble from their keep!"
                [/message]
            [/then]
        [/if]
    [/event]

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