#textdomain wesnoth-dw

# You're welcome for the free, loyal brawler. There are two cages on the
# shore. One contains Keshan, a drake burner who can be *very* useful
# during the campaign, and the other contains a poacher named
# Siddry. He's not going to be much help here; you will have to work
# to keep him alive, and he won't come with you. However, if you
# succeed, he comes back in The Flaming Sword with some friends who
# are a big help taking villages in the beginning (and not much help
# thereafter). If Siddry lives, he will be stored in a variable until
# then. The shipwreck in the north contains a treasure chest with 100
# gold.
#
# Send someone north to get gold. Recruit about two castles, one of
# which should be all level 2's. Hopefully that includes at least one
# more healer. Healers are *essential* here. Any units close to
# leveling are especially good. Send everyone east. Be aggressive in
# taking out the troops and getting to the leader, but don't leave any
# units out and exposed. You should probably instigate the slave
# rebellion as night comes at the end of your first offensive. That
# will keep some the retalliation against you low, and slow down the
# saurians coming towards you from the north. When it's safe, rescue
# the drake, and try to get him some experience--carefully. After
# taking out the leader, you can recruit a unit or two as
# replacements, but you shouldn't need more than that. You should just
# be getting involved with the first wave from the north leader
# now. (He's slowed down by the water.) Sit tight around the castle
# until the enemy onslaught has thinned out. After that it should be
# no problem wiping out the other two leaders--if you have survived
# this far, you have quite a few high-level units.

[scenario]
    name= _ "Slavers"
    map_data="{campaigns/Dead_Water/maps/Slavers.map}"

    id=04_Slavers
    next_scenario=05_Tirigaz

    [story]
        [part]
            {DW_BIGMAP}
            story= _ "Now, they were farther away from home than most merfolk ever went. Only Cylanna and a few soldiers had been farther."
        [/part]
    [/story]

    {BIGMAP_04}

    {DEFAULT_SCHEDULE_DUSK}
    turns=10
    {TURNS4 30 28 26 24}

    [side]
        {SIDE_1}
        {GOLD4 180 180 160 150}
    [/side]
    {STARTING_VILLAGES 1 6}

    [event]
        name=prestart

        [music]
            name=breaking_the_chains.ogg
        [/music]

        {RECALL_LOYAL_UNITS}

        [objectives]
            side=1
            [objective]
                description= _ "Defeat all enemy leaders"
                condition=win
            [/objective]

            {HOW_TO_LOSE}

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

    [side]
        side=2
        team_name=good guys
        user_team_name= _ "Former Slaves"
        no_leader=yes
        color=black
        gold=0

        #These guys can't open the cage, so we'll keep them from
        #sitting on it keeping the player from opening it. I don't
        #like the situations where you're wishing your ally would
        #hurry up and die.
        [ai]
            [avoid]
                x=23,15
                y=27,10
            [/avoid]
            aggression=0
            grouping=defensive
            caution=0.9
        [/ai]
        {FLAG_VARIANT ragged}
    [/side]

    [side]
        side=3
        controller=ai
        user_team_name= _ "Saurian Slavers"
        team_name=bad guys

        id=Gilak
        name= _ "Gilak"
        canrecruit=yes

#ifdef EASY
        type=Saurian Ambusher
        recruit="Saurian Skirmisher, Saurian Augur"
#endif

#ifdef NORMAL
        type=Saurian Ambusher
        recruit="Saurian Skirmisher, Saurian Augur, Saurian Ambusher, Saurian Oracle"
#endif

#ifdef HARD
        type=Saurian Flanker
        recruit="Saurian Skirmisher, Saurian Augur, Saurian Ambusher, Saurian Oracle"
#endif

#ifdef NIGHTMARE
        type=Saurian Flanker
        recruit="Saurian Skirmisher, Saurian Augur, Saurian Ambusher, Saurian Oracle"
#endif

        #The badguys don't want to get too close to their prisoners
        [ai]
            [avoid]
                x=23,15
                y=27,10
            [/avoid]
        [/ai]

        {GOLD4 200 250 300 350}
        {INCOME4 8 10 12 12}
        [unit]
            type=Saurian Skirmisher
            ai_special=guardian
            name=Guardian
            generate_name=yes
            x,y=22,27
        [/unit]
        [unit]
            type=Saurian Skirmisher
            ai_special=guardian
            name=Guardian
            generate_name=yes
            x,y=24,26
        [/unit]
    [/side]

    [side]
        side=4
        controller=ai
        user_team_name= _ "Saurian Slavers"
        team_name=bad guys

        id=Raxisz
        name= _ "Raxisz"
        canrecruit=yes

#ifdef EASY
        type=Saurian Ambusher
        recruit="Saurian Skirmisher, Saurian Augur"
#endif

#ifdef NORMAL
        type=Saurian Ambusher
        recruit="Saurian Skirmisher, Saurian Augur, Saurian Ambusher, Saurian Oracle"
#endif

#ifdef HARD
        type=Saurian Flanker
        recruit="Saurian Skirmisher, Saurian Augur, Saurian Ambusher, Saurian Oracle"
#endif

#ifdef NIGHTMARE
        type=Saurian Flanker
        recruit="Saurian Skirmisher, Saurian Augur, Saurian Ambusher, Saurian Oracle"
#endif

        [ai]
            [avoid]
                x=23,15
                y=27,10
            [/avoid]
        [/ai]

        {GOLD4 120 170 220 280}
        {INCOME4 4 6 8 10}
        [unit]
            type=Saurian Skirmisher
            ai_special=guardian
            name=Guardian
            generate_name=yes
            x,y=23,18
        [/unit]
    [/side]

    [side]
        side=5
        controller=ai
        user_team_name= _ "Saurians"
        team_name=bad guys
        color=orange

        id=Aglizix
        name= _ "Aglizix"
        canrecruit=yes

#ifdef EASY
        type=Saurian Ambusher
        recruit="Saurian Skirmisher, Saurian Augur"
#endif

#ifdef NORMAL
        type=Saurian Flanker
        recruit="Saurian Skirmisher, Saurian Augur, Saurian Ambusher, Saurian Oracle"
#endif

#ifdef HARD
        type=Saurian Flanker
        recruit="Saurian Skirmisher, Saurian Augur, Saurian Ambusher, Saurian Oracle"
#endif

#ifdef NIGHTMARE
        type=Saurian Flanker
        recruit="Saurian Skirmisher, Saurian Augur, Saurian Ambusher, Saurian Oracle"
#endif

        [ai]
            [avoid]
                x=23,15
                y=27,10
            [/avoid]
        [/ai]

        {GOLD4 250 300 350 400}
        {INCOME4 8 10 12 14}

        [unit]
            type=Saurian Skirmisher
            ai_special=guardian
            name=Guardian
            generate_name=yes
            x,y=14,9
        [/unit]
        [unit]
            type=Saurian Skirmisher
            ai_special=guardian
            name=Guardian
            generate_name=yes
            x,y=19,8
        [/unit]
    [/side]

    {STARTING_VILLAGES_AREA 3 20 25 6}
    {STARTING_VILLAGES 5 6}
    {STARTING_VILLAGES 4 4}

#ifdef NORMAL
    {LIMIT_CONTEMPORANEOUS_RECRUITS 3 (Saurian Ambusher) 2}
    {LIMIT_CONTEMPORANEOUS_RECRUITS 3 (Saurian Oracle) 2}
    {LIMIT_CONTEMPORANEOUS_RECRUITS 4 (Saurian Ambusher) 2}
    {LIMIT_CONTEMPORANEOUS_RECRUITS 4 (Saurian Oracle) 2}
    {LIMIT_CONTEMPORANEOUS_RECRUITS 5 (Saurian Ambusher) 3}
    {LIMIT_CONTEMPORANEOUS_RECRUITS 5 (Saurian Oracle) 3}
#endif

#ifdef HARD
    {LIMIT_CONTEMPORANEOUS_RECRUITS 3 (Saurian Ambusher) 3}
    {LIMIT_CONTEMPORANEOUS_RECRUITS 3 (Saurian Oracle) 3}
    {LIMIT_CONTEMPORANEOUS_RECRUITS 4 (Saurian Ambusher) 3}
    {LIMIT_CONTEMPORANEOUS_RECRUITS 4 (Saurian Oracle) 3}
    {LIMIT_CONTEMPORANEOUS_RECRUITS 5 (Saurian Ambusher) 4}
    {LIMIT_CONTEMPORANEOUS_RECRUITS 5 (Saurian Oracle) 4}
#endif

#ifdef NIGHTMARE
    {LIMIT_CONTEMPORANEOUS_RECRUITS 3 (Saurian Ambusher) 3}
    {LIMIT_CONTEMPORANEOUS_RECRUITS 3 (Saurian Oracle) 4}
    {LIMIT_CONTEMPORANEOUS_RECRUITS 4 (Saurian Ambusher) 4}
    {LIMIT_CONTEMPORANEOUS_RECRUITS 4 (Saurian Oracle) 3}
    {LIMIT_CONTEMPORANEOUS_RECRUITS 5 (Saurian Ambusher) 4}
    {LIMIT_CONTEMPORANEOUS_RECRUITS 5 (Saurian Oracle) 4}
#endif

    [event]
        name=prestart

        {PLACE_IMAGE "units/drakes/burner.png~TC(2,magenta)" 23 27}
        {PLACE_IMAGE items/large_cage.png 23 27}
        {PLACE_IMAGE "units/human-outlaws/poacher.png~TC(2,magenta)" 15 10}
        {PLACE_IMAGE items/cage.png 15 10}

        {PLACE_IMAGE scenery/shipwreck-1.png 3 3}
        {PLACE_IMAGE items/underwater_rock1.png 5 4}
    [/event]

    [event]
        name=start

        [message]
            speaker=Kai Krellis
            message= _ "There are cages on the shore. I wonder why."
        [/message]

        [move_unit_fake]
            type=Merman Brawler
            x=15,5
            y=29,28
            side=1
        [/move_unit_fake]

        [unit]
            type=Merman Brawler
            id=Teeloa
            name= _ "Teelöa"
            unrenamable=yes
            x=5
            y=28
            side=1
            [modifications]
                {TRAIT_LOYAL}
                {TRAIT_RESILIENT}
            [/modifications]
            {IS_LOYAL}
        [/unit]

        [message]
            speaker=Teeloa
            message= _ "Help! Save me!"
        [/message]

        [message]
            speaker=Kai Krellis
            message= _ "Who are you? What is happening?"
        [/message]

        [message]
            speaker=Teeloa
            message= _ "My name is Teelöa. I have been a slave to these saurians for almost two years. I saw you coming up the coast in strength, so I fled. They follow in my wake, and without your protection they will surely kill me."
        [/message]

        [message]
            speaker=Kai Krellis
            message= _ "A slave!"
        [/message]

        [message]
            # wmllint: local spelling oursss
            speaker=Gilak
            message= _ "You! Merman! You have some property of oursss. Return it at once if you value your life."
        [/message]

        [message]
            speaker=Kai Krellis
            message= _ "If you mean this merman, Teelöa, he is no longer your property. No person should be the property of another. Release all your slaves, or the wrath of the merfolk will fall upon you!"
        [/message]

        [message]
            speaker=Cylanna
            message= _ "A brave and kindhearted choice! I cannot abide slavery."
        [/message]

        [message]
            speaker=Gwabbo
            #po: The phrase 'words of a man' does *not* have the sense of
            #po: 'words of a human' here; it signifies rather 'words of a
            #po: moral adult' as opposed to a child or dependant.
            message= _ "Those were the words of a man and a leader, Kai Krellis, and well spoken. The folk are truly yours now."
        [/message]

        [message]
            duration=30
            speaker=narrator
            image=wesnoth-icon.png
            message= _ "Kai Krellis saw that it was so. The refugee merfolk, sore in their pride from fleeing their enemies, cheered his ultimatum and made ready to fight with a will."
        [/message]

        [message]
            # wmllint: local spelling sssoon
            speaker=Gilak
            message= _ "Foolish merman! You will sssoon wish you had minded your own affairs."
        [/message]
    [/event]

    [event]
        name=turn 2

        [message]
            speaker=Kai Krellis
            message= _ "Perhaps if I called out to the slaves, I could rouse them to help us fight against their captors."
        [/message]

        [if]
            [have_unit]
                id=Gwabbo
            [/have_unit]
            [then]
                [message]
                    speaker=Gwabbo
                    message= _ "I think that would work. If I may make a suggestion though, I think we should wait for a more strategic moment."
                [/message]
                [message]
                    speaker=Kai Krellis
                    message= _ "Never hesitate to speak your counsel to me, Gwabbo. You have been my right arm on this journey; your courage and loyalty are well proven."
                [/message]
                [message]
                    speaker=Cylanna
                    message= _ "Those are the words of a true kai and your father’s son. I am proud of you, Krellis."
                [/message]
            [/then]
            [else]
                [message]
                    speaker=Cylanna
                    message= _ "I believe that would work, but many of them will be killed if you do it now. It might be better to wait."
                [/message]
            [/else]
        [/if]

        [message]
            duration=30
            speaker=narrator
            image=wesnoth-icon.png
            message= _ "You can choose when the slaves come out of their villages and attack their captors. When you are ready, right click anywhere and select the slave revolt."
        [/message]

#define PUT_SLAVE TYPE X Y
    [unit]
        type={TYPE}
        x={X}
        y={Y}
        side=2
        generate_name=yes
    [/unit]
#enddef

        [set_menu_item]
            id=peasant_revolt_menu_option
            description= _ "Inspire the slaves to revolt"

            [command]
                # Remove menu item
                [set_menu_item]
                    id=peasant_revolt_menu_option
                    [show_if]
                        [not]
                        [/not]
                    [/show_if]
                [/set_menu_item]

                [message]
                    speaker=Kai Krellis
                    message= _ "Hear this! Slaves, the merfolk have sworn war against your tormentors. If you would be free, arise and seize your liberty!"
                [/message]

                {PUT_SLAVE Peasant 23 29}
                {PUT_SLAVE Ruffian 21 28}
                {PUT_SLAVE Ruffian 22 28}
                {PUT_SLAVE (Merman Citizen) 25 24}
                {PUT_SLAVE (Merman Citizen) 15 29}
                {PUT_SLAVE (Merman Brawler) 14 28}
                {PUT_SLAVE Ruffian 18 22}
                {PUT_SLAVE Peasant 19 22}
                {PUT_SLAVE Ruffian 25 13}
                {PUT_SLAVE Peasant 24 13}
                {PUT_SLAVE Peasant 22 18}
                {PUT_SLAVE Peasant 23 19}
                {PUT_SLAVE Thief 15 6}
                {PUT_SLAVE Peasant 16 5}
                {PUT_SLAVE (Merman Citizen) 21 7}
                {PUT_SLAVE (Merman Citizen) 20 7}
                {PUT_SLAVE (Merman Citizen) 25 23}
                {PUT_SLAVE (Merman Citizen) 12 10}
                {PUT_SLAVE (Merman Citizen) 13 10}
                {PUT_SLAVE Ruffian 16 12}
                {PUT_SLAVE Peasant 17 13}
#ifdef HARD
                {PUT_SLAVE Thug 19 23}
                {PUT_SLAVE (Merman Brawler) 18 23}
                {PUT_SLAVE (Merman Brawler) 23 28}
#endif
#ifdef NIGHTMARE
                {PUT_SLAVE Thug 19 23}
                {PUT_SLAVE (Merman Brawler) 18 23}
                {PUT_SLAVE (Merman Brawler) 23 28}
                {PUT_SLAVE Thug 22 29}
                {PUT_SLAVE (Merman Brawler) 15 28}
                {PUT_SLAVE (Merman Brawler) 16 28}
#endif
                [message]
                    speaker=narrator
                    message= _ "Cheers erupted from several villages, and former slaves rushed out with whatever meager weapons they could find, or fists and rocks if no weapons were to hand. Screams and curses came from the saurian castles."
                    image=wesnoth-icon.png
                [/message]
            [/command]
        [/set_menu_item]

#undef PUT_SLAVE
    [/event]

    [event]
        name=victory

        # If the player never used it, we will need to remove the menu item
        [set_menu_item]
            id=peasant_revolt_menu_option
            [show_if]
                [not]
                [/not]
            [/show_if]
        [/set_menu_item]
    [/event]

    [event]
        name=moveto
        first_time_only=yes
        [filter]
            x=3
            y=3
            side=1
        [/filter]
        [if]
            [variable]
                name=unit.id
                contains=Bat
            [/variable]
            [then]
                [message]
                    speaker=Kai Krellis
                    message= _ "There is a treasure chest there! Good bat!"
                [/message]
            [/then]
            [else]
                [message]
                    speaker=unit
                    message= _ "There is a treasure chest here!"
                [/message]
            [/else]
        [/if]
        [sound]
            name=gold.ogg
        [/sound]
        [gold]
            side=1
            amount=100
        [/gold]
        [message]
            speaker=narrator
            message= _ "You receive 100 gold."
            image=wesnoth-icon.png
        [/message]
    [/event]

    [event]
        name=moveto
        first_time_only=yes
        [filter]
            x=23
            y=27
            side=1
        [/filter]

        [if]
            [variable]
                name=unit.id
                contains=Bat
            [/variable]
            [then]
                [message]
                    speaker=$unit.id
                    message= _ "Neep!"
                [/message]
                [message]
                    speaker=Kai Krellis
                    message= _ "I believe our bat is impressed! That must be a drake. I am told they are fearsome, but honorable, creatures. I think we can let him out of the cage."
                [/message]
            [/then]
            [else]
                [if]
                    [variable]
                        name=unit.id
                        equals=Kai Krellis
                    [/variable]
                    [then]
                        [message]
                            speaker=Kai Krellis
                            message= _ "This must be a drake. I am told they are honorable creatures. I am going to let him out of the cage."
                        [/message]
                    [/then]
                    [else]
                        [message]
                            speaker=Kai Krellis
                            message= _ "That must be a drake. I am told they are fearsome, but honorable, creatures. Let him out of the cage."
                        [/message]
                        [message]
                            speaker=unit
                            message= _ "Uh...If you say so."
                        [/message]
                    [/else]
                [/if]
            [/else]
        [/if]

        [remove_item]
            x,y=$x1,$y1
        [/remove_item]
        [unit]
            type=Drake Burner
            id=Keshan
            name= _ "Keshan"
            unrenamable=yes
            x=23
            y=27
            side=1
            [modifications]
                {TRAIT_LOYAL}
                {TRAIT_INTELLIGENT}
            [/modifications]
            {IS_LOYAL}
        [/unit]

        [message]
            speaker=Kai Krellis
            message= _ "What is your name?"
        [/message]

        [message]
            speaker=Keshan
            message= _ "I am Keshan."
        [/message]

        [message]
            speaker=Kai Krellis
            message= _ "How did you come to be in a cage?"
        [/message]

        [message]
            speaker=Keshan
            message= _ "I was hunting north of here when the small ones captured me. I killed many, but I was humiliated in the end."
        [/message]

        [message]
            speaker=Kai Krellis
            message= _ "Will you fight with us, Keshan?"
        [/message]

        [message]
            speaker=Keshan
            message= _ "You have released me, so I owe you a great debt. I will fight with you."
        [/message]

        [message]
            speaker=Gwabbo
            message= _ "Don’t let him go too crazy. Those saurian spears will go right through his scales."
        [/message]
    [/event]

    [event]
        name=moveto
        first_time_only=yes
        [filter]
            x=15
            y=10
            side=1
        [/filter]

        [remove_item]
            x,y=$x1,$y1
        [/remove_item]

        [unit]
            type=Poacher
            id=Siddry
            name= _ "Siddry"
            unrenamable=yes
            x=15
            y=10
            side=1
            [modifications]
                {TRAIT_LOYAL}
                {TRAIT_RESILIENT}
            [/modifications]
            {IS_LOYAL}
        [/unit]

        [if]
            [variable]
                name=unit.id
                contains=Bat
            [/variable]
            [then]
                [message]
                    speaker=$unit.id
                    message= _ "Neep?"
                [/message]
                [message]
                    speaker=Kai Krellis
                    message= _ "Who are you, and what are you doing in a cage?"
                [/message]
            [/then]
            [else]
                [message]
                    speaker=unit
                    message= _ "Who are you, and what are you doing in a cage?"
                [/message]
            [/else]
        [/if]

        [message]
            speaker=Siddry
            message= _ "My name is Siddry. These cursed saurians nabbed me a week ago — wanted me to turn overseer to their other slaves. I wouldn’t do it, so they caged me with them. They tried to take my bow too, but they had some trouble with that."
        [/message]

        [message]
            speaker=Kai Krellis
            message= _ "So you will help us defeat them?"
        [/message]

        [message]
            speaker=Siddry
            message= _ "The way I see it, you’re helping me. There is nothing I would like better than to put their slavery to an end. I can’t swim, so I won’t be able to come with you on your travels, but I will owe you. If there is anything I can do in the future, I will do it."
        [/message]

        [message]
            speaker=Kai Krellis
            message= _ "Well met, then, friend. I am Kai Krellis, leader of the people of Jotha."
        [/message]
    [/event]

    [event]
        name=enemies defeated

        [if]
            [have_unit]
                side=2
            [/have_unit]

            [then]
                [message]
                    side=2
                    message= _ "Kai Krellis, you have freed us, and we are forever in your debt. How can we repay you?"
                [/message]

                [message]
                    speaker=Kai Krellis
                    message= _ "I will not ask you to follow me. You have suffered enough for the benefit of others. Go back to your families if you have them, and work for yourselves from now on."
                [/message]
            [/then]
        [/if]

        [if]
            [have_unit]
                id=Siddry
                type=Poacher,Trapper,Huntsman,Ranger    # Just in case one of the slaves also has that name
            [/have_unit]
            [then]
                [store_unit]
                    [filter]
                        id=Siddry
                    [/filter]
                    variable=Siddry_stored
                    kill=yes
                [/store_unit]
            [/then]
            [else]
                [set_variable]
                    name=Siddry_stored
                    value=no
                [/set_variable]
            [/else]
        [/if]

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

    {HERO_DEATHS}
[/scenario]
