#textdomain wesnoth-dm
[scenario]
    id=08_Ur-Thorodor
    name=_ "Ur-Thorodor"
    {MEMOIRS_MAP 08_Ur-Thorodor.map}
    next_scenario=09_Houses_of_the_Dead
    turns=18
    victory_when_enemies_defeated=no
    {DEFAULT_SCHEDULE}

    {SCENARIO_MUSIC elvish-theme.ogg}   # No story part, so no intro music
    {EXTRA_SCENARIO_MUSIC the_king_is_dead.ogg}
    {EXTRA_SCENARIO_MUSIC sad.ogg}
    {EXTRA_SCENARIO_MUSIC knolls.ogg}

    {DM_TRACK {SEARCH_STAGE8}}

    # wmllint: validate-off
    [side]
        side=1
        controller=human
        recruit=Mage,Spearman,Horseman,Bowman,Cavalryman,Heavy Infantryman
        save_id=Player
        team_name=allies
        user_team_name= _ "Loyalists"
        side_name= _ "Delfador"
        {FLAG_VARIANT loyalist}
        [leader]
            {YOUNG_DELFADOR}
        [/leader]
        [unit]
            {LIONEL}
            placement=leader
        [/unit]
        {GOLD 150 125 100}
    [/side]
    [event]
        name=prestart
        {MODIFY_UNIT (id=Delfador) facing nw}
        {MODIFY_UNIT (id=Lionel) facing se}
    [/event]
    {STARTING_VILLAGES 1 4}

    [side]
        side=2
        controller=ai
        recruit=Gryphon,Wose,Wose Shaman
        {GOLD 150 200 250}
        team_name=enemies
        user_team_name= _ "Wose"
        [leader]
            id=Ur-Thorodor
            name= _ "Ur-Thorodor"
            type=Ancient Wose
            facing=sw
        [/leader]
        [ai]
            passive_leader=yes #To avoid him being away from keep and next to Delfador
            caution=0.8 # make him use those woses well
            recruitment_pattern=scout,fighter,mixed fighter
        [/ai]
    [/side]
    {LIMIT_RECRUITS 2 (Gryphon) 2}
    {STARTING_VILLAGES 2 6}

    [side]
        side=3
        controller=null
        hidden=yes
        team_name=enemies
        user_team_name= _ "Pillagers"
        no_leader=yes
    [/side]
    # wmllint: validate-on

    [event]
        name=start

        [message]
            speaker=Lionel
            message=_"We have arrived. And there is the island Leollyn spoke of. But what are those strange shapes moving among the trees?"
        [/message]
        [message]
            speaker=Delfador
            message=_"I believe that they are woses — tree guardians. I have heard of them, but thought they were gone from Wesnoth forever. They are not evil, it is said, but yet they may be hostile to us. We had best be careful."
        [/message]
        [message]
            speaker=Ur-Thorodor
            message=_"I am Ur-Thorodor, eldest of the forest. Who are you human-creatures? You may not trespass on our island."
        [/message]
        {MODIFY_UNIT (id=Delfador) facing ne}
        [message]
            speaker=Delfador
            message=_"Ur-Thorodor, please let us pass! We are on a vital mission for King Garard, in the interests of all living things in Wesnoth."
        [/message]
        [message]
            speaker=Ur-Thorodor
            message=_"We care nothing for your kings, human-creatures. It is centuries since your kind have been here, and only now are our roots destroying the last of your accursed stonework. Now I will speak no more. Leave us, or suffer our wrath!"
        [/message]
        [message]
            speaker=Lionel
            message=_"This Ur-Thorodor should not speak of King Garard that way! <i>“Suffer our wrath”</i> indeed... I’ll show him wrath!"
        [/message]
        [message]
            speaker=Delfador
            message=_"It seems there is no alternative — we must get onto that island! Perhaps if we can get close to Ur-Thorodor, and speak with him again, he will understand."
        [/message]
        [objectives]
            side=1
            [objective]
                description=_ "Move Delfador to Ur-Thorodor’s castle"
                condition=win
            [/objective]
            [objective]
                description=_ "Death of Delfador"
                condition=lose
            [/objective]
            [objective]
                description=_ "Death of Lionel"
                condition=lose
            [/objective]
            [objective]
                description=_ "Death of Ur-Thorodor"
                condition=lose
            [/objective]

            {TURNS_RUN_OUT}

            [gold_carryover]
                bonus=no # next scenario is in the Land of the Dead
                carryover_percentage=0
            [/gold_carryover]
        [/objectives]
    [/event]

    # give the Woses a boost when their leader is first attacked
    [event]
        name=attack
        first_time_only=yes
        [filter_second]
            id=Ur-Thorodor
        [/filter_second]
        [gold]
            side=2
            amount=200
        [/gold]
        [message]
            speaker=Ur-Thorodor
            # wmllint: local spelling Hruuuarrgh
            message=_"Hruuuarrgh! The vile human-creatures hew at me..."
        [/message]
        [message]
            speaker=Delfador
            message=_"Ur-Thorodor, you must listen to us! A great evil power threatens all living things in Wesnoth — we must fight against it together, or all life here will perish."
        [/message]
        [message]
            speaker=Ur-Thorodor
            message=_"I trust no humans! Drive them out, my children!"
        [/message]
    [/event]

    [event]
        name=last breath
        [filter]
            id=Ur-Thorodor
        [/filter]
        [message]
            speaker=unit
            message=_"I am defeated... My children, hear my last words! Destroy the humans, and never let them set foot on our island again!"
        [/message]
        [message]
            speaker=Delfador
            message=_"This is hopeless! If carrying out my mission means killing these noble creatures, then I cannot continue."
        [/message]
        [endlevel]
            result=defeat
        [/endlevel]
    [/event]

    [event]
        name=moveto
        [filter]
            id=Delfador
            x=22,24,23,23
            y=10,10,12,11
        [/filter]
        [message]
            speaker=Delfador
            message=_"Ur-Thorodor, listen to me! We are not here to take your island. If you will let me remain here, then I promise you, on behalf of King Garard, that no Wesnothian will set foot on your island without your permission again. As a token of good faith, I command my army to return to the mainland."
        [/message]
        [message]
            speaker=Lionel
            message=_"Are you sure that’s wise?"
        [/message]
        [message]
            speaker=Delfador
            message=_"It’s the only way! Lionel, lead our soldiers back to the mainland. I will rejoin you when I have carried out my mission and determined what is amiss in the world of the dead."
        [/message]
        [message]
            speaker=Ur-Thorodor
            message=_"I see I had misjudged you, human. You are not like those who came before. I accept your offer!"
        [/message]
        [endlevel]
            result=victory
            carryover_report=yes
            bonus=no
            carryover_percentage=0
        [/endlevel]
    [/event]

    [event]
        name=victory

        {SAVE_WESNOTH_VETERANS}
        [kill]
            side=2
        [/kill]

        {SCROLL_TO 23 11}
        [delay]
            time=1000
        [/delay]
        [heal_unit]
            [filter]
                id=Delfador
            [/filter]
            amount=full
            animate=no
            moves=full
            restore_attacks=yes
            restore_statuses=yes
        [/heal_unit]
        {MOVE_UNIT (id=Delfador) 23 11}
        {MODIFY_UNIT (id=Delfador) facing sw}
        [delay]
            time=500
        [/delay]

        [message]
            speaker=narrator
            message=_"As the Wesnothians withdrew from the island, the woses melted away into the trees. Delfador began the meditation that would place him in contact with the spirit world.

But as Delfador’s meditation deepened, and the woses sank into their timeless dreams of earth and trees, something else stirred on the island — for a few orcish scouts had indeed crossed the Ford of Abez..."
            image=wesnoth-icon.png
        [/message]
        [message]
            speaker=Delfador
            message=_"Ommmmmmm..." # wmllint: no spellcheck
        [/message]

        [delay]
            time=800
        [/delay]
        [move_unit_fake]
            type=Goblin Knight
            side=3
            x=21,21,22,23,24,24
            y=8,9,9,10,10,11
        [/move_unit_fake]
        {NAMED_UNIT 3 (Goblin Knight) 24 11 Gurbash _"Gurbash" (facing=sw)}
        [move_unit_fake]
            type=Orcish Warrior
            side=3
            x=21,21,22,23
            y=8,9,9,10
        [/move_unit_fake]
        {NAMED_UNIT 3 (Orcish Warrior) 23 10 Pruark _"Pruark" (facing=sw)}

        [delay]
            time=800
        [/delay]
        [message]
            speaker=Pruark
            message=_"A human mage... is it dead?"
        [/message]
        [message]
            speaker=Gurbash
            message=_"Easy to find out... thump it and see if it wakes up!"
        [/message]
        [message]
            speaker=narrator
            message=_"<i>Thump</i>!"
            image=wesnoth-icon.png
        [/message]
        {COLOR_ADJUST -32 -32 -32}
        [delay]
            time=250
        [/delay]
        {COLOR_ADJUST -64 -64 -64}
        [delay]
            time=250
        [/delay]
        {COLOR_ADJUST -128 -128 -128}
        [delay]
            time=250
        [/delay]
        [put_to_recall_list]
            id=Delfador
        [/put_to_recall_list]
        [modify_side]
            side=1,2
            hidden=yes
        [/modify_side]
    [/event]

    {MEMOIRS_DEATHS}
[/scenario]
