#textdomain wesnoth-tsg
[scenario]
    id=6a_Tidings_Good_And_Ill

    name= _ "Tidings, Good and Ill"
    next_scenario=7a_Into_The_Depths

    {SCENARIO_MUSIC loyalists.ogg}
    {EXTRA_SCENARIO_MUSIC wanderer.ogg}

    map_data="{campaigns/The_South_Guard/maps/6a_Tidings_Good_And_Ill.map}"

    {campaigns/The_South_Guard/utils/sg_deaths.cfg}
    {campaigns/The_South_Guard/utils/sg_help.cfg}

    {DUSK}
    {FIRST_WATCH}
    {SECOND_WATCH}
    {DAWN}
    {MORNING}
    {AFTERNOON}

    turns=18
    victory_when_enemies_defeated=no

    # Deoran will be removed and Gerrick instated as the leader in a prestart
    # event.

    [side]
        side=1
        type=Horseman Commander
        id=Deoran
        name= _ "Deoran"
        unrenamable=yes

        team_name=South_Guard
        user_team_name=_"South Guard"
        controller=human
        {CUSTOM_SG_FLAG}

        gold=0
        income=0

        shroud=yes
        fog=yes

        canrecruit=yes
    [/side]

    # Miscellaneous Enemy Combatants

    [side]
        side=2

        team_name=Various_Baddies
        user_team_name=_"Enemies"
        no_leader=yes

        controller=ai

        {NAMED_GENERIC_UNIT 2 (Saurian Skirmisher) 8 21 (Ssesseth) (_"Ssesseth")} {GUARDIAN}
        {NAMED_GENERIC_UNIT 2 (Saurian Skirmisher) 17 16 (Zasz) (_"Zasz")} {GUARDIAN}
        {NAMED_GENERIC_UNIT 2 (Saurian Skirmisher) 8 16 (Zerix) (_"Zerix")} {GUARDIAN}

        {NAMED_GENERIC_UNIT 2 (Giant Scorpion) 14 16 (Scorpion) (_"Scorpion")} {GUARDIAN}
        {NAMED_GENERIC_UNIT 2 (Ogre) 4 10 (Kramak) (_"Kramak")} {GUARDIAN}

        {NAMED_GENERIC_UNIT 2 (Naga Fighter) 13 9 (Issorai) (_"Issorai")} {GUARDIAN}
        {NAMED_GENERIC_UNIT 2 (Naga Fighter) 14 9 (Zarr) (_"Zarr")} {GUARDIAN}

        #wmllint: local spelling Xeila
#ifdef EASY
        {NAMED_GENERIC_UNIT 2 (Dark Adept) 8 1 (Abdur) (_"Abdur")} {GUARDIAN}
        {NAMED_GENERIC_UNIT 2 (Naga Fighter) 12 8 (Queen Xeila) (_"Queen Xeila")} {GUARDIAN}
#endif

#ifdef NORMAL
        {NAMED_GENERIC_UNIT 2 (Saurian Skirmisher) 9 14 (Ssanur) (_"Ssanur")} {GUARDIAN}
        {NAMED_GENERIC_UNIT 2 (Dark Adept) 8 1 (Abdur) (_"Abdur")} {GUARDIAN}
        {NAMED_GENERIC_UNIT 2 (Naga Warrior) 12 8 (Queen Xeila) (_"Queen Xeila")} {GUARDIAN}
        {NAMED_GENERIC_UNIT 2 (Naga Fighter) 13 7 (Lesssh) (_"Lesssh")} {GUARDIAN}
#endif

#ifdef HARD
        {NAMED_GENERIC_UNIT 2 (Saurian Ambusher) 9 14 (Ssanur) (_"Ssanur")} {GUARDIAN}
        {NAMED_GENERIC_UNIT 2 (Dark Adept) 8 1 (Abdur) (_"Abdur")} {GUARDIAN}
        {NAMED_GENERIC_UNIT 2 (Dark Adept) 7 1 (Kallen) (_"Kallen")} {GUARDIAN}
        {NAMED_GENERIC_UNIT 2 (Naga Myrmidon) 12 8 (Queen Xeila) (_"Queen Xeila")} {GUARDIAN}
        {NAMED_GENERIC_UNIT 2 (Naga Warrior) 13 7 (Lesssh) (_"Lesssh")} {GUARDIAN}
#endif
    [/side]
    # wmllint: recognize Queen Xeila
    # wmllint: recognize Kramak
    # wmllint: recognize Abdur

    #prestart

    [event]
        name=prestart

        # Store away Deoran, his human troops, Ethiliel and her bodyguards, so
        # that only Gerrick and the rest of the elves remain.
        # wmllint: recognize Ethiliel
        # wmllint: recognize Minister Hylas
        # wmllint: recognize Elvish Bodyguard
        # wmllint: recognize Sir Gerrick

        [store_unit]
            [filter]
                id=Deoran
            [/filter]

            kill=yes
            variable=stored_Deoran
        [/store_unit]

        [store_unit]
            [filter]
                id=Ethiliel
            [/filter]

            kill=yes
            variable=stored_Ethiliel
        [/store_unit]

        [store_unit]
            [filter]
                id=Minister Hylas
            [/filter]

            kill=yes
            variable=stored_Hylas
        [/store_unit]

        [store_unit]
            [filter]
                side=1
                role=Elvish Bodyguard
            [/filter]

            kill=yes
            variable=stored_elvish_bodyguards
        [/store_unit]

        # Store Deoran's gold so it can be restored in Into the Depths and set
        # Gerrick's gold to 100.

        [store_side]
            side=1
            variable=stored_Deoran_side
        [/store_side]

        [modify_side]
            side=1
            gold=100
        [/modify_side]

        # Recall Gerrick and set him as the leader.

        [recall]
            id=Sir Gerrick
            x,y=16,23
        [/recall]

        {MODIFY_UNIT (id=Sir Gerrick) canrecruit yes}

        [set_recruit]
            side=1
            recruit=Elvish Fighter,Elvish Shaman
        [/set_recruit]

        [unit]
            type=Elvish Ranger
            id=Eliomir
            name= _ "Eliomir"
            x,y=17,22
            facing=sw
            side=1
            [modifications]
                {TRAIT_LOYAL}
                {TRAIT_DEXTROUS}
            [/modifications]
            {IS_LOYAL}
        [/unit]
    [/event]

    #start

    [event]
        name=start

        [message]
            speaker=Eliomir
            message= _ "Sir Gerrick, you must make it back to Kerlath Province and warn your people of the danger from the south. We will lead you through the forest and clear any foes from your path. You may choose some of our veterans to go with you as well, and any ones you leave behind will still have time to catch up with Ethiliel and Deoran."
        [/message]

        [remove_shroud]
            side=1
            x=8-10
            y=0-2
        [/remove_shroud]

        {HIGHLIGHT_IMAGE 9 1 items/gohere.png ()}

        [message]
            speaker=Sir Gerrick
            message= _ "With the bandits and undead vanquished behind us, what foes can there be ahead? Let us hope this is a speedy journey, for the specter of winter looms."
        [/message]

        [objectives]
            side=1
            [objective]
                description= _ "Move Sir Gerrick to the north end of the woods"
                condition=win
            [/objective]
            [objective]
                description= _ "Death of Sir Gerrick"
                condition=lose
            [/objective]
            [objective]
                description= _ "Time runs out"
                condition=lose
            [/objective]

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

    # The nagas are sighted, and move to defend their home.
    # They are enraged if you allied with the mermen in "Born to the Banner"

    [event]
        name=sighted
        [filter]
            id=Queen Xeila
        [/filter]

        [if]
            [variable]
                name=has_mermen
                equals="yes"
            [/variable]
            [then]
                [message]
                    # wmllint: local spelling Hss
                    speaker=Queen Xeila
                    message= _ "Hss... Here are the humans who have made a pact with the cursed mermen! Hss..."
                [/message]
                [message]
                    speaker=Eliomir
                    message= _ "We have stumbled into a den of nagas!"
                [/message]
                [message]
                    speaker=Queen Xeila
                    message= _ "Hss... We will kill them all, my brood. Hss..."
                [/message]
                [message]
                    speaker=Sir Gerrick
                    message= _ "We must clear this road for Deoran and Ethiliel! We must destroy the naga lair!"
                [/message]
            [/then]
            [else]
                [message]
                    speaker=Queen Xeila
                    message= _ "Hss... elves! Are they friends or enemies? Hss..."
                [/message]
                [message]
                    speaker=Sir Gerrick
                    message= _ "We are weary travelers, seeking our homes. If you but let us pass..."
                [/message]
                [message]
                    speaker=Queen Xeila
                    message= _ "Hss... And humans! Humans drained our swamps and made them fields for farms, and now they have found my winter nest. The Land-Walkers must die! Hss..."
                [/message]
                [message]
                    speaker=Sir Gerrick
                    message= _ "She won't listen. If we leave these nagas here, they will ambush Deoran and Ethiliel! We must destroy them!"
                [/message]
            [/else]
        [/if]

        {VARIABLE naga_queen_sighted yes}

        [objectives]
            side=1
            [objective]
                description= _ "Move Sir Gerrick to the north end of the woods"
                condition=win
            [/objective]
            [objective]
                description= _ "Defeat the Queen Xeila"
                condition=win
            [/objective]
            [objective]
                description= _ "Death of Sir Gerrick"
                condition=lose
            [/objective]
            [objective]
                description= _ "Time runs out"
                condition=lose
            [/objective]

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

    [event]
        name=sighted
        [filter]
            type=Naga Fighter,Naga Warrior,Naga Myrmidon

            [not]
                id=Queen Xeila
            [/not]
        [/filter]

        [if]
            [variable]
                name=naga_queen_sighted
                not_equals=yes
            [/variable]

            [then]
                [message]
                    speaker=second_unit
                    message= _ "There are a group of naga occupying this area... they don't look very friendly."
                [/message]

                [message]
                    speaker=Sir Gerrick
                    message= _ "if they are hostile to us, they could endanger Deoran and Ethiliel as well. Perhaps their leader can be reasoned with."
                [/message]
            [/then]
        [/if]
    [/event]

    # Queen Xeila dies...

    [event]
        name=last breath
        [filter]
            id=Queen Xeila
        [/filter]
        [message]
            speaker=Queen Xeila
            message= _ "Hss... Who will watch over my brood now? Hss..."
        [/message]
    [/event]

    # Kramak, the wild ogre
    #po: The ogre purposely has very bad grammar, because he is very stupid.

    [event]
        name=sighted
        [filter]
            id=Kramak
        [/filter]
        [message]
            speaker=Kramak
            message= _ "Ho! Me see elves. Elves tasty? Me take elves to eat."
        [/message]
        [message]
            race=elf
            # wmllint: local spelling Mr.
            message= _ "Err, Mr. Ogre, we are not very tasty."
        [/message]
        [message]
            speaker=Kramak
            message= _ "Oh. Me only want tasty food. Go away."
        [/message]
        [message]
            speaker=Kramak
            message= _ "..."
        [/message]
        [message]
            speaker=Kramak
            message= _ "Wait! Me not believe you. Me eat you!"
        [/message]
    [/event]

    [event]
        name=last breath
        [filter]
            id=Kramak
        [/filter]
        [message]
            speaker=Ogre
            message= _ "Bad food! It hurt me. Arrrrggghhhh!!"
        [/message]
    [/event]

    # The Dark Adept's Story
    [event]
        name=sighted
        [filter]
            id=Abdur
        [/filter]
        [message]
            speaker=Abdur
            message= _ "Travelers in this desolate land! I seek that dark Sage who is rumored to dwell in these lands. Surely you have come from him?"
        [/message]
        [message]
            speaker=Sir Gerrick
            message= _ "Indeed! I just left my comrades, who were preparing to kill the vile Necromancer."
        [/message]
        [message]
            speaker=Abdur
            message= _ "Unworthy fools! I'll kill you for this sacrilege!"
        [/message]
    [/event]

    # Sir Gerrick moves to the head of the road
    [event]
        name=moveto
        first_time_only=no
        [filter]
            id=Sir Gerrick
            x,y=9,1
        [/filter]

        [if]
            [have_unit]
                id=Queen Xeila
            [/have_unit]

            [then]
                [message]
                    speaker=Sir Gerrick
                    message= _ "These naga are still in control of the road. We must clear the way for Deoran and Ethiliel!"
                [/message]

                [allow_undo][/allow_undo]
            [/then]

            [else]
                [removeitem]
                    x,y=9,1
                [/removeitem]

                [message]
                    speaker=Sir Gerrick
                    message= _ "I will hasten back to Kerlath Province now and seek the advice of the Council of Westin..."
                [/message]
                [message]
                    speaker=Eliomir
                    message= _ "We too will return to our councils. We have much to tell them... Much indeed."
                [/message]
                [message]
                    speaker=narrator
                    message= _ "While the council debated the best course of action, Deoran and Ethiliel prepared to enter the caves under Mebrin's fortress..."
                    image=wesnoth-icon.png
                [/message]

                # The next scenario is again led by Deoran, so store away Gerrick and
                # his troops, except those remaining on the recall list.

                [store_unit]
                    [filter]
                        id=Sir Gerrick
                    [/filter]

                    kill=yes
                    variable=stored_Sir_Gerrick
                [/store_unit]

                {VARIABLE stored_Sir_Gerrick.canrecruit no}

                [store_unit]
                    variable=stored_Sir_Gerrick_army
                    [filter]
                        side=1
                        {NOT_ON_RECALL_LIST}
                    [/filter]
                    kill=yes
                [/store_unit]

                # Reinstate Deoran as the leader and unstore Hylas, Ethiliel and
                # troops so they're all again recallable in the next scenario.

                {VARIABLE stored_Deoran.x 16}
                {VARIABLE stored_Deoran.y 23}

                [unstore_unit]
                    variable=stored_Deoran
                [/unstore_unit]

                [unstore_unit]
                    variable=stored_Ethiliel
                [/unstore_unit]

                [unstore_unit]
                    variable=stored_Hylas
                [/unstore_unit]

                {FOREACH stored_elvish_bodyguards i}
                    [unstore_unit]
                        variable=stored_elvish_bodyguards[$i]
                    [/unstore_unit]
                {NEXT i}

                [modify_side]
                    side=1
                    gold=$stored_Deoran_side.gold
                [/modify_side]

                {CLEAR_VARIABLE stored_Deoran}
                {CLEAR_VARIABLE stored_Ethiliel}
                {CLEAR_VARIABLE stored_Hylas}
                {CLEAR_VARIABLE stored_elvish_bodyguards}

                [endlevel]
                    result=victory
                    bonus=no
                    {NEW_GOLD_CARRYOVER 100}
                    carryover_report=no
                [/endlevel]
            [/else]
        [/if]
    [/event]
[/scenario]
