#textdomain wesnoth-sotbe
[scenario]
    id=07_The_Desert_of_Death
    name= _ "The Desert of Death"
    map_data="{campaigns/Son_Of_The_Black_Eye/maps/07_The_Desert_of_Death.map}"
    {TURNS 26 24 22}

    {DEFAULT_SCHEDULE}

    next_scenario=08_Silent_Forest

    {SCENARIO_MUSIC "wanderer.ogg"}
    {EXTRA_SCENARIO_MUSIC "the_dangerous_symphony.ogg"}

    [event]
        name=prestart
        [objectives]
            side=1
            [objective]
                description= _ "Reach the Oasis"
                condition=win
            [/objective]
            [objective]
                description= _ "Death of Kapou’e"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Grüü"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of a Shaman"
                condition=lose
            [/objective]

            {TURNS_RUN_OUT}

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

        [micro_ai]
            side=3
            ai_type=simple_attack
            action=add

            [filter_second]
                [not]
                    ability=regenerates
                [/not]
                [filter_wml]
                    [not]
                        [status]
                            poisoned=yes
                        [/status]
                    [/not]
                [/filter_wml]
            [/filter_second]
            weapon=1
        [/micro_ai]

        [capture_village]
            side=2
            y=20-30
        [/capture_village]
    [/event]

    [side]
        side=1
        id="Kapou'e"
        type=Orcish Leader
        controller=human
        team_name=Kapoue
        user_team_name=_ "Kapou’e"
        gold=100
        fog=yes
        {BLACK_FLAG}
    [/side]

    [side]
#ifdef HARD
        type=Assassin
#else
        type=Rogue
#endif
        id=Ar-Dant
        name= _ "Ar-Dant"
        side=2
        team_name=villains
        user_team_name=_"Villains"
        canrecruit=yes
        {GOLD 20 60 100} # There's quite a bit of income by the time they mobilize
        {FLAG_VARIANT ragged}
    [/side]

    [side]
        no_leader=yes
        type=Giant Scorpion
        side=3
        team_name=villains
        user_team_name=_"Villains"
        canrecruit=no
        [ai]
            aggression=1.0
            [goal]
                name=target
                [criteria]
                    side=1
                [/criteria]
                value=3
            [/goal]
        [/ai]
    [/side]

    [story]
        [part]
            story= _ "Resting during the day and doing most of their marching by night, the party moved steadily through the sand for two days."
            {SOTBE_BIGMAP}
            {JOURNEY_06_OLD}
        [/part]

        [part]
            story= _ "The heat of the day and the chill of the night wore heavily on the orcs. Fortunately, they didn’t encounter any giant scorpions, but neither did they discover any source of food or water."
            {SOTBE_BIGMAP}
            {JOURNEY_06_OLD}
        [/part]

        [part]
            story= _ "By the dawn of the third day the party was hungry, tired and weary, but according to their map, a good-sized oasis was not far away."
            {SOTBE_BIGMAP}
            {JOURNEY_06_OLD}
        [/part]

        [part]
            story= _ "Just then, however, a strong wind began to blow. It rapidly increased in fury, whipping hot sand up all around them. They could see little further than the reach of their hands and it began to seem they would be buried alive by smothering sand."
            {SOTBE_BIGMAP}
            {JOURNEY_06_OLD}
        [/part]
    [/story]

    {BIGMAP_07}

    [event]
        name=start

        [recall]
            id=Grüü
        [/recall]
        [recall]
            id=Jetto
        [/recall]
        [recall]
            id=Pirk
        [/recall]
        [recall]
            id=Gork
        [/recall]
        [recall]
            id=Vraurk
        [/recall]

        [message]
            speaker="Kapou'e"
            message= _ "Ack! This blasted sand!"
            image=portraits/kapoue-angry.png
        [/message]
        [message]
            speaker="Grüü"
            message= _ "I’m hungry and we found no giant scorpion yet. I’m sure it would be tasty."
        [/message]
        [message]
            speaker="Kapou'e"
            message= _ "I hope we won’t find one! They are terrible armored beasts; your hammer would be useless against their heavy shells."
        [/message]
        [message]
            speaker="Vraurk"
            message= _ "I’ve been told the best way to defeat them is to attack their eyes with sharp blades, set them afire, or pierce them with arrows. But I hope too we won’t meet them."
        [/message]
        [message]
            speaker="Pirk"
            message= _ "I wouldn’t worry about the scorpions right now, I would worry about getting out of this sandstorm! These things can last for weeks, and if we aren’t buried alive by all the sand we will die of hunger and thirst."
        [/message]
        [message]
            speaker="Kapou'e"
            message= _ "Hurry then, break camp, we must get to the oasis!"
        [/message]

        [message]
            speaker="Pirk"
            message= _ "What?! Through all this chaos?!"
        [/message]

        [message]
            speaker="Kapou'e"
            message= _ "We don’t have any other choice. If we remain here we’ll die."
        [/message]

        {NOTRAIT_UNIT 3 "Giant Scorpion" 8 13}
        {NOTRAIT_UNIT 3 "Giant Scorpion" 15  6}
        {NOTRAIT_UNIT 3 "Giant Scorpion" 19 12}
        {NOTRAIT_UNIT 3 "Giant Scorpion" 13 10}
        {NOTRAIT_UNIT 3 "Giant Scorpion" 11 16}
#ifdef NORMAL
        {NOTRAIT_UNIT 3 "Giant Scorpion" 15  3}
#endif
#ifdef HARD
        {NOTRAIT_UNIT 3 "Giant Scorpion"  6 14}
        {NOTRAIT_UNIT 3 "Giant Scorpion" 15  3}
#endif
        {NOTRAIT_UNIT 3 "Giant Scorpion" 26  4}
        {NOTRAIT_UNIT 3 "Giant Scorpion" 11 22}
    [/event]

    [event]
        name=enemies defeated

        [message]
            speaker="Kapou'e"
            message= _ "Finally we’ve done it! Now let’s wait out this sandstorm, resupply and get some rest before we continue on our journey."
        [/message]

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

    [event]
        name=new turn
        first_time_only=no

        {RANDOM "0..99"}
        {VARIABLE scorp_prob 30}
#ifdef NORMAL
        {VARIABLE scorp_prob 60}
#endif
#ifdef HARD
        {VARIABLE scorp_prob 90}
#endif

        [if]
            [variable]
                name=turn_number
                less_than=11
            [/variable]
            [variable]
                name=random
                less_than=$scorp_prob
            [/variable]
            [then]
                [store_locations]
                    x,y=1-38,1-30
                    terrain=D*
                    [not]
                        [filter]
                        [/filter]
                        radius=8
                    [/not]
                    variable=scorpion_locs
                [/store_locations]

                {RANDOM "1..$scorpion_locs.length"}
                {VARIABLE_OP random sub 1}
                #{MESSAGE narrator "" "" "New scorpion at: $scorpion_locs[$random].x $scorpion_locs[$random].y"}
                {NOTRAIT_UNIT 3 "Giant Scorpion" $scorpion_locs[$random].x $scorpion_locs[$random].y}
            [/then]
        [/if]
        {CLEAR_VARIABLE random,scorp_prob,scorpion_locs}
    [/event]

    [event]
        name=sighted,moveto
        [filter]
            side=3
            [filter_vision]
                side=1
            [/filter_vision]
        [/filter]

        [message]
            speaker="Kapou'e"
            message= _ "There you go, Grüü, there is your giant scorpion!"
        [/message]

        [message]
            speaker=Vraurk
            message= _ "Oh great, perfect timing."
        [/message]

        [message]
            speaker=Grüü
            message= _ "Yeah, I am really hungry."
        [/message]

        [message]
            speaker=Vraurk
            message= _ "That is not what I meant!"
        [/message]
    [/event]

    [event]
        name=die

        [filter]
            type=Giant Scorpion
        [/filter]

        [filter_second]
            id=Grüü
        [/filter_second]

        [message]
            speaker=Grüü
            message= _ "Ahh, finally! Lunchtime!"
        [/message]

        [message]
            speaker=Vraurk
            message= _ "You trolls are just sick!"
        [/message]

        [message]
            speaker=Grüü
            message= _ "<i>Yuck</i>! Disgusting! These things taste horrible!"
        [/message]

        [message]
            speaker="Kapou'e"
            message= _ "I don’t know if you should have eaten that, Grüü, you don’t look so good."
        [/message]

        [message]
            speaker=Grüü
            message= _ "Ugh... I feel sick."
        [/message]

        [message]
            speaker=Gork
            message= _ "Hmmm, it seems that scorpions are poisonous."
        [/message]

        [message]
            speaker=Vraurk
            message= _ "But what about Grüü?"
        [/message]

        [message]
            speaker="Kapou'e"
            message= _ "Ahh, he will be fine in a few minutes. He is a troll, after all. Right, Grüü?"
        [/message]

        [message]
            speaker=Grüü
            message= _ "(<i>Puke</i>)"
        [/message]

        {VARIABLE second_unit.status.poisoned yes}

        [unstore_unit]
            variable=second_unit
            find_vacant=no
            #textdomain wesnoth
            text= _ "poisoned"
            #textdomain wesnoth-sotbe
            {COLOR_HARM}
        [/unstore_unit]
    [/event]

    # Activate bandits when orcs get far enough south
    [event]
        name=moveto
        [filter]
            side=1
            y=19-30
        [/filter]

        [set_recruit]
            side=2
#ifdef EASY
            recruit=Thief,Thug
#endif
#ifdef NORMAL
            recruit=Thief,Bandit
#endif
#ifdef HARD
            recruit=Rogue,Bandit
#endif
        [/set_recruit]
    [/event]

    {ON_SIGHTING () 1 side=2 (
        [message]
            speaker=second_unit
            message= _ "Hold it right there! This oasis is ours! Begone or you all will be killed!"
        [/message]

        [message]
            speaker="Kapou'e"
            message= _ "Look, fool, we are in the middle of a sandstorm, and we are almost completely out of food and water. There is no way we can keep going without stopping at this oasis."
        [/message]

        [message]
            speaker=second_unit
            message= _ "I don’t care, get lost!"
        [/message]

        [message]
            speaker=Pirk
            message= _ "It’s no use reasoning with them, Kapou’e, they aren’t going to listen."
        [/message]

        [message]
            speaker="Kapou'e"
            message= _ "Yeah, I can see that. Well, I guess we have to clean these rabble out of here."
        [/message]

        [objectives]
            side=1
            [objective]
                description= _ "Defeat Ar-Dant"
                condition=win
            [/objective]
            [objective]
                description= _ "Death of Kapou’e"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Grüü"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of a Shaman"
                condition=lose
            [/objective]

            {TURNS_RUN_OUT}

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

    [event]
        name=time over

        [message]
            speaker=Grüü
            message= _ "... Food...!"
        [/message]

        [message]
            speaker=Vraurk
            message= _ "... Water...!"
        [/message]

        [message]
            speaker="Kapou'e"
            message= _ "... Come... on..., people...! We have... to... keep... going..."
        [/message]

        [message]
            speaker=Pirk
            message= _ "... Can’t... The... heat... is... too... much..."
        [/message]
    [/event]

    {HERO_DEATHS}
[/scenario]
