#textdomain wesnoth-trow
[scenario]
    id=15_A_New_Land
    name= _ "A New Land"
    next_scenario=16_The_Kalian
    map_data="{campaigns/The_Rise_Of_Wesnoth/maps/15_A_New_Land.map}"

    victory_when_enemies_defeated=no
    turns=unlimited
    {DEFAULT_SCHEDULE}

    {SCENARIO_MUSIC wanderer.ogg}

    [story]
        [part]
            story=_ "After the defeat of the Nagas, Haldric’s refugees take on fresh water and hunt small game, relieved to have land beneath their feet. When they depart, even the sea-weather is milder."
        [/part]
        [part]
            story=_ "After a week’s steady sailing eastward, they begin to hear the cries of gulls and feel the loom of the land. The Great Continent appears before them over the summer-lit seas."
            background=story/trow_story_15-A_New_Land.jpg
        [/part]
    [/story]

    {TROW_GC_TRACK {JOURNEY_15_NEW} }

    {TROW_DEATHS}

    [side]
        type=Noble Commander
        id=Prince Haldric
        name= _ "Prince Haldric"
        unrenamable=yes
        side=1
        canrecruit=yes
        gold=100
        controller=human
        team_name=Haldric
        user_team_name=_"Refugees"
        {FLAG_VARIANT loyalist}
    [/side]

    [side]
        type=Elvish Marshal
        id=Glimir
        name= _ "Glimir"
        side=2
        canrecruit=yes
        {GOLD 150 220 300}
        team_name=Continentals
        user_team_name=_"Continentals"
        recruit=Elvish Archer, Elvish Fighter, Elvish Shaman, Elvish Hero, Elvish Marksman, Elvish Druid
        [ai]
            {NO_SCOUTS}
            recruitment_pattern=fighter,archer,fighter,archer,healer

            [aspect]
                id=recruitment_instructions

                [facet]
                    [value]
                        [recruit]
                            type=Elvish Hero,Elvish Marksman,Elvish Druid
                            number=1
                            importance=2
                            blocker=yes
                        [/recruit]
                        [recruit]
                            type=Elvish Archer,Elvish Fighter,Elvish Shaman
                            number=1
                            importance=1
                            blocker=no
                        [/recruit]
                    [/value]
                [/facet]
            [/aspect]

            {MODIFY_AI_ADD_CANDIDATE_ACTION 2 main_loop (
                [candidate_action]
                    engine=lua
                    name=retreat
                    id=retreat
                    max_score=101000
                    location="campaigns/The_Rise_Of_Wesnoth/ai/ca_retreat.lua"
                [/candidate_action]
            )}
            {MODIFY_AI_ADD_CANDIDATE_ACTION 2 main_loop (
                [candidate_action]
                    engine=lua
                    name=aggressive_attack_no_suicide
                    id=aggressive_attack_no_suicide
                    max_score=100000
                    location="campaigns/The_Rise_Of_Wesnoth/ai/ca_aggressive_attack_no_suicide.lua"
                [/candidate_action]
            )}
            {MODIFY_AI_DELETE_CANDIDATE_ACTION 2 main_loop high_xp_attack}
            {MODIFY_AI_DELETE_CANDIDATE_ACTION 2 main_loop combat}
        [/ai]
        {FLAG_VARIANT wood-elvish}
    [/side]

    {STARTING_VILLAGES 2 8}

    [side]
        type=Dwarvish Lord
        id=Dursil
        name= _ "Dursil"
        side=3
        canrecruit=yes
        {GOLD 150 220 300}
        team_name=Continentals
        user_team_name=_"Continentals"
        recruit=Dwarvish Fighter, Dwarvish Thunderer, Dwarvish Guardsman, Dwarvish Steelclad, Dwarvish Thunderguard, Dwarvish Pathfinder
        [ai]
            {NO_SCOUTS}
            recruitment_pattern=fighter,mixed fighter,fighter,mixed fighter,scout

            [aspect]
                id=recruitment_instructions

                [facet]
                    [value]
                        [recruit]
                            type=Dwarvish Steelclad,Dwarvish Thunderguard,Dwarvish Pathfinder
                            number=1
                            importance=2
                            blocker=yes
                        [/recruit]
                        [recruit]
                            type=Dwarvish Fighter,Dwarvish Thunderer,Dwarvish Guardsman
                            number=1
                            importance=1
                            blocker=no
                        [/recruit]
                    [/value]
                [/facet]
            [/aspect]

            {MODIFY_AI_ADD_CANDIDATE_ACTION 3 main_loop (
                [candidate_action]
                    engine=lua
                    name=retreat
                    id=retreat
                    max_score=101000
                    location="campaigns/The_Rise_Of_Wesnoth/ai/ca_retreat.lua"
                [/candidate_action]
            )}
            {MODIFY_AI_ADD_CANDIDATE_ACTION 3 main_loop (
                [candidate_action]
                    engine=lua
                    name=aggressive_attack_no_suicide
                    id=aggressive_attack_no_suicide
                    max_score=100000
                    location="campaigns/The_Rise_Of_Wesnoth/ai/ca_aggressive_attack_no_suicide.lua"
                [/candidate_action]
            )}
            {MODIFY_AI_DELETE_CANDIDATE_ACTION 3 main_loop high_xp_attack}
            {MODIFY_AI_DELETE_CANDIDATE_ACTION 3 main_loop combat}
        [/ai]
        {FLAG_VARIANT knalgan}
    [/side]

    {STARTING_VILLAGES 3 14}

    [side]
        type=Elvish Champion
        id=Eowarar
        name= _ "Eowarar"
        side=4
        canrecruit=yes
        {GOLD 150 220 300}
        team_name=Continentals
        user_team_name=_"Continentals"
        recruit=Elvish Archer, Elvish Fighter, Elvish Hero, Elvish Ranger, Elvish Sorceress
        [ai]
            {NO_SCOUTS}
            recruitment_pattern=fighter,archer,mixed fighter,mixed fighter

            [aspect]
                id=recruitment_instructions

                [facet]
                    [value]
                        [recruit]
                            type=Elvish Hero,Elvish Ranger,Elvish Sorceress
                            number=1
                            importance=2
                            blocker=yes
                        [/recruit]
                        [recruit]
                            type=Elvish Archer,Elvish Fighter
                            number=1
                            importance=1
                            blocker=no
                        [/recruit]
                    [/value]
                [/facet]
            [/aspect]

            {MODIFY_AI_ADD_CANDIDATE_ACTION 4 main_loop (
                [candidate_action]
                    engine=lua
                    name=retreat
                    id=retreat
                    max_score=101000
                    location="campaigns/The_Rise_Of_Wesnoth/ai/ca_retreat.lua"
                [/candidate_action]
            )}
            {MODIFY_AI_ADD_CANDIDATE_ACTION 4 main_loop (
                [candidate_action]
                    engine=lua
                    name=aggressive_attack_no_suicide
                    id=aggressive_attack_no_suicide
                    max_score=100000
                    location="campaigns/The_Rise_Of_Wesnoth/ai/ca_aggressive_attack_no_suicide.lua"
                [/candidate_action]
            )}
            {MODIFY_AI_DELETE_CANDIDATE_ACTION 4 main_loop high_xp_attack}
            {MODIFY_AI_DELETE_CANDIDATE_ACTION 4 main_loop combat}
        [/ai]
        {FLAG_VARIANT long}
    [/side]

    {STARTING_VILLAGES 4 8}

    [event]
        name=prestart

        [store_unit]
            [filter]
                side=1
                canrecruit=yes
            [/filter]

            variable=stored_Haldric
            kill=yes
        [/store_unit]
    [/event]

    [event]
        name=start

        [objectives]
            [objective]
                description= _ "Avoid deaths for as long as possible" + "<span foreground='white'> <small>" + _"(the scenario ends when any unit perishes)" + "</small></span>"
                condition=win
            [/objective]
            [objective]
                description= _ "Death of Prince Haldric"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Lady Jessene"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Lord Typhon"
                condition=lose
            [/objective]
            #textdomain wesnoth
            notes_string = _"Gold carryover:"
            #textdomain wesnoth-trow
            [note]
                red,green,blue=255,255,192
                description= _ "You will receive a finish bonus — equal to an early finish bonus — for the number of turns you lasted."
            [/note]
            [note]
                red,green,blue=255,255,192
                description= _ "20% of finishing gold carried over to the next scenario." + "
<span foreground='white'><big>
"+
                    #textdomain wesnoth
                    _"Notes:"+"</big></span>"
                #textdomain wesnoth-trow
            [/note]
            [note]
                description= _ "Enemies will not initiate an attack if there is a risk of them dying."
            [/note]
        [/objectives]
    [/event]

    [event]
        name=start

        [message]
            speaker=narrator
            message= _ "Alas, the shore of the Great Continent was not so tranquil a place as it had appeared from at sea."
            image=wesnoth-icon.png
        [/message]
        [message]
            speaker=Glimir
            message= _ "Go home, you vile dwarves! By treaty you are pledged to only the hills and mountains to the north of the Great River. This is not your land."
        [/message]
        [message]
            speaker=Dursil
            message= _ "Our lands are become full, and our mines go to the bottom of the world. We have won our war against those things that live in the dark. By what right do you claim all of the forests of the world, and all of the land south of the Great River, and force us onto only the hills and mountains of the north? There are hills and mountains as good as any here in the south!"
        [/message]
        [message]
            speaker=Glimir
            message= _ "By the right of treaty, ancient but still true—"
        [/message]
        [message]
            speaker=Dursil
            # wmllint: local spelling namby-pamby
            message= _ "Hmph! You namby-pamby elves: <i>“We don’t cut the trees, we groom the forest.”</i> Our axes can get the wood for a fifth of the cost! I can charge half of what your people do, and still be rich, and I’m not the first to have the thought!"
        [/message]
        [message]
            speaker=Glimir
            message= _ "Wait, I see a ship. Many ships. We’re being invaded!"
        [/message]
        [message]
            speaker=Dursil
            message= _ "Umm, we’re being invaded? Fine, we’ll sort out our differences later. Let’s get them first."
        [/message]

        [sound]
            name=ambient/ship.ogg
        [/sound]

        [move_unit_fake]
            type=Galleon
            side=1
            x=1,7,10,10,9
            y=19,21,22,23,24
        [/move_unit_fake]

        {PLACE_IMAGE ("units/transport/galleon.png~RC(magenta>red)~FL(horiz)") 9 24}
        {PLACE_IMAGE ("units/transport/transport-galleon.png~RC(magenta>red)") 1 19}
        {PLACE_IMAGE ("units/transport/transport-galleon.png~RC(magenta>red)") 4 19}
        {PLACE_IMAGE ("units/transport/transport-galleon.png~RC(magenta>red)") 1 17}
        {PLACE_IMAGE ("units/transport/transport-galleon.png~RC(magenta>red)") 3 18}

        [move_unit_fake]
            type=$stored_Haldric.type
            side=1
            x=9,6
            y=24,24
        [/move_unit_fake]

        [unstore_unit]
            variable=stored_Haldric
        [/unstore_unit]

        [recall]
            id=Lady Jessene
            x=8
            y=24
        [/recall]
        [recall]
            id=Burin the Lost
            x=7
            y=25
        [/recall]
        [recall]
            id=Sir Ruddry
            x=8
            y=25
        [/recall]
        [recall]
            id=Sir Ladoc
            x=8
            y=25
        [/recall]
        [recall]
            id=Minister Edren
            x=7
            y=26
        [/recall]
        [recall]
            id=Lord Typhon
            x=6
            y=20
        [/recall]

        [message]
            speaker=Prince Haldric
            message= _ "We come in peace. May our peoples—"
        [/message]
        [message]
            speaker=Dursil
            message= _ "Get them!"
        [/message]
        [message]
            speaker=Lady Jessene
            message= _ "Gee, and you were practicing that speech for days. I guess that’s it for diplomacy then. Haldric, we should avoid bloodshed even if we have to ward them off. There has to be a peaceful resolution to this."
        [/message]
        [message]
            speaker=Burin the Lost
            message= _ "In the name of... This is the continent of my home. But I set out east. I must have traveled clear around the world."
        [/message]
        [message]
            speaker=Burin the Lost
            message= _ "My people are too far south. I don’t know what’s going on here. I’ll stick with you until the end. You’ve been a good friend. Just no more sea voyages."
        [/message]

        {CLEAR_VARIABLE stored_Haldric}
    [/event]

    [event]
        name=turn 3
        [message]
            speaker=Lady Jessene
            message= _ "I bet this wasn’t the welcome you were expecting."
        [/message]
    [/event]

    # Enemies' base income increases by 1 every turn
    [event]
        name=new turn
        first_time_only=no

        [modify_side]
            [filter_side]
                side=2,3,4
            [/filter_side]

            income="$($turn_number - 1)"
        [/modify_side]
    [/event]

    [event]
        name=die
        [filter]
            [not]
                id=Lady Jessene,Prince Haldric,Lord Typhon
            [/not]
        [/filter]

        [move_unit_fake]
            type=Elvish Shyde
            side=2
            x=42,40,39
            y=3,5,6
        [/move_unit_fake]

        {HERO (Autumn Shyde) (Lady Dionli) ( _ "Lady Dionli") 2 39 6 ("portraits/dionli.png")}
        [+unit]
            facing=sw
        [/unit]

        [message]
            speaker=Lady Dionli
            message= _ "What? What’s going on here? Dwarves? Humans? Ships? Glimir, tell me."
        [/message]
        [message]
            speaker=Glimir
            message= _ "The stories are true. There must be dwarven colonists in the Brown Hills. We caught this band chopping wood near the bay. Then we saw lots of ships. Not like before, with that fellow from Southbay and his lone ship. It was always interesting when he stopped by."
        [/message]
        [message]
            speaker=Glimir
            # wmllint: local spelling erm
            message= _ "We thought we were being invaded. We, erm, put our differences aside with the dwarves, for the moment, and decided to deal with this first."
        [/message]
        [message]
            speaker=Lady Dionli
            message= _ "These are disturbing trends. Human, it is by luck alone that I am here to spare you. For on this day the Council of Lords is meeting in a forest not far from here."
        [/message]
        [message]
            speaker=Prince Haldric
            message= _ "I am Prince Haldric. We come in peace. May our peoples—"
        [/message]
        [message]
            speaker=Lady Jessene
            message= _ "Haldric."
        [/message]
        [message]
            speaker=Lady Dionli
            message= _ "As for you, dwarf, return to the Brown Hills. Then tell your people to prepare to return to the north."
        [/message]
        [message]
            speaker=Dursil
            message= _ "I’ll return to the hills, but I can’t promise that my people will go. Hmph!"
        [/message]
        [message]
            speaker=Lady Dionli
            message= _ "Haldric, is it? You are their leader? You and your advisers are to come with me. It will be safe for your passengers to disembark here."
        [/message]

        [move_unit_fake]
            type=Familiar
            side=4
            x=1,3
            y=11,11
        [/move_unit_fake]

        {LIVING_INTEL (Familiar) (Familiar) ( _ "Familiar") "portraits/familiar.png" 4 3 11}

        [kill]
            id=Familiar
        [/kill]

        [move_unit_fake]
            type=Familiar
            side=4
            x=3,4,4,1
            y=11,10,9,8
        [/move_unit_fake]

        [message]
            speaker=Lady Jessene
            message={WHISPER _"Maybe it’d be best if you didn’t mention our little friend following us..."}
        [/message]

#ifdef EASY
        [message]
            speaker=Lord Typhon
            message= _ "I must return to my people. You have kept your word, you may avail of my services in the future. The services of my people will remain at your disposal."
        [/message]
#else
        [disallow_recruit]
            side=1
            type=Merman Fighter,Merman Hunter
        [/disallow_recruit]

        [message]
            speaker=Lord Typhon
            message= _ "I must return to my people. My warriors that fought by your side wish to remain with you. You have kept your word, and you may avail of my services in the future."
        [/message]
#endif

        [kill]
            id=Lord Typhon
        [/kill]

        [message]
            speaker=Prince Haldric
            message= _ "May the currents carry you swiftly, my friend. " + {WHISPER _"Jessene, send word that a third of the fleet is to return to the Green Isle, to look for more survivors. If they return tell them to keep returning until no more survivors are found."}
        [/message]
        [message]
            speaker=Prince Haldric
            message={WHISPER _"Man the ships with skeleton crews, and give them the remaining supplies. Pass the word to Lord Typhon. Make sure that no more than a third of the fleet is sent. We must not provide the orcs with a ready-made fleet. Make haste, return before it is time to meet with these, what are they? Ahh, elves."}
        [/message]
        [message]
            speaker=Prince Haldric
            message= _ "This is the second Eldaric I get to say goodbye to. At least this time it is easier than the first."
        [/message]

        [set_variable]
            name=num_done
            value=0
        [/set_variable]

        [set_variable]
            name=a_beach
            value=0
        [/set_variable]

        [set_variable]
            name=cursed_isle
            value=0
        [/set_variable]

        [set_variable]
            name=the_dragon
            value=0
        [/set_variable]

        [set_variable]
            name=troll_hole
            value=0
        [/set_variable]

        [set_variable]
            name=last_done
            value="none"
        [/set_variable]

        [modify_turns]
            value=$turn_number
        [/modify_turns]
        [modify_turns]
            add=$turn_number
        [/modify_turns]

        [endlevel]
            #Bet I scared a few people there
            result=victory
            bonus=yes
            {NEW_GOLD_CARRYOVER 20}
            next_scenario=16_The_Kalian
        [/endlevel]
    [/event]
[/scenario]
