#textdomain wesnoth-sota

# -------------
# Conventions for SoTA Scenario Files:
# There are four sections to most scenario files. The first is story, map, side
# definitions, and schedule. Then there is prestart, play, and opening/ending. These
# three sections are clearly marked. Prestart just has the prestart event. Opening/ending
# contains most of the dialog and the scenario-ending events. Play has everything else.
# Macros are usually defined right before the event in which they are used. However, if
# they are very long or used in more than one section, they get their own marked section
# just before prestart. If they are used in more than one scenario, they go in sota-utils.
# -------------

# The placement of enemies in this scenario is carefully adjusted rather than totally
# random. That's why there are so many macro calls. Wild animals can't pass through
# fences. To block them, we use a custom terrain overlay (code: ^Fync). It is a copy of
# the core fence, except that it is an alias of unwalkable. Bats are unaffected because
# they are flying, and Ardonna gets an object that lets her go through unwalkable terrain
# until the end of this scenario.

[scenario]
    name= _ "Slipping Away"
    map_data="{campaigns/Secrets_of_the_Ancients/maps/01_Slipping_Away.map}"

    id=01_Slipping_Away
    next_scenario=02_Dark_Business
    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=story/book.png
            [/image]
            title= _ "<i>Chapter One:</i> Unlawful Research"
            show_title=yes
            title_alignment=left
            story= _ "<i>From the Journal of Ardonna of Tarrynth</i>

9 XII, 22 YW:

It’s unfair that we humans must die after so few years. Elves and dwarves live far longer. Though this may be the natural order, we need not embrace it! The lords on the Green Isle knew how to live forever. Pursuit of that knowledge was declared illegal by King Haldric I, but I believe it is worth the risk. As I watched my family waste away of various maladies, I vowed that I would not share their fate, and if I can rediscover the secrets of the ancients I will be a hero to the whole continent! I shall begin research in earnest this winter."
        [/part]
        [part]
            [background_layer]
                image=story/room1.jpg
                scale=no
            [/background_layer]
            story= _ "26 II, 23 YW:

My experiments with bats have proven unfruitful. I have determined that they do not truly drain the life force of their victims — it is an illusion. The loss of blood weakens the victim, while the bat gains vitality because it has fed. There is nothing I can learn from bats about extending life. Now I have a problem. I am forced to keep the bats and pretend they are my pets because I cannot admit why I was studying them. In truth, it is not a burden — I have grown somewhat fond of the creatures, and I don’t mind appearing eccentric. I am already marked as different because my hair is so light, and I lack a sense of smell."
        [/part]
        [part]
            [background_layer]
                image=story/room2.jpg
                scale=no
            [/background_layer]
            story=_ "4 III, 23 YW:

Today, headmaster Aimucasur himself taught a class on moving objects with one’s mind. The technique involves projecting one’s will inside the item, and then learning to move it as an extension of the body. Incantations focus the mind to the task. We practiced with inanimate objects, but clearly the same principle could be applied to unliving flesh. Nobody dared voice the thought, because showing interest in the necromantic arts results in expulsion. I was pondering that fact in class when I noticed Aimucasur glowering at me. I must be more careful in the future about which of my thoughts appear on my face."
        [/part]
        [part]
            [background_layer]
                image=story/room3.jpg
                scale=no
            [/background_layer]
            story= _ "15 III, 23 YW:

One of my bats must have been old, for it died. Boldly then, I decided to animate the corpse. I was pleased to see that it worked, but what was interesting was this: The first time the bat twitched, I felt a last spark of life energy flash through its body. I noted that it flowed through some kind of pathway. That gave me an idea. With my mind, I searched out all the life force pathways in its body using what I could sense in the living bats as a guide. Then I animated <i>them</i> all at once, and the bat slowly flapped off the floor on its own! (That is a trick old Aimucasur probably doesn’t know!) Even better, the energy running through the life force network seemed to maintain itself, so I didn’t need to continue to concentrate. Could this be the whole secret? Could all the ancient lords have had someone bring them back <i>after</i> death? I would need another mage I trusted completely, but perhaps I can find someone with whom to make a pact."
        [/part]
        [part]
            [background_layer]
                image=story/room4.jpg
                scale=no
            [/background_layer]
            story= _ "Later:

With further observation, I have determined that this is probably not the way to avoid death. The reanimated bat has no will! It does nothing unless I nudge it with my mind. Perhaps the will of a human is stronger, and someday soon I will have the opportunity to find out... because I’m quitting the Academy. I will be in my room when old Morvihn checks for the night, but not two hours later! I grow weary of this place and its restrictions on thought. So, no more brown initiate’s robes, no more being ridiculed on account of my hair, no more pompous instructors. I will teach myself the so-called “dark” arts and learn how to live forever! The ancients from the Green Isle found a way, so I can discover it too. When all these oldsters here find themselves breathing their last, they will have to beg me for the secret. Perhaps I will be generous. Perhaps not."
        [/part]
        {JOURNEY_PART 1}
    [/story]

    {FIRST_WATCH_HOUR2}
    {FIRST_WATCH_HOUR2}
    {FIRST_WATCH_HOUR3}
    {FIRST_WATCH_HOUR3}
    {FIRST_WATCH_HOUR4}
    {FIRST_WATCH_HOUR4}
    {MIDNIGHT_HOUR}
    {MIDNIGHT_HOUR}
    {SECOND_WATCH_HOUR1}
    {SECOND_WATCH_HOUR1}
    {SECOND_WATCH_HOUR2}
    {SECOND_WATCH_HOUR2}
    {SECOND_WATCH_HOUR3}
    {SECOND_WATCH_HOUR3}
    {SECOND_WATCH_HOUR4}
    {SECOND_WATCH_HOUR4}
    {SECOND_WATCH_HOUR5}
    {SECOND_WATCH_HOUR5}
    {SECOND_WATCH_HOUR6}
    {SECOND_WATCH_HOUR6}
    {DAWN_HOUR}

    {DEFAULT_MUSIC_PLAYLIST}
    {TURNS 20 20 20}

    [side]
        # wmllint: who SIDE_1_ARDONNA_EARLY is Ardonna
        {SIDE_1_ARDONNA_EARLY}
        facing=se
        {GOLD 15 5 0}
        fog=yes
    [/side]

    [side]
        side=2
        controller=ai
        no_leader=yes
        hidden=yes
    [/side]

    # *************************** MACROS ***************************
#define PLACE_BAT X Y TRAIT1
    [unit]
        type=Vampire Bat SotA
        x={X}
        y={Y}
        side=1
        [modifications]
            {TRAIT_{TRAIT1}}
        [/modifications]
    [/unit]
#enddef

#define PLACE_WOLF X Y TRAIT1 TRAIT2 SPECIAL
    [unit]
        type=Wolf
        x={X}
        y={Y}
        side=2
        [modifications]
            {TRAIT_{TRAIT1}}
            {TRAIT_{TRAIT2}}
        [/modifications]
        {SPECIAL}
    [/unit]
#enddef

#define PLACE_RAT X Y
    [unit]
        type=Giant Rat
        x={X}
        y={Y}
        side=2
    [/unit]
#enddef

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

        [objectives]
            side=1
            [objective]
                description= _ "Move Ardonna to the signpost"
                condition=win
            [/objective]

            {HOW_TO_LOSE_WITH_ARDONNA}

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

            [note]
                description= _ "This scenario takes place entirely at night."
            [/note]
            [note]
                description= _ "Ardonna can climb over a fence for 2 movement points, but wild animals cannot."
            [/note]
        [/objectives]

        [label]
            x,y=39,2
            text= _ "Llorvin"  # The name of the town mentioned in the opening.
        [/label]

        # Player's starting units:
        {PLACE_BAT 5 23 QUICK}
        {PLACE_BAT 4 23 RESILIENT}
        {PLACE_BAT 4 24 INTELLIGENT}
        {PLACE_BAT 5 25 STRONG}
        {PLACE_BAT 6 24 RESILIENT}
        [unit]
            x,y=6,23
            type=Walking Corpse
            variation=bat
            side=1
        [/unit]

        # Fences are unwalkable, but not for Ardonna.
        [object]
            silent=yes
            duration=scenario
            [filter]
                id=Ardonna
            [/filter]
            [effect]
                apply_to=movement_costs
                replace=yes
                [movement_costs]
                    unwalkable=2
                [/movement_costs]
            [/effect]
            [effect]
                apply_to=defense
                replace=yes
                [defense]
                    unwalkable=50
                [/defense]
            [/effect]
        [/object]

        {PLACE_WOLF 39 4 QUICK RESILIENT ai_special=guardian}
        {PLACE_WOLF 35 2 RESILIENT INTELLIGENT ai_special=guardian}
        {PLACE_WOLF 17 16 QUICK INTELLIGENT ()}
        {PLACE_RAT 26 1}
        {PLACE_RAT 38 14}
        {PLACE_RAT 24 20}
        {PLACE_RAT 28 8}
#ifdef EASY
        {PLACE_WOLF 35 4 AGED RESILIENT ()}
#endif
#ifndef EASY
        {PLACE_WOLF 24 7 QUICK RESILIENT ()}
        {PLACE_WOLF 42 1 STRONG INTELLIGENT ()}
        {PLACE_RAT 25 21}
#endif
#ifdef HARD
        {PLACE_WOLF 42 25 STRONG RESILIENT ()}
#endif
    [/event]

    # *************************** PLAY ***************************
    [event]
        name=turn 6
        {PLACE_RAT 25 1}
        {PLACE_RAT 42 21}
    [/event]

    [event]
        name=turn 7
        {PLACE_WOLF 10 25 QUICK INTELLIGENT ()}
#ifndef EASY
        {PLACE_WOLF 23 1 QUICK STRONG ()}
        {PLACE_WOLF 42 21 STRONG RESILIENT ()}
#endif
#ifdef HARD
        {PLACE_WOLF 42 22 QUICK RESILIENT ()}
        {PLACE_WOLF 15 1 RESILIENT INTELLIGENT ()}
#endif
    [/event]

    # This macro is to make rats move out of the castle instead of simply materializing.
#define MOVE_AND_PLACE_RAT X Y
    [move_unit_fake]
        type=Giant Rat
        x=28,{X}
        y=16,{Y}
        side=2
    [/move_unit_fake]
    {PLACE_RAT {X} {Y}}
#enddef

    [event]
        name=recruit

        [event]
            name=side 2 turn end
            {MOVE_AND_PLACE_RAT 27 16}
            {MOVE_AND_PLACE_RAT 29 17}
#ifndef EASY
            {MOVE_AND_PLACE_RAT 28 15}
            {MOVE_AND_PLACE_RAT 29 16}
#endif
            [message]
                speaker=Ardonna
                message= _ "I suspected some of the rats would show themselves."
            [/message]
        [/event]
    [/event]

    # *************************** OPENING / ENDING ***************************
    [event]
        name=start
        [message]
            speaker=Ardonna
            message= _ "I should get off the island in case the ethics committee is concerned about a rogue mage. I shall not be dragged back in disgrace! I should be able to reach the town of Llorvin before morning. I can hide there until I can head for the dock. I will need some traveling money for that, so go, my bat friends, and find me some gold!"
        [/message]
        [message]
            speaker=Ardonna
            message= _ "It would be good to have even more bats as well. There was a colony in that ruined castle where we practiced conjuring fire, so I will try to find that. The castle was also infested with huge rats as I remember, but I can certainly destroy those. I will have to use ice though, as I never mastered fire."
        [/message]
        {HIGHLIGHT_IMAGE 39 2 "scenery/signpost.png" ()}
    [/event]

    [event]
        name=sighted
        [filter]
            race=wolf
        [/filter]
        [message]
            speaker=Ardonna
            message= _ "A wolf! This journey may be more dangerous than I thought. If we need to, I suppose we could rest inside a farmer's or woodcutter's fence."
        [/message]
    [/event]

    [event]
        name=moveto
        [filter]
            id=Ardonna
            x,y=39,2
        [/filter]

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

    [event]
        name=time over

        [message]
            speaker=Ardonna
            message= _ "The morning has come, and I am still in the open. I will be caught for sure!"
        [/message]
    [/event]

    {HERO_DEATHS}
    {MANAGE_PROFILE}

#undef PLACE_WOLF
#undef PLACE_BAT
#undef PLACE_RAT
#undef MOVE_AND_PLACE_RAT
[/scenario]
