#textdomain wesnoth-sota

# We are switching to Ras-Tabahn for the next three scenarios. Ardonna and her recall
# list still exist and will be back later.

# Moving a unit to the jailhouse gets you two loyal, level-0 units. One is a ruffian, and
# the other is a female version of a ruffian called a delinquent. She can't level into a
# thug, but both of them can level into DAs. (This is recommended. You can eventually have
# a pair of loyal ancient liches if you take this option.) Winning the scenario also
# works to get these units.

[scenario]
    name= _ "Carcyn"  # The name of the city and its most prominent citizen
    map_data="{campaigns/Secrets_of_the_Ancients/maps/08_Carcyn.map}"

    id=08_Carcyn
    next_scenario=09_Training_Session
    victory_when_enemies_defeated=no

    [story]
        [part]
            [background_layer]
                image=story/black-background.png
                scale=yes
                base_layer=yes
            [/background_layer]
            [image]
                x,y=400,200
                centered=yes
                file=portraits/humans/necromancer.png~FL()
            [/image]
            title= _ "<i>Chapter Two:</i> Two Missions"
            show_title=yes
            title_alignment=left
            story= _ "We will first follow the adventures of Ras-Tabahn.

After several days of travel, he approached the frontier town of Carcyn."
        [/part]
        {JOURNEY_PART 8}
    [/story]

    {DEFAULT_SCHEDULE}
    {DEFAULT_MUSIC_PLAYLIST}
    {TURNS 28 28 28}

    [side]
        # wmllint: who SIDE_1_RAS-TABAHN is Ras-Tabahn
        # wmllint: unwho RECALL_LOYAL_UNITS
        {SIDE_1_RAS-TABAHN}
        {GOLD 200 200 200}
    [/side]

    [side]
        side=2
        controller=ai
        user_team_name= _ "Town Defense"
        type=Swordsman
        name= _ "Carcyn Fisher"
        id=Carcyn Fisher
        recruit=Cavalryman,Spearman,Bowman
        profile=portraits/humans/swordsman-2.png
        # Not a lot of gold is needed because of the large income from the villages:
        {GOLD 100 150 200}
        {FLAG_VARIANT loyalist}
    [/side]
    {LIMIT_RECRUITS 2 Cavalryman 4}
    {STARTING_VILLAGES  2 30}

    # *************************** PRESTART ***************************
    [event]
        name=prestart

        [objectives]
            side=1
            [objective]
                description= _ "Capture every village"
                condition=win
            [/objective]
            {ALTERNATIVE_OBJECTIVE ( _ "Kill every enemy unit")}

            {HOW_TO_LOSE_WITH_RAS-TABAHN}

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

        # Add the units Ras-Tabahn had in his laboratory to his recall list:
        [unit]
            type=Shadow
            side=1
            name= _ "Vash-Gorn"
        [/unit]
        [unit]
            type=Ghost
            experience=6
            side=1
        [/unit]
        [unit]
            type=Skeleton
            experience=3
            side=1
        [/unit]
        [unit]
            type=Skeleton
            experience=16
            side=1
        [/unit]

        [unit]
            x,y=14,9
            type=Mage
            side=2
            name= _ "Wynran"
            id=Wynran
            [modifications]
                {TRAIT_STRONG}
                {TRAIT_RESILIENT}
            [/modifications]
        [/unit]

        [unit]
            x,y=15,10
            type=Mage
            side=2
            name= _ "Raydah"
            id=Raydah
            gender=female
            [modifications]
                {TRAIT_QUICK}
                {TRAIT_INTELLIGENT}
            [/modifications]
        [/unit]

        [label]
            x,y=4,8
            text= _ "Inn"
            color=255, 255, 255
        [/label]
        [label]
            x,y=6,4
            text= _ "Tackle Shop"  #po: or Fishing Supplies
            color=255, 255, 255
        [/label]
        [label]
            x,y=3,15
            text= _ "Cemetery"
            color=255, 255, 255
        [/label]
        [label]
            x,y=10,9
            text= _ "Mercantile"  #po: the old word for "general store"
            color=255, 255, 255
        [/label]
        [label]
            x,y=18,8
            text= _  "Carcyn"  #po: The name of the city
            color=255, 255, 255
        [/label]
        [label]
            x,y=18,13
            text= _ "Public House"  #po: the old word for "pub". "Bar" is about the same.
            color=255, 255, 255
        [/label]
        [label]
            x,y=4,12
            text= _ "Jailhouse"  #po: or just "Jail"
            color=255, 255, 255
        [/label]
        [label]
            x,y=23,3
            text= _ "Boatworks"  #po: or Boatyard
            color=255, 255, 255
        [/label]
        [label]
            x,y=25,8
            text= _ "Grange Hall"  #po: "Grange" in the American usage: farmers' association
            color=255, 255, 255
        [/label]
        [item]
            x,y=4,1
            image=items/boat.png~RC(magenta>white)
        [/item]
        [item]
            x,y=23,2
            image=items/boat.png~RC(magenta>orange)~FL()
        [/item]
    [/event]

    # *************************** PLAY ***************************
    # After recruiting a second unit, Carcyn has filled his starting castle. He doesn't
    # move to the other, larger castle to continue recruiting unless we tell him to:
    [event]
        name=recruit
        [filter]
            side=2
        [/filter]

        [event]
            name=recruit
            [filter]
                side=2
            [/filter]
            [move_unit]
                id=Carcyn Fisher
                to_x=20
                to_y=9
            [/move_unit]
        [/event]
    [/event]

    # We want the magi to move out with the other units, not on their own, so we'll
    # take away their movement points before the other units get recruited.
    [event]
        name=side 2 turn 1 refresh

        [modify_unit]
            [filter]
                type=Mage
            [/filter]
            moves=0
        [/modify_unit]
    [/event]

    # Moving a unit to the jailhouse gets you two loyal, level-0 units.
    [event]
        name=moveto
        [filter]
            x,y=4,12
            side=1
        [/filter]
        [fire_event]
            name=get_kids
        [/fire_event]
    [/event]

    [event]
        name=get_kids

        [move_unit_fake]
            type=Delinquent
            side=1
            x=4,5
            y=12,12
        [/move_unit_fake]
        [unit]
            x,y=5,12
            type=Delinquent
            side=1
            name= _ "Shynal"
            id=Shynal
            gender=female
            {IS_LOYAL}
            [modifications]
                {TRAIT_LOYAL}
                {TRAIT_RESILIENT}
            [/modifications]
            profile="portraits/shynal-outlaw.png"
        [/unit]
        [move_unit_fake]
            type=Ruffian
            side=1
            x=4,5
            y=12,13
        [/move_unit_fake]
        [unit]
            x,y=5,13
            type=Ruffian SotA
            side=1
            name= _ "Carcyn"
            id=Carcyn
            {IS_LOYAL}
            [modifications]
                {TRAIT_LOYAL}
                {TRAIT_STRONG}
            [/modifications]
        [/unit]
        [message]
            speaker=Carcyn
            message= _ "Carcyn Fisher at your service, and this is my friend Shynal."
        [/message]
        [message]
            speaker=Shynal
            message= _ "“Friend?” (<i>Giggle</i>) Oh, yes, we’re very good friends."
        [/message]
        [message]
            speaker=Carcyn
            message= _ "Or... you know. Thanks so much for getting us out, sir. We would be glad to follow you!"
        [/message]
        [message]
            speaker=Ras-Tabahn
            message= _ "You are Carcyn the Third I presume?"
        [/message]
        [if]
            [have_unit]
                id=Carcyn Fisher
            [/have_unit]
            [then]
                [message]
                    speaker=Carcyn
                    message= _ "Don’t remind me. My father is the one who threw me in this hole."
                [/message]
                [message]
                    speaker=Carcyn Fisher
                    message= _ "You stay out of this, son."
                [/message]
                [message]
                    speaker=Carcyn
                    message= _ "Not a chance! I’ve waited all my life to see someone put you in your place. Here is someone you can’t push around!"
                [/message]
                [message]
                    speaker=Shynal
                    message= _ "And we’re leaving this stinking town!"
                [/message]
            [/then]
            [else]
                [message]
                    speaker=Carcyn
                    message= _ "The only Carcyn now. I’ve waited all my life to see someone to put my father in his place. I guess you did that."
                [/message]
                [message]
                    speaker=Shynal
                    message= _ "You’re the only Carcyn for me."
                [/message]
            [/else]
        [/if]
    [/event]

    [event]
        name=recruit, recall
        [filter]
            side=1
        [/filter]
        [message]
            speaker=Raydah
            message= _ "Look at that! He’s not from the Academy."
        [/message]
        [message]
            speaker=Carcyn Fisher
            message= _ "Hold your tongue! I can see that! I tolerate advisors but not when they only speak the obvious."
        [/message]
    [/event]

    [event]
        name=last breath
        [filter]
            id=Carcyn Fisher
        [/filter]
        [message]
            speaker=Ras-Tabahn
            message= _ "I warned you not to defy me."
        [/message]
    [/event]

    # *************************** OPENING / ENDING ***************************
    [event]
        name=start

        [message]
            speaker=Ras-Tabahn
            message= _ "Greetings! I am Ras-Tabahn the mage."
        [/message]
        [message]
            speaker=Carcyn Fisher
            message= _ "Greetings, traveler. I am Carcyn Fisher the Second. How can I be of service?"
        [/message]
        [message]
            speaker=Ras-Tabahn
            message= _ "I come with an offer. An offer of training in the magical arts. An offer of learning, adventure, and escape from this town."
        [/message]
        [message]
            speaker=Carcyn Fisher
            message= _ "No one in <i>my</i> town wishes to “escape”! We don’t care to hear your offer. Peddle your corruption elsewhere."
        [/message]
        [message]
            speaker=Ras-Tabahn
            message= _ "The offer is not intended for <i>you</i>, it is for your youth. I will send my agents to every house and public space in this town and repeat my offer. You will allow this."
        [/message]
        [message]
            speaker=Carcyn Fisher
            message= _ "I will do no such thing! I will be dead before I allow you to ensorcell our children!"
        [/message]
        [message]
            speaker=Ras-Tabahn
            message= _ "That may well be true."
        [/message]
    [/event]

    [event]
        name=turn 2
        [message]
            speaker=Ras-Tabahn
            message= _ "Hmm. The youngsters most willing to leave may be the ones in the jailhouse. I should investigate."
        [/message]
    [/event]

    [event]
        name=capture,die
        first_time_only=no

        # Check for a win.
        [if]
            # If there are no villages left that are not owned by side 1...
            [not]
                [have_location]
                    terrain=*^V*
                    [not]
                        owner_side=1
                    [/not]
                [/have_location]
            [/not]
            # ...OR all enemy units are dead...
            [or]
                [not]
                    [have_unit]
                        side=2
                    [/have_unit]
                [/not]
            [/or]
            [then]
                [capture_village]
                    side=1
                    x=1-99
                    y=1-99
                [/capture_village]
                [delay]
                    time=800
                [/delay]
                [fire_event]
                    name=get_kids
                [/fire_event]
                # ...then the player wins.
                [message]
                    speaker=narrator
                    image=portraits/humans/dark-adept.png~SCALE(93, 93)
                    message= _ "You can now recruit dark adepts!"
                [/message]
                # This message is actually a lie. DA recruitment is not added
                # until the end of the next scenario. We don't want the
                # automatically-recruited DA's there to be able to recruit more.
                [clear_variable]
                    name=side_2_limited_recruits,side_2_limited_recruits_length
                [/clear_variable]
                [endlevel]
                    result=victory
                    bonus=yes
                    {NEW_GOLD_CARRYOVER 40}
                [/endlevel]
            [/then]
            [else]
                [allow_undo]
                [/allow_undo]
            [/else]
        [/if]
    [/event]

    [event]
        name=time over

        [message]
            speaker=Ras-Tabahn
            message= _ "This has taken too long. We will surely miss our meeting with Ardonna now."
        [/message]
    [/event]

    {HERO_DEATHS}
    {KIDS_ADVANCE}
[/scenario]
