#textdomain wesnoth-trow
[scenario]
    id=09_Fallen_Lich_Point
    name= _ "Fallen Lich Point"
    next_scenario=10_Sewer_of_Southbay
    victory_when_enemies_defeated=no
    map_data="{campaigns/The_Rise_Of_Wesnoth/maps/09_Fallen_Lich_Point.map}"
    {TURNS 39 36 33}
    {DEFAULT_SCHEDULE}

    {SCENARIO_MUSIC breaking_the_chains.ogg}
    {EXTRA_SCENARIO_MUSIC knolls.ogg}

    # No story part
    {TROW_GI_TRACK {JOURNEY_09_NEW} }

    {TROW_DEATHS}

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

    [side]
        type=Orcish Warlord
        id="Ut'Tan-Grilg"
        name= _ "Ut’Tan-Grilg"
        profile=portraits/orcs/grunt-3.png
        side=2
        canrecruit=yes
#ifdef EASY
        recruit=Orcish Archer, Orcish Assassin, Orcish Grunt, Wolf Rider, Orcish Crossbowman, Goblin Pillager, Goblin Knight, Goblin Spearman
#endif

#ifdef NORMAL
        recruit=Orcish Archer, Orcish Assassin, Orcish Grunt, Wolf Rider, Orcish Crossbowman, Goblin Knight, Orcish Slayer, Goblin Spearman
#endif

#ifdef HARD
        recruit=Orcish Archer, Orcish Assassin, Orcish Grunt, Wolf Rider, Orcish Crossbowman, Orcish Warrior, Goblin Knight, Goblin Pillager, Orcish Slayer, Goblin Spearman, Goblin Impaler
#endif
        {GOLD 210 250 290}
        team_name=orcs
        user_team_name=_"Orcs"
        [ai]
            {NO_SCOUTS}
            recruitment_pattern=scout,fighter,fighter,mixed fighter,archer
            {ATTACK_DEPTH 4 5 5}
        [/ai]
        [ai]
            time_of_day=first_watch,second_watch
            aggression=0.75
            caution=0.0
            grouping=no
        [/ai]
    [/side]

    {STARTING_VILLAGES 2 8}

    [side]
        type=Orcish Warlord
        id=Tan-Pulk
        name= _ "Tan-Pulk"
        side=3
        profile=portraits/orcs/grunt.png
        canrecruit=yes
#ifdef EASY
        recruit=Orcish Archer, Orcish Assassin, Orcish Grunt, Wolf Rider, Orcish Crossbowman, Goblin Pillager, Goblin Spearman
#endif

#ifdef NORMAL
        recruit=Orcish Archer, Orcish Assassin, Orcish Grunt, Wolf Rider, Orcish Crossbowman, Orcish Warrior, Goblin Pillager, Goblin Spearman
#endif

#ifdef HARD
        recruit=Orcish Archer, Orcish Assassin, Orcish Grunt, Wolf Rider, Orcish Crossbowman, Orcish Warrior, Goblin Knight, Goblin Pillager, Orcish Slayer, Goblin Spearman, Goblin Impaler
#endif

        {GOLD 210 250 290}
        team_name=orcs
        user_team_name=_"Orcs"
        [ai]
            {NO_SCOUTS}
            recruitment_pattern=scout,fighter,fighter,mixed fighter,archer
            {ATTACK_DEPTH 4 5 5}
        [/ai]
        [ai]
            time_of_day=first_watch,second_watch
            aggression=0.75
            caution=0.0
            grouping=no
        [/ai]
    [/side]

    {STARTING_VILLAGES 3 6}

#define PETRIFIED
    [status]
        petrified=yes
    [/status]
#enddef

    [side]
        side=4
        type=Lich
        id=Lich-Lord Caror
        name= _ "Lich-Lord Caror"
        canrecruit=yes
        recruit=Skeleton, Skeleton Archer, Ghost, Ghoul, Walking Corpse
        {GOLD 0 150 190}
        team_name=undead
        user_team_name=_"Undead"
        scroll_to_leader=no
        [ai]
            aggression=1.0
            recruitment_pattern=scout,fighter,fighter,archer
            {ATTACK_DEPTH 4 5 5}
            {NO_SCOUTS}
        [/ai]
        {PETRIFIED}
        {FLAG_VARIANT undead}
    [/side]

    [side]
        side=5
        no_leader=yes
        team_name=yetis
        user_team_name= _ "Yetis"
        hidden=yes
        # set these values as they will be displayed in the status table
        gold=0
        income=-2
        village_gold=0
        village_support=0
        [ai]
            village_value=0
        [/ai]
    [/side]

    [event]
        name=prestart

        {PLACE_IMAGE (scenery/signpost.png) 25 1}
        {PLACE_IMAGE (scenery/signpost.png) 14 8}
        {PLACE_IMAGE (scenery/monolith4.png) 14 30}
        {PLACE_IMAGE (scenery/mine-abandoned.png) 15 9}

#define PETRIFIED_UNIT TYPE X Y
    [unit]
        side=4
        type={TYPE}
        x={X}
        y={Y}
        {PETRIFIED}
        # upkeep cost removed so the gold doesn't change before the unpetrifying
        upkeep=loyal
    [/unit]
#enddef

        {PETRIFIED_UNIT "Bone Shooter" 12 35}
        {PETRIFIED_UNIT "Bone Shooter" 13 37}
        {PETRIFIED_UNIT "Bone Shooter" 11 37}
        {PETRIFIED_UNIT "Revenant" 13 36}
        {PETRIFIED_UNIT "Revenant" 12 37}
        {PETRIFIED_UNIT "Revenant" 11 36}

        [set_variable]
            name=lich_free
            value=0
        [/set_variable]
        [set_variable]
            name=have_book
            value=0
        [/set_variable]

        [hide_unit]
            x=33
            y=24
        [/hide_unit]

        [objectives]
            side=1
            [objective]
                description= _ "Kill the lich to get his book"
                condition=win
            [/objective]
            [objective]
                description= _ "Haldric enters Southbay’s sewer"
                condition=win
            [/objective]
            {ALTERNATIVE_OBJECTIVE_BONUS ( _ "Defeat all enemy leaders")}
            [objective]
                description= _ "Death of Prince Haldric"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Lady Jessene"
                condition=lose
            [/objective]

            {TURNS_RUN_OUT}

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

    [event]
        name=start
        [message]
            speaker=Tan-Pulk
            # wmllint: local spelling da tinkin
            message= _ "Da big bosses said we’d be in da city by winter. Bosses wrong, human-worms still there, and I’m a tinkin—"
        [/message]
        [message]
            speaker="Ut'Tan-Grilg"
            message= _ "Wait! I see a ship! Humans is coming! Smash ’em good!"
        [/message]

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

        [move_unit_fake]
            type=Transport Galleon
            side=1
            x=35,34,33,33,34,34
            y=30,29,29,28,27,26
        [/move_unit_fake]

        {PLACE_IMAGE ("units/transport/transport-galleon.png~RC(magenta>red)") 34 26}

        [unhide_unit]
            x=33
            y=24
        [/unhide_unit]

        [message]
            speaker=narrator
            message= _ "Prince Haldric has arrived at Fallen Lich Point, to retrieve the Lich-Lord Caror’s Book of Fire and Darkness, and flee into the sewers of Southbay."
            image=wesnoth-icon.png
        [/message]

        [recall]
            id=Lady Jessene
        [/recall]
        [recall]
            id=Burin the Lost
        [/recall]
        [recall]
            id=Sir Ruddry
        [/recall]

        [recall]
            id=Sir Ladoc
        [/recall]

        [recall]
            id=Minister Edren
        [/recall]

        [message]
            speaker=Prince Haldric
            # wmllint: local spelling un-petrify
            message= _ "Well, let’s un-petrify that lich and take his book, then get into the sewers. Umm, what language would that book be in?"
        [/message]
        [message]
            speaker=Lady Jessene
            message= _ "Some pep talk. The book will probably be in the Old Wesfolk tongue."
        [/message]
        [message]
            speaker=Prince Haldric
            message= _ "Ohh." # wmllint: no spellcheck
        [/message]
        [message]
            speaker=Lady Jessene
            message= _ "Just get the book, I think I should be able to translate it."
        [/message]
        [message]
            speaker=Prince Haldric
            message= _ "Then, into Southbay’s sewer."
        [/message]
        [message]
            speaker=Lady Jessene
            message= _ "Right."
        [/message]
    [/event]

    [event]
        name=moveto
        first_time_only=yes

        [filter]
            side=1
            x=13-18
            y=29-34
        [/filter]

        [if]
            [have_unit]
                id=Prince Haldric
                x=13-18
                y=29-34
            [/have_unit]

            [then]
                [message]
                    speaker=Prince Haldric
                    message= _ "There’s an odd monolith standing near here. Maybe it has something to do with the Lich-Lord... I should investigate more closely."
                [/message]
            [/then]

            [else]
                [message]
                    speaker=unit
                    message= _ "There’s an odd monolith standing near here."
                [/message]

                [message]
                    speaker=Lady Jessene
                    message= _ "Haldric, this looks like a job for you, probably something to do with the lich. Maybe you should get yourself over here."
                [/message]
            [/else]
        [/if]

        [allow_undo]
        [/allow_undo]
    [/event]

    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            x=14
            y=30
        [/filter]
        [message]
            speaker=narrator
            message= _ "This monolith was erected by me, ― (<i>chipped away</i>), first Mage of the good people of the Green Isle. By its power the Lich-Lord is bound in stone. To end the spell a noble of the line of Kings should utter the following..."
            image=wesnoth-icon.png
        [/message]

        [if]
            [variable]
                name=lich_free
                numerical_equals=0
            [/variable]

            [then]
                [if]
                    [have_unit]
                        id=Prince Haldric
                        x=14
                        y=30
                    [/have_unit]

                    [then]
                        [message]
                            speaker=Prince Haldric
                            message= _ "Hmm... after some thought..."
                            image=portraits/haldric-annoyed.png

                            [option]
                                label= _ "I think I’ll say that magic phrase."

                                [command]
                                    [set_variable]
                                        name=lich_free
                                        value=1
                                    [/set_variable]
                                    [unpetrify]
                                    [/unpetrify]

                                    {MODIFY_UNIT side,canrecruit=4,no upkeep full}

                                    [modify_side]
                                        side=4
                                        income=0
                                    [/modify_side]

                                    [message]
                                        speaker=Prince Haldric
                                        message= _ "The lich is free! Let’s bash him and grab that book. That sounds like a job for you, Lady Jessene!"
                                    [/message]
                                    [message]
                                        speaker=Lady Jessene
                                        message= _ "Hmph! You’re just happy because that monolith proves your paternity!"
                                    [/message]
                                    [message]
                                        speaker=Lich-Lord Caror
                                        message= _ "Free, I’m free, and I feel the Ruby of Fire! It will be mine."
                                    [/message]
                                    [message]
                                        speaker=Minister Edren
                                        message= _ "No you won’t, you soldier of darkness!"
                                    [/message]
                                [/command]
                            [/option]

                            [option]
                                label= _ "I think I’ll wait a while before uttering any magic phrases."

                                [command]
                                    [message]
                                        speaker=Prince Haldric
                                        message= _ "We have more pressing matters to deal with before we free that lich."
                                    [/message]

                                    [message]
                                        speaker=Lady Jessene
                                        message= _ "Afraid you’ll find out you’re not of the line of Kings?"
                                    [/message]
                                [/command]
                            [/option]
                        [/message]
                    [/then]

                    [else]
                        [message]
                            speaker=narrator
                            message= _ "This sounds like a job for Prince Haldric, hopefully."
                            image=wesnoth-icon.png
                        [/message]

                        [allow_undo]
                        [/allow_undo]
                    [/else]
                [/if]
            [/then]

            [else]
                [message]
                    speaker=narrator
                    message= _ "The Lich-Lord is already free."
                    image=wesnoth-icon.png
                [/message]
                [allow_undo]
                [/allow_undo]
            [/else]
        [/if]
    [/event]

    [event]
        name=moveto
        [filter]
            side=1
            x=25
            y=1
        [/filter]

        [redraw]
        [/redraw]

        [message]
            speaker=narrator
            # wmllint: local spelling NW
            message= _ "NW — Southbay."
            image=wesnoth-icon.png
        [/message]
        [message]
            speaker=unit
            message= _ "More like ‘NW — Every orc on the Isle’. Hmph!"
        [/message]
        [allow_undo]
        [/allow_undo]
    [/event]

    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            x=15
            y=9
        [/filter]

        [if]
            [have_unit]
                id=Prince Haldric
                x=15
                y=9
            [/have_unit]

            [then]
                [if]
                    [variable]
                        name=have_book
                        numerical_equals=1
                    [/variable]
                    [then]
                        [message]
                            speaker=Prince Haldric
                            message= _ "We have the book! Let’s get out of here!"
                        [/message]

                        [message]
                            speaker=Lady Jessene
                            message= _ "Sounds good to me."
                        [/message]

                        [endlevel]
                            bonus=no
                            result=victory
                            {NEW_GOLD_CARRYOVER 40}
                        [/endlevel]
                    [/then]

                    [else]
                        [message]
                            speaker=Prince Haldric
                            message= _ "I feel like I’m forgetting something. Ohh, the book!"
                            image=portraits/haldric-surprised.png
                        [/message]
                    [/else]
                [/if]
            [/then]

            [else]
                [message]
                    speaker=narrator
                    message= _ "Prince Haldric must be the first into the sewers of Southbay."
                    image=wesnoth-icon.png
                [/message]

                [allow_undo]
                [/allow_undo]
            [/else]
        [/if]
    [/event]

    [event]
        name=moveto

        [filter]
            x=15-27
            y=16-25
        [/filter]

        [modify_side]
            side=5
            hidden=no
        [/modify_side]
        [move_unit_fake]
            type=Yeti
            side=4
            x=13,13,13,12,11,10,9,9,9,10,11,11,11,12,12
            y=1,2,3,3,4,4,5,6,7,7,8,9,10,10,11
        [/move_unit_fake]

        {NAMED_LOYAL_UNIT 5 (Yeti) 12 11 (Rarlg) ( _ "Rarlg")}

        [message]
            speaker=Rarlg
            message= _ "Rarlg — argh, a raul-rarlg!"  # wmllint: no spellcheck
        [/message]
        [message]
            speaker=Prince Haldric
            message= _ "Oh my!"
            image=portraits/haldric-surprised.png
        [/message]
        [message]
            speaker="Ut'Tan-Grilg"
            message= _ "Oh my!"
        [/message]
        [message]
            speaker=Tan-Pulk
            message= _ "Oh my!"
        [/message]
        [message]
            speaker=Lady Jessene
            message= _ "And he brought a friend."
        [/message]

        [scroll_to_unit]
            id=Rarlg
        [/scroll_to_unit]

        {NAMED_LOYAL_UNIT 5 (Yeti) 15 11 (Raul-Rarlg) ( _ "Raul-Rarlg")}
    [/event]

    [event]
        name=last breath
        [filter]
            id=Lich-Lord Caror
        [/filter]

        [message]
            speaker=Lich-Lord Caror
            message= _ "So close. So close."
        [/message]

        [message]
            speaker=second_unit
            message= _ "I found the book in what was left of his robes! Let’s get out of here!"
        [/message]

        [set_variable]
            name=have_book
            value=1
        [/set_variable]
    [/event]

    [event]
        name=enemies defeated

        [message]
            speaker=Prince Haldric
            message= _ "We have the book and the orcs are out of our way. Let’s get out of here!"
        [/message]

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

    [event]
        name=scenario_end

        {CLEAR_VARIABLE have_book}
        {CLEAR_VARIABLE lich_free}
        {CLEAR_VARIABLE Killed_an_Orc}
    [/event]

    [event]
        name=time over
        [message]
            speaker=Prince Haldric
            message= _ "I can hear their reinforcements coming! We’re trapped! All is lost!"
            image=portraits/haldric-surprised.png
        [/message]
    [/event]

    [event]
        name=moveto
        [filter]
            side=1
            x=14
            y=8
        [/filter]

        [redraw]
        [/redraw]

        [message]
            speaker=narrator
            message= _ "Sewer — Danger Keep Out!"
            image=scenery/signpost.png
        [/message]

        [allow_undo]
        [/allow_undo]
    [/event]
[/scenario]

#undef PETRIFIED
#undef PETRIFIED_UNIT
