#textdomain wesnoth-httt
[scenario]
    id=22_Return_to_Wesnoth
    name= _ "Return to Wesnoth"
    map_data="{campaigns/Heir_To_The_Throne/maps/22_Return_to_Wesnoth.map}"
    {TURNS 31 28 25}

    next_scenario=23_Test_of_the_Clans

    {DEFAULT_SCHEDULE}

    {INTRO_AND_SCENARIO_MUSIC "revelation.ogg" "breaking_the_chains.ogg"}
    {EXTRA_SCENARIO_MUSIC "battle.ogg"}
    {EXTRA_SCENARIO_MUSIC "loyalists.ogg"}
    {EXTRA_SCENARIO_MUSIC "knolls.ogg"}

    [event]
        name=prestart
        [disallow_recruit]
            side=1
            type=Gryphon
        [/disallow_recruit]
        [objectives]
            side=1
            [objective]
                description= _ "Defeat all enemy leaders"
                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}

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

        [if]
            [variable]
                name=gryphons_return
                boolean_equals=yes
            [/variable]
            [then]
                [event]
                    name=turn 4

                    [sound]
                        name=gryphon-shriek-1.ogg
                    [/sound]
                    [message]
                        speaker=narrator
                        message= _ "The battlefield falls silent as a loud shriek fills the air."
                    [/message]
                    [scroll_to]
                        x,y=1,1
                    [/scroll_to]
                    [message]
                        speaker=Kalenz
                        scroll=no
                        message= _ "Look! In the distance! I have never before seen such a thing!"
                    [/message]
#define GRYPHON_RETURNS X Y
    [sound]
        name=gryphon-shriek-1.ogg
    [/sound]
    [move_unit_fake]
        type=Gryphon
        x=1,{X}
        y=1,{Y}
    [/move_unit_fake]
    {LOYAL_UNIT 1 (Gryphon) {X} {Y}}
#enddef
                    {GRYPHON_RETURNS 5 5}
                    {GRYPHON_RETURNS 5 4}
                    {GRYPHON_RETURNS 4 4}
                    {GRYPHON_RETURNS 5 3}
                    {GRYPHON_RETURNS 3 4}
#undef GRYPHON_RETURNS
                    [message]
                        speaker=Delfador
                        {DELFADOR_MENTORING}
                        message= _ "What a surprise! This world never ceases to amaze me."
                    [/message]
                    [message]
                        speaker=Konrad
                        {KONRAD_VARIATION glad}
                        message= _ "Such wondrous beasts! It appears our aid in their mountain homeland is being repaid."
                    [/message]
                    [message]
                        speaker="Li'sar"
                        {LISAR_VARIATION glad}
                        message= _ "Assault from the air? What an intriguing idea!"
                    [/message]
                    [allow_recruit]
                        side=1
                        type=Gryphon
                    [/allow_recruit]
                    [message]
                        speaker=narrator
                        image=wesnoth-icon.png
                        message= _ "You can now recruit Gryphons!"
                    [/message]
                [/event]
            [/then]
        [/if]
    [/event]

    {campaigns/Heir_To_The_Throne/utils/deaths.cfg}

    [story]
        [part]
            story= _ "After many days enjoying the strange food and fine linen of his hosts, restlessness overtook Konrad. The urgency nagged at him as he donned a new tunic and fastened newly-oiled leather straps."
            {HTTT_BIGMAP}
            show_title=no
        [/part]
        [part]
            story= _ "He strode the halls of the elven citadel, visiting and encouraging his soldiers. Many were elves about to leave behind the comfort and peace of their capital to make war on a vast human army — his war. The weight of that thought bore on him."
            {HTTT_BIGMAP}
            show_title=no
        [/part]
        [part]
            story= _ "Konrad stood on the rampart staring out towards the horizon as his men bustled below. He suddenly realized why he was uneasy: he had been staring at thin streams of black smoke, merging into the clouds far in the distance. He shouted orders to depart and was ardently obeyed."
            {HTTT_BIGMAP}
            show_title=no
        [/part]
        [part]
            story= _ "Kalenz’s champion courtiers escorted Konrad and Delfador through their forest, a near-invincible vanguard. War had spread to the Northlands, but by taking long-deserted trails through the rugged eastern hills, it failed to find the band of rebels. The high craggy peaks of the mountains of the Dragons looked down on them in deserted desolation."
            {HTTT_BIGMAP}
            show_title=no
        [/part]
        [part]
            story= _ "Konrad’s small band of elves had grown to a massive army. The occasional hermit mage knew better than to interfere with its progress, and soon the plains of Northeastern Wesnoth lay before them."
            {HTTT_BIGMAP}
            show_title=no
        [/part]
        [part]
            story= _ "After spending the greater part of a year in remote, dangerous wastes, Konrad’s heart leapt at the thought this journey was almost over. Though the greatest danger lay ahead, he knew he was finally returning home."
            {HTTT_BIGMAP}
            show_title=no
        [/part]
    [/story]

    {HTTT_TRACK {JOURNEY_22_NEW} }

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

    [side]
        type=General
        id=Josephus
        name= _ "Josephus"
        side=2
        canrecruit=yes
        controller=ai
        recruit=Royal Guard
        [ai]
            recruitment_pattern=fighter
            {ATTACK_DEPTH 5 5 6}
        [/ai]
        {GOLD 100 140 180}
        team_name=evil
        user_team_name=_"Asheviere"
        {FLAG_VARIANT loyalist}
    [/side]

    {STARTING_VILLAGES 2 13}

    [side]
        type=Orcish Warlord
        id=Dwar-Ni
        name= _ "Dwar-Ni"
        side=3
        canrecruit=yes
        controller=ai
        recruit=Goblin Pillager,Goblin Knight,Orcish Warrior,Orcish Crossbowman
        {GOLD 110 150 190}
        [ai]
            {ATTACK_DEPTH 5 5 6}
        [/ai]
        team_name=evil
        user_team_name=_"Asheviere"
        {FLAG_VARIANT6 ragged}
    [/side]

    {STARTING_VILLAGES 3 13}

    [side]
        type=General
        id=Malatus
        name= _ "Malatus"
        side=4
        canrecruit=yes
        controller=ai
        recruit=Royal Guard,Pikeman,Master Bowman,Shock Trooper,Duelist
        {GOLD 100 160 200}
        [ai]
            {ATTACK_DEPTH 5 5 6}
        [/ai]
        team_name=evil
        user_team_name=_"Asheviere"
        {FLAG_VARIANT loyalist}
    [/side]

    {STARTING_VILLAGES 4 10}

    [event]
        name=prestart

        {PLACE_IMAGE scenery/rock1.png 16 26}

        {NEED_DELFADOR placement=leader}
        {NEED_KALENZ placement=leader}
        {NEED_LISAR placement=leader}
    [/event]

    [event]
        name=start

        [message]
            speaker=Malatus
            message= _ "Halt! Who goes there?"
        [/message]
        [message]
            speaker=Dwar-Ni
            message= _ "Look! It is the traitor Li’sar, with the old mage and the filthy elven lord. Quickly, capture them! The Queen wishes to make them her prisoners."
        [/message]
        [message]
            speaker="Li'sar"
            message= _ "What? I, a traitor? It is the Queen who is a traitor, for not obeying the wishes of King Garard II. We have the Sceptre of Fire, so let us in!"
        [/message]
        [message]
            speaker=Malatus
            message= _ "You leave us no choice but to kill you."
        [/message]
    [/event]

    #bad things happen when first enemy leader dies
    [event]
        name=die
        [filter]
            id=Josephus
        [/filter]
        [filter_condition]
            [have_unit]
                id=Malatus
            [/have_unit]
        [/filter_condition]
        [message]
            speaker=Malatus
            message= _ "These intruders are stronger than we expected. Call in the reinforcements!"
        [/message]

        {NAMED_LOYAL_UNIT 4 (Halberdier) 33 37 (Dacayan) ( _ "Dacayan")}
        {LOYAL_UNIT 4 (Halberdier) 32 37}
        {LOYAL_UNIT 4 (Halberdier) 34 37}

        #a little attempt at comic relief
        [message]
            speaker=Dacayan
            message= _ "The Queen has sent us to aid you in capturing these rebels."
        [/message]
        [message]
            speaker=Malatus
            message= _ "We have changed the plan. Now we are killing them."
        [/message]
    [/event]

    [event]
        name=die
        [filter]
            id=Malatus
        [/filter]
        [filter_condition]
            [have_unit]
                id=Josephus
            [/have_unit]
        [/filter_condition]
        [message]
            speaker=Josephus
            message= _ "These intruders are stronger than we expected. Call in the reinforcements!"
        [/message]

        {NAMED_LOYAL_UNIT 4 (Halberdier) 33 37 (Dacayan) ( _ "Dacayan")}
        {LOYAL_UNIT 4 (Halberdier) 32 37}
        {LOYAL_UNIT 4 (Halberdier) 34 37}

        #a little attempt at comic relief
        [message]
            speaker=Dacayan
            message= _ "The Queen has sent us to aid you in capturing these rebels."
        [/message]
        [message]
            speaker=Josephus
            message= _ "We have changed the plan. Now we are killing them."
        [/message]
    [/event]

    [event]
        name=turn 18
        [message]
            speaker=Delfador
            message= _ "We must make haste! Far greater challenges lie before us. By tarrying here we’re diminishing our resources."
        [/message]
    [/event]

    [event]
        name=enemies defeated

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