#textdomain wesnoth-low

[scenario]
    id=16_The_Chief_Must_Die
    name=_"The Chief Must Die"
    {LOW_MAP 16_The_Chief_Must_Die.map}
    turns=32
    disallow_recall=yes
    experience_modifier=100

    allow_new_game=no

    {INTRO_AND_SCENARIO_MUSIC love_theme.ogg the_city_falls.ogg}
    {EXTRA_SCENARIO_MUSIC the_dangerous_symphony.ogg}
    {EXTRA_SCENARIO_MUSIC vengeful.ogg}

    {STARTING_VILLAGES 3 50}

    victory_when_enemies_defeated=no
    {DUSK}
    {DUSK}
    {DUSK}
    {FIRST_WATCH}
    {FIRST_WATCH}
    {FIRST_WATCH}
    {FIRST_WATCH}
    {FIRST_WATCH}
    {FIRST_WATCH}
    {SECOND_WATCH}
    {SECOND_WATCH}
    {SECOND_WATCH}
    {SECOND_WATCH}
    {SECOND_WATCH}
    {SECOND_WATCH}
    {DAWN}
    next_scenario=17_Breaking_the_Siege

    [story]
        [part]
            story= _ "With the battle of Tath over, Kalenz and Landar knew the time had come to carry out Crelanu’s dangerous but necessary plan. Meanwhile Cleodil had, reluctantly, been training Kalenz in a selected few of the secrets of Crelanu’s book..."
        [/part]
        [part]
            background=story/characters/cleodil.png
            scale_background=no
            story={CAPTION ( _ "Cleodil")} + _ "I have taught you all that I dare. My lord... Kalenz... I pray you come back safely. My heart aches when I think of you going into such danger as this. It is peril not merely to your body, but to the essence of yourself."
        [/part]
        [part]
            background=story/characters/kalenz.png
            scale_background=no
            story={CAPTION ( _ "Kalenz")} + _ "Cleodil..."
        [/part]
        [part]
            background=story/characters/cleodil.png
            scale_background=no
            story={CAPTION ( _ "Cleodil")} + _ "I do not think I could bear your death. Still less could I bear the corruption of your soul; the grief would ruin me."
        [/part]
        [part]
            background=story/characters/kalenz.png
            scale_background=no
            story={CAPTION ( _ "Kalenz")} + _ "My eyes are open. To the danger, and... to you. You glow like a star in the night, Cleodil. You will be my guide out of darkness."
        [/part]
    [/story]
    {LOW_TRACK ( {FLIGHT_COMPLETE} {TREASURY_COMPLETE} {BOOK_COMPLETE} {ALLIANCE_STAGE3} ) }

    #wmllint: validate-off
    [side]
        side=1
        {KALENZ}
        {PLAYABLE}
        village_gold=0
        #This sets the income to 0
        {INCOME -2 -2 -2}
        [unit]
            {LANDAR}
            canrecruit=yes
            placement=leader
        [/unit]
    [/side]
    #wmllint: validate-on

    [side]
        type=Orcish Sovereign
        id=Great Chief Brurbar
        name=_ "Great Chief Brurbar"
        side=2
        allow_player=no
        canrecruit=no
        faction=Custom
        {GOLD 150 230 300}
        team_name=orcs
        [ai]
            ai_algorithm=idle_ai
        [/ai]
        {INCOME 4 8 12}
    [/side]

    [side]
        type=Orcish Warlord
        id=Tamitahan
        name=_ "Tamitahan"
        profile=portraits/orcs/warlord.png
        side=3
        allow_player=no
        canrecruit=yes
        {GOLD 150 230 300}
        team_name=orcs
#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 Pillager, Goblin Spearman, Orcish Warrior
#endif
#ifdef HARD
        recruit=Orcish Archer, Orcish Assassin, Orcish Grunt, Wolf Rider, Orcish Crossbowman, Orcish Warrior, Goblin Knight, Goblin Pillager, Orcish Slayer, Goblin Spearman, Orcish Warrior
#endif
        [ai]
            {NO_SCOUTS}
            recruitment_pattern=scout,fighter,fighter,archer,mixed fighter
            [goal]
                name=protect_unit
                [criteria]
                    side=3
                    canrecruit=yes
                [/criteria]
                protect_radius=1
            [/goal]
        [/ai]
        [ai]
            ai_algorithm=idle_ai
        [/ai]
        {INCOME 4 8 12}
    [/side]

    [side]
        side=4
        allow_player=no
        team_name=orcs
        id=Khrubar
        type=Orcish Warlord
        name=_ "Khrubar"
        profile=portraits/orcs/warlord.png
        canrecruit=yes
        {GOLD 100 100 100 }
#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 Pillager, Goblin Spearman, Orcish Warrior
#endif
#ifdef HARD
        recruit=Orcish Archer, Orcish Assassin, Orcish Grunt, Wolf Rider, Orcish Crossbowman, Orcish Warrior, Goblin Knight, Goblin Pillager, Orcish Slayer, Goblin Spearman, Orcish Warrior
#endif
        [ai]
            {NO_SCOUTS}
            recruitment_pattern=scout,fighter,fighter,archer,mixed fighter
            [goal]
                name=protect_unit
                [criteria]
                    side=4
                    canrecruit=yes
                [/criteria]
                protect_radius=1
            [/goal]
        [/ai]
        [ai]
            ai_algorithm=idle_ai
        [/ai]
    [/side]
    [side]
        type=Orcish Warlord
        id=Gvur
        name=_ "Gvur"
        profile=portraits/orcs/grunt-2.png
        side=5
        allow_player=no
        canrecruit=yes
        {GOLD 100 100 100}
        team_name=orcs
#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 Pillager, Goblin Spearman, Orcish Warrior
#endif
#ifdef HARD
        recruit=Orcish Archer, Orcish Assassin, Orcish Grunt, Wolf Rider, Orcish Crossbowman, Orcish Warrior, Goblin Knight, Goblin Pillager, Orcish Slayer, Goblin Spearman, Orcish Warrior
#endif
        [ai]
            {NO_SCOUTS}
            recruitment_pattern=scout,fighter,fighter,archer,mixed fighter
            [goal]
                name=protect_unit
                [criteria]
                    side=5
                    canrecruit=yes
                [/criteria]
                protect_radius=1
            [/goal]
        [/ai]
        [ai]
            ai_algorithm=idle_ai
        [/ai]
        {INCOME 4 8 12}
    [/side]

    [side]
        type=Orcish Warlord
        id=Ozul
        name=_ "Ozul"
        profile=portraits/orcs/grunt-2.png
        side=6
        allow_player=no
        canrecruit=yes
        {GOLD 100 100 100}
        team_name=orcs
#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 Pillager, Goblin Spearman, Orcish Warrior
#endif
#ifdef HARD
        recruit=Orcish Archer, Orcish Assassin, Orcish Grunt, Wolf Rider, Orcish Crossbowman, Orcish Warrior, Goblin Knight, Goblin Pillager, Orcish Slayer, Goblin Spearman, Orcish Warrior
#endif
        [ai]
            {NO_SCOUTS}
            recruitment_pattern=scout,fighter,fighter,archer,mixed fighter
            [goal]
                name=protect_unit
                [criteria]
                    side=6
                    canrecruit=yes
                [/criteria]
                protect_radius=1
            [/goal]
        [/ai]
        [ai]
            ai_algorithm=idle_ai
        [/ai]
        {INCOME 4 8 12}
    [/side]
    [side]
        side=7
        allow_player=no
        no_leader=yes
        team_name=orcs
        faction=Custom
        [ai]
            [stage]
                engine=fai
                name=unit_formulas
            [/stage]
        [/ai]
    [/side]
    [event]
        name=prestart

        [objectives]
            side=1
            [objective]
                description= _  "Kill the Orcish Great Chief and Kalenz must reach the signpost"
                condition=win
            [/objective]
            [objective]
                description= _ "Death of Kalenz"
                condition=lose
            [/objective]
            [objective]
                description= _  "Death of Landar"
                condition=lose
            [/objective]

            {TURNS_RUN_OUT}
        [/objectives]

        [unit]
            type=Goblin Pillager
            id=Odrun
            name=_ "Odrun"
            side=7
            x,y=25,4
            [ai]
                loop_formula="{ai/formula/patrol.fai}"
                [vars]
                    guard_radius=3
                    waypoints=[ loc(25,4) -> loc(14,2), loc(14,2) -> loc(9,12), loc(9,12) -> loc(6,19), loc(6,19) -> loc(25,4) ]
                    next_step="loc(25,4)"
                [/vars]
            [/ai]
        [/unit]

        [unit]
            type=Goblin Pillager
            id=Kardur
            name=_ "Kardur"
            side=7
            x,y=10,20
            [ai]
                loop_formula="{ai/formula/patrol.fai}"
                [vars]
                    guard_radius=3
                    waypoints=[ loc(10,20) -> loc(18,24), loc(18,24) -> loc(21,19), loc(21,19) -> loc(18,11), loc(18,11) -> loc(10,20) ]
                    next_step="loc(10,20)"
                [/vars]
            [/ai]
        [/unit]

        [unit]
            type=Goblin Pillager
            id=Kartrog
            name=_ "Kartrog"
            side=7
            x,y=22,27
            [ai]
                loop_formula="{ai/formula/patrol.fai}"
                [vars]
                    guard_radius=3
                    waypoints=[ loc(22,27) -> loc(27,24), loc(27,24) -> loc(21,16),loc(21,16) -> loc(22,27), loc(22,27) -> loc(6,24), loc(6,24)-> loc(22,27)]
                    next_step="loc(22,27)"
                [/vars]
            [/ai]
        [/unit]

        [unit]
            type=Goblin Knight
            id=Sdrul
            name=_ "Sdrul"
            side=7
            x,y=13,19
            [ai]
                loop_formula="{ai/formula/patrol.fai}"
                [vars]
                    guard_radius=3
                    waypoints=[ loc(13,19) -> loc(16,15), loc(16,15) -> loc(25,4), loc(25,4) -> loc(13,19) ]
                    next_step="loc(13,19)"
                [/vars]
            [/ai]
        [/unit]

        [unit]
            type=Direwolf Rider
            id=Utrub
            name=_ "Utrub"
            side=7
            x,y=29,24
            [ai]
                loop_formula="{ai/formula/patrol.fai}"
                [vars]
                    guard_radius=3
                    waypoints=[ loc(29,24) -> loc(16,15), loc(16,15) -> loc(29,24) ]
                    next_step="loc(29,24)"
                [/vars]
            [/ai]
        [/unit]

        [unit]
            type=Goblin Knight
            id=Uhmit
            name=_ "Uhmit"
            side=7
            x,y=17,8
            [ai]
                loop_formula="{ai/formula/patrol.fai}"
                [vars]
                    guard_radius=3
                    waypoints=[ loc(25,4) -> loc(16,15), loc(16,15) -> loc(25,4) ]
                    next_step="loc(17,8)"
                [/vars]
            [/ai]
        [/unit]

        #### end of wolves ####

        [unit]
            type=Orcish Grunt
            id=Grut
            name=_ "Grut"
            side=7
            x,y=26,17
        [/unit]

        [unit]
            type=Orcish Grunt
            id=Krolru
            name=_ "Krolru"
            side=7
            x,y=10,20
        [/unit]

        [unit]
            type=Orcish Warrior
            id=Kryl
            name=_ "Kryl"
            side=7
            x,y=25,12
        [/unit]

        [unit]
            type=Orcish Crossbowman
            id=Erdug
            name=_ "Erdug"
            side=7
            x,y=16,20
        [/unit]

        [unit]
            type=Orcish Warrior
            id=Urdol
            name=_ "Urdol"
            side=7
            x,y=24,17
        [/unit]

        [unit]
            type=Orcish Warrior
            id=Tan-Drur
            name=_ "Tan-Drur"
            side=7
            x,y=20,17
        [/unit]

        [unit]
            type=Orcish Crossbowman
            id=Brim
            name=_ "Brim"
            side=7
            x,y=21,23
        [/unit]

        [unit]
            type=Orcish Grunt
            id=Krud
            name=_ "Krud"
            side=7
            x,y=23,8
        [/unit]

        [unit]
            type=Orcish Warrior
            id=Krulr
            name=_ "Krulr"
            side=7
            x,y=22,11
        [/unit]

        [unit]
            type=Orcish Warrior
            id=Draglar
            name=_ "Draglar"
            side=7
            x,y=18,14
        [/unit]

        [unit]
            type=Orcish Warrior
            id=Qmrun
            name=_ "Qmrun"
            side=7
            x,y=24,15
        [/unit]

        [unit]
            type=Goblin Impaler
            id=Erdog
            name=_ "Erdog"
            side=7
            x,y=32,7
        [/unit]

        [unit]
            type=Goblin Spearman
            id=Sbrak
            name=_ "Sbrak"
            side=7
            x,y=19,23
        [/unit]

        [unit]
            type=Goblin Spearman
            id=Urdum
            name=_ "Urdum"
            side=7
            x,y=22,27
        [/unit]

        [unit]
            type=Goblin Impaler
            id=Ozdul
            name=_ "Ozdul"
            side=7
            x,y=17,11
        [/unit]

        [unit]
            type=Goblin Impaler
            id=Zuzerd
            name=_ "Zuzerd"
            side=7
            x,y=5,1
        [/unit]

        [unit]
            type=Orcish Archer
            id=Egrok
            name=_ "Egrok"
            side=7
            x,y=29,11
        [/unit]

        [unit]
            type=Orcish Assassin
            id=Urbrus
            name=_ "Urbrus"
            side=7
            x,y=28,16
        [/unit]

        [unit]
            type=Orcish Slayer
            id=Erbru
            name=_ "Erbru"
            side=7
            x,y=32,8
        [/unit]

        [unit]
            type=Orcish Warrior
            id=Muhmr
            name=_ "Muhmr"
            side=7
            x,y=22,16
        [/unit]

        [unit]
            type=Orcish Crossbowman
            id=Cfrul
            name=_ "Cfrul"
            side=7
            x,y=10,16
        [/unit]

        [unit]
            type=Orcish Crossbowman
            id=Irkrul
            name=_ "Irkrul"
            side=7
            x,y=26,6
        [/unit]

        [unit]
            type=Orcish Grunt
            id=Cebrun
            name=_ "Cebrun"
            side=7
            x,y=3,19
        [/unit]

        [unit]
            type=Orcish Grunt
            id=Krundrum
            name=_ "Krundrum"
            side=7
            x,y=11,5
        [/unit]

        [unit]
            type=Orcish Grunt
            id=Arrkud
            name=_ "Arrkud"
            side=7
            x,y=13,23
        [/unit]

        [unit]
            type=Orcish Grunt
            id=Gulmod
            name=_ "Gulmod"
            side=7
            x,y=11,11
        [/unit]
    [/event]

#define INVISIBILITY_POTION AFFIX DESCRIPTION
    [object]
        id=invisibility_potion_{AFFIX}
        description={DESCRIPTION}
        duration=scenario
        [filter]
            id={AFFIX}
        [/filter]
        [effect]
            apply_to=new_ability
            [abilities]
                [hides]
                    id=invisible
                    name= _ "invisible"
                    name_inactive= _ "invisible"
                    description= _ "Enemy units cannot see this unit, except for wolf-based units who can smell it if close enough. Hence except for wolf-based units, enemy units will not initiate an attack on this unit. Defense is at 80 percent for every terrain except water, where it is 70 percent."
                    description_inactive= _ "Enemy units cannot see this unit, except for wolf-based units who can smell it if close enough. Hence except for wolf-based units, enemy units will not initiate an attack on this unit. Defense is at 80 percent for every terrain except water, where it is 70 percent."
                    affect_self=yes
                [/hides]
            [/abilities]
        [/effect]
        [effect]
            apply_to=defense
            replace=yes
            [defense]
                deep_water=30
                shallow_water=30
                reef=30
                swamp_water=30
                flat=20
                sand=20
                forest=20
                hills=20
                mountains=20
                village=20
                castle=20
                cave=20
                frozen=20
                unwalkable=20
                impassable=20
                fungus=20
            [/defense]
        [/effect]
    [/object]
#enddef

    [event]
        name=start
        [message]
            id=Kalenz
            message= _ "Here we are at last. Landar, are you sure you want to go through with this?"
        [/message]
        [message]
            id=Landar
            message= _ "Absolutely. Let’s do it!"
        [/message]
        [message]
            id=Kalenz
            message= _ "We need to kill the Great Chief and get out before the effect of the philter ends. Time to drink it down now!"
        [/message]

        [scroll_to_unit]
            id=Kalenz
        [/scroll_to_unit]

        [sound]
            name=potion.ogg
        [/sound]

        [color_adjust]
            red=100
            green=100
            blue=100
        [/color_adjust]

        [delay]
            time=10
        [/delay]

        [color_adjust]
            red=0
            green=0
            blue=0
        [/color_adjust]

        [delay]
            time=2000
        [/delay]

        [sound]
            name=lightning.ogg
        [/sound]

        {ADVANCE_UNIT (id=Kalenz) (Elvish Lord)}
        {INVISIBILITY_POTION Kalenz _"Crelanu’s philter affecting Kalenz"}

        [store_unit]
            variable=landar_store
            [filter]
                id=Landar
            [/filter]
        [/store_unit]

        {ADVANCE_UNIT (id=Landar) ($landar_store.type)}
        {INVISIBILITY_POTION Landar _"Crelanu’s philter affecting Landar"}

        {CLEAR_VARIABLE landar_store}

        [message]
            id=Kalenz
            message= _ "This feels passing strange! Landar, remember to stay far from the wolves —they may be able to smell us."
        [/message]

        #TODO Transfer some of the powers the unit Kalenz came from had -- eg leadership

        {HIGHLIGHT_IMAGE 2 30 scenery/signpost.png ()}

        [scroll_to_unit]
            id=Kalenz
        [/scroll_to_unit]
    [/event]

    [event]
        name=die
        [filter]
            id=Great Chief Brurbar
        [/filter]
        [message]
            id=Kalenz
            message=  _ "The orcish chieftain is dead! Now we must make appear he was slain by an orcish hand!"
        [/message]
    [/event]

    [event]
        name=time over
        [message]
            id=Kalenz
            message= _ "We are too late, the potion effects have worn off and we are visible!"
        [/message]
        [message]
            id=Kalenz
            message= _ "With our ruse revealed, the orcs will attack our forests instead of fighting among themselves."
        [/message]
    [/event]

    [event]
        name=moveto
        [filter]
            x=2
            y=30
            id=Kalenz
        [/filter]
        first_time_only=no

        [if]
            [not]
                [have_unit]
                    id=Great Chief Brurbar
                [/have_unit]
            [/not]
            [then]
                [message]
                    id=Kalenz
                    message=_"Done!"
                [/message]

                [endlevel]
                    carryover_percentage=100
                    result=victory
                    bonus=no
                [/endlevel]
            [/then]
        [/if]
    [/event]

    [event]
        name=victory

        [message]
            id=Ozul
            # wmllint: local spelling da
            message= _ "The Great Chief has been murdered! Whoever did it will only get da throne over my dead stinking body!"
        [/message]
        [message]
            id=Tamitahan
            message= _ "I am the strongest warlord! I will be Chief!"
        [/message]
        [message]
            id=Gvur
            message= _ "No way anyone will steal my throne!"
        [/message]
        [message]
            id=Khrubar
            message= _ "This is my time and I will kill anyone who disputes it!"
        [/message]
        [message]
            id=Landar
            message= _ "The plan is working! Now we will take back what’s ours!"
        [/message]
        [message]
            id=Kalenz
            message= _ "Softly, Landar. We still have to get out of here..."
        [/message]
    [/event]

    {campaigns/Legend_of_Wesmere/utils/deaths.cfg}
[/scenario]
