#textdomain wesnoth-nr

[scenario]
    id=04_Clearing_the_Mines
    name= _ "Clearing the Mines"
    map_file=04_Clearing_the_Mines.map
    {TURNS 65 55 45}
    next_scenario=05a_01_The_Pursuit

    {UNDERGROUND}

    {SCENARIO_MUSIC       battle.ogg}
    {EXTRA_SCENARIO_MUSIC the_king_is_dead.ogg}
    {EXTRA_SCENARIO_MUSIC legends_of_the_north.ogg}

    [story]
        [part]
            story= _ "When the party finally reached the mines, they were not disappointed."
        [/part]
    [/story]

    # wmllint: validate-off
    [side]
        side=1
        controller=human
        recruit=Peasant,Woodsman,Thug,Poacher,Dwarvish Fighter,Dwarvish Thunderer,Dwarvish Scout,Footpad
        {GOLD 450 400 350}
        team_name=alliance
        user_team_name= _ "Alliance"

        # wmllint: recognize Tallin
        {CHARACTER_STATS_TALLIN}
    [/side]
    # wmllint: validate-on

    # Five opposing undead sides
    [side]
        side=2
        controller=ai
        recruit=Dark Adept,Walking Corpse,Blood Bat,Skeleton,Skeleton Archer,Ghost
        {GOLD 125 150 200}
        income=15
        team_name=undead
        user_team_name= _ "Undead"
        {FLAG_VARIANT undead}

        type=Ancient Lich
        id=Malifor
        name= _ "Malifor"
        profile=portraits/Malifor.webp
        canrecruit=yes

        {LOYAL_UNIT 2 Skeleton 29  8} {GUARDIAN}
        {LOYAL_UNIT 2 Skeleton 29 10} {GUARDIAN}
        {LOYAL_UNIT 2 Skeleton 31  7} {GUARDIAN}
        {LOYAL_UNIT 2 Skeleton 31 11} {GUARDIAN}
        {LOYAL_UNIT 2 Skeleton 33  8} {GUARDIAN}
        {LOYAL_UNIT 2 Skeleton 33 10} {GUARDIAN}

        {LOYAL_UNIT 2 "Skeleton Archer" 34 4} {GUARDIAN}
        {LOYAL_UNIT 2 "Skeleton Archer" 37 6} {GUARDIAN}
    [/side]

    [side]
        side=3
        controller=ai
        recruit=Walking Corpse,Skeleton,Skeleton Archer,Vampire Bat
        {GOLD 125 150 200}
        team_name=undead
        user_team_name= _ "Undead"
        {FLAG_VARIANT undead}

        type=Draug
        id=Thorin
        name= _ "Thorin"
        canrecruit=yes

        {LOYAL_UNIT 3 Skeleton 11 22} {GUARDIAN}
        {LOYAL_UNIT 3 Skeleton 11 24} {GUARDIAN}
        {LOYAL_UNIT 3 Skeleton 16 25} {GUARDIAN}
        {LOYAL_UNIT 3 Skeleton 4  26} {GUARDIAN}
        {LOYAL_UNIT 3 Skeleton 8  26} {GUARDIAN}

        {LOYAL_UNIT 3 "Skeleton Archer" 7  29} {GUARDIAN}
        {LOYAL_UNIT 3 "Skeleton Archer" 17 21} {GUARDIAN}
    [/side]

    [side]
        side=4
        controller=ai
        recruit=Walking Corpse,Skeleton,Skeleton Archer,Vampire Bat
        {GOLD 125 150 200}
        team_name=undead
        user_team_name= _ "Undead"
        {FLAG_VARIANT undead}

        type=Draug
        id=Herlin
        name= _ "Herlin"
        canrecruit=yes

        {LOYAL_UNIT 4 Skeleton 33 32} {GUARDIAN}
        {LOYAL_UNIT 4 Skeleton 34 35} {GUARDIAN}
        {LOYAL_UNIT 4 Skeleton 24 29} {GUARDIAN}
        {LOYAL_UNIT 4 Skeleton 28 28} {GUARDIAN}

        {LOYAL_UNIT 4 "Skeleton Archer" 17 34} {GUARDIAN}
        {LOYAL_UNIT 4 "Skeleton Archer" 14 37} {GUARDIAN}
        {LOYAL_UNIT 4 "Skeleton Archer" 21 26} {GUARDIAN}
        {LOYAL_UNIT 4 "Skeleton Archer" 24 24} {GUARDIAN}
    [/side]

    [side]
        side=5
        controller=ai
        recruit=Walking Corpse,Skeleton,Skeleton Archer,Vampire Bat
        {GOLD 125 150 200}
        team_name=undead
        user_team_name= _ "Undead"
        {FLAG_VARIANT undead}

        type=Draug
        id=Fervin
        name= _ "Fervin"
        canrecruit=yes

        {LOYAL_UNIT 5 Skeleton 27 18} {GUARDIAN}
        {LOYAL_UNIT 5 Skeleton 28 21} {GUARDIAN}
        {LOYAL_UNIT 5 Skeleton 37 20} {GUARDIAN}

        {LOYAL_UNIT 5 "Skeleton Archer" 21 22} {GUARDIAN}
        {LOYAL_UNIT 5 "Skeleton Archer" 29 15} {GUARDIAN}
        {LOYAL_UNIT 5 "Skeleton Archer" 33 15} {GUARDIAN}
    [/side]

    [side]
        type=Draug
        id=Hellian
        name=_ "Hellian"
        canrecruit=yes
        side=6
        {GOLD 125 150 200}
        recruit=Walking Corpse,Skeleton,Skeleton Archer,Vampire Bat
        team_name=undead
        user_team_name=_"Undead"
        {FLAG_VARIANT undead}

        {LOYAL_UNIT 6 Skeleton 9  9} {GUARDIAN}
        {LOYAL_UNIT 6 Skeleton 12 7} {GUARDIAN}
        {LOYAL_UNIT 6 Skeleton 18 7} {GUARDIAN}
        {LOYAL_UNIT 6 Skeleton 18 9} {GUARDIAN}
        {LOYAL_UNIT 6 Skeleton 24 7} {GUARDIAN}
        {LOYAL_UNIT 6 Skeleton 24 9} {GUARDIAN}

        {LOYAL_UNIT 6 "Skeleton Archer" 12 16} {GUARDIAN}
    [/side]

    {STARTING_VILLAGES 1 5}
    {STARTING_VILLAGES 2 4}
    {STARTING_VILLAGES_AREA 3  2-15 21-31 0}
    {STARTING_VILLAGES_AREA 4 16-35 29-40 0}
    {STARTING_VILLAGES_AREA 5 21-34 19-24 0}
    {STARTING_VILLAGES_AREA 6  4-18  2-19 0}

    [event]
        name=prestart

        [time_area]
            x=0-2,  0, 0, 1, 3-4,3-6
            y=39-41,37,38,38,40, 41
            {DEFAULT_SCHEDULE}
        [/time_area]

        {RECALL_SUPPORTER}

        {RECALL_OR_REPLACE type="Dwarvish Fighter"}

        {RECALL_OR_REPLACE type="Dwarvish Thunderer"}

        {RECALL_OR_REPLACE type="Dwarvish Scout"}

        {RECALL_OR_REPLACE id=Camerin}

        {RECALL_OR_REPLACE id=Hamel}

        # Hide Malifor
        [hide_unit]
            id=Malifor
        [/hide_unit]

        # Set initial objectives.
        [objectives]
            side=1
            [objective]
                description= _ "Defeat the enemy leaders"
                condition=win
            [/objective]
            [objective]
                description= _ "Death of Tallin"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Hamel"
                condition=lose
            [/objective]

            {TURNS_RUN_OUT}

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

    # Start event - recall some units, perform initial dialogue and place an army of guardian skeletons
    [event]
        name=start

        [message]
            #wmllint: recognize Hamel
            speaker=Hamel
            message= _ "Behold! The Dwarven Mines."
        [/message]

        [message]
            speaker=Hamel
            message= _ "Look at yon canal. Dwarves built it to transport mined metals deeper into Knalga. And d’ye ken those two rooms, one to the north-west and the other to the south-east? If we could capture those, we would gain o’ great tactical advantage."
        [/message]

        [message]
            role=Supporter
            message= _ "Grim gods of darkness! The whole place is swarming with undead! They have raised corpses to do their work."
        [/message]

        [message]
            speaker=Tallin
            message= _ "And they seem to have good security, too. Look, most of the fortifications are repaired and they have those nasty skeletons everywhere."
        [/message]

        [message]
            role=Supporter
            message= _ "Fortunately, this entrance seems to be in disrepair. It doesn’t look like they have noticed us yet."
        [/message]

        [message]
            speaker=Thorin
            message= _ "WHO GOES THERE?"
        [/message]

        [message]
            speaker=Hamel
            message= _ "(<i>Wince</i>)."
        [/message]

        [message]
            role=Supporter
            message= _ "Oops, I spoke too soon."
        [/message]

        [message]
            #wmllint: recognize Camerin
            speaker=Camerin
            message= _ "Maybe he needs a fireball..."
        [/message]

        [message]
            speaker=Thorin
            message= _ "YOU DO NOT ANSWER. ALERT THE MASTER!"
        [/message]

        # The grand entrance
        [move_unit_fake]
            type=Ancient Lich
            side=2
            x=40,35,35,31
            y=1, 5, 7, 9
        [/move_unit_fake]

        [unhide_unit]
            id=Malifor
        [/unhide_unit]

        [message]
            speaker=Malifor
            message= _ "Who goes there? Ahhh, more slaves, I see."
        [/message]

        [message]
            speaker=Tallin
            message= _ "Others have made that mistake before. Who are you?"
        [/message]

        [message]
            speaker=Malifor
            message= _ "Who am I? (<i>Cackles wildly</i>) I am Malifor the Great, the master of death! These tunnels, haunted by the ghosts of the dead dwarves of Knalga, are the domain of my power."
        [/message]

        [message]
            speaker=Hamel
            message= _ "You dared disturb the rest of those brave dwarves? You shall pay in blood!"
        [/message]

        [message]
            speaker=Malifor
            message= _ "HAHAHAHA! Your petty temper tantrums are most amusing, you puny dwarf. Soon I will finish the slaughter that the orcs have begun so promisingly, and Knalga will be all mine! From there I will sweep the whole north of all living creatures, and then swoop down upon Wesnoth!"
        [/message]

        [message]
            speaker=Hamel
            message= _ "Quit your ranting, you wretched bag of bones! Prepare to return to the dust!"
        [/message]

        [message]
            speaker=Malifor
            message= _ "HAHAHAHA! Such vast threats from one so small? HAHAHA!"
        [/message]

        [message]
            speaker=Malifor
            message= _ "But– My my, what do we have here? — Tallin."
        [/message]

        [message]
            role=Supporter
            message= _ "He knows your name, Tallin. I don’t like the sound of this."
        [/message]

        [message]
            speaker=Malifor
            message= _ "Oh yes, I know you, Tallin. I have been watching you for a long time. You are a perfect candidate to become one of my immortal generals."
        [/message]

        [message]
            speaker=Tallin
            message= _ "...!"
        [/message]

        [message]
            speaker=Malifor
            message= _ "Look around you, Tallin; see all the power, see all of the wealth, the glory, the pleasure that the realm of death has to offer. Think of the great empire of Knalga; it can be yours. Come, share it with me!"
        [/message]

        [message]
            role=Supporter
            message= _ "Tallin! Get hold of yourself!"
        [/message]

        [message]
            speaker=Malifor
            message= _ "It’s very easy, Tallin... See that little vermin by your side? Take out your knife... cut his throat... feel his hot blood pump over your hands... sacrifice him!"
        [/message]

        [message]
            speaker=Tallin
            message= _ "(<i>Shakes head</i>) I reject your evil. Attack, men! Let us rid the good green world of this rotting filth!"
        [/message]

        [message]
            speaker=Hamel
            message= _ "Aye! That’s the way of it, lad! For the murdered dwarves of Knalga! Attack!"
        [/message]

        [message]
            speaker=Malifor
            message= _ "You fool! You will pay for your folly with your life."
        [/message]

        [message]
            speaker=Tallin
            message= _ "Yeah, right, buddy."
        [/message]
    [/event]

    # Turn 20 - since the army of skeletons is obviously not enough change the moat to swamp and send in an army of ghouls.
    [event]
        name=turn 20

        [message]
            speaker=Malifor
            message= _ "These little vermin are making progress! This is unacceptable. Rise, my minions — gorge on the flesh of these scurrying little rats!"
        [/message]

        # Water to swamp
        [terrain]
            [and]
                terrain=W**^*
            [/and]
            terrain=Ss
            layer=base
        [/terrain]

        [message]
            speaker=Tallin
            message= _ "Look out everyone, something is coming out of the canals! Already the water is churning and clogging with their filth. Get back and brace yourselves."
        [/message]
    [/event]

    # And the slimy army
    [event]
        name=turn 21

        {NOTRAIT_UNIT 2 Ghoul 15 11}
        {NOTRAIT_UNIT 2 Ghoul 17 11}
        {NOTRAIT_UNIT 2 Ghoul 20 9}
        {NOTRAIT_UNIT 2 Ghoul 25 9}
        {NOTRAIT_UNIT 2 Ghoul 25 11}
        {NOTRAIT_UNIT 2 Ghoul 27 12}
        {NOTRAIT_UNIT 2 Ghoul 26 15}
        {NOTRAIT_UNIT 2 Ghoul 29 16}
        {NOTRAIT_UNIT 2 Ghoul 28 18}
        {NOTRAIT_UNIT 2 Ghoul 27 7}
        {NOTRAIT_UNIT 2 Necrophage 16 9}
        {NOTRAIT_UNIT 2 Necrophage 23 10}
        {NOTRAIT_UNIT 2 Necrophage 26 8}
        {NOTRAIT_UNIT 2 Necrophage 28 14}
        {NOTRAIT_UNIT 2 Necrophage 26 13}
        {NOTRAIT_UNIT 2 Necrophage 26 17}
        {NOTRAIT_UNIT 2 Necrophage 26 21}
        {NOTRAIT_UNIT 2 Necrophage 25 8}

        [message]
            type=Necrophage
            message= _ "<i>Fooood</i>!" # wmllint: no spellcheck
        [/message]

        [message]
            role=Supporter
            message= _ "Lords of Light, what kind of vile creation are those things!"
        [/message]

        [if]
            [have_unit]
                id=Camerin
            [/have_unit]
            [then]
                [message]
                    speaker=Camerin
                    message= _ "Out of all of a necromancer’s creations, I must say those things are the most tortured and vile. They have an insatiable hunger for flesh and mindlessly shrug off all manner of damage to get it. Even my fire bolts have a slightly lesser effect on them."
                [/message]

                [message]
                    speaker=Camerin
                    message= _ "Oh, and try to stay away from their claws. If you get even one scratch, and don’t get it treated quickly, you will soon find yourself weak, sick and unable to fight further."
                [/message]

                [message]
                    speaker=Hamel
                    message= _ "Bah! They look like fat slugs to me. Come on boys, let’s chop them to pieces before they can leave the canal!"
                [/message]
            [/then]
            [else]
                [message]
                    speaker=Hamel
                    message= _ "Ghouls! They have an insatiable hunger for flesh. One scratch from their claws will weaken you with sickness and disease. Nasty things; let’s chop them to pieces before they can leave the canal."
                [/message]
            [/else]
        [/if]
    [/event]

    # Victory and death events - liches grand exit
    [event]
        name=last breath
        [filter]
            id=Malifor
        [/filter]

        [message]
            speaker=Malifor
            message= _ "HAHAHA, you puny weaklings think you can destroy me? <i>Fools</i>! You will all soon be serving me!"
        [/message]

        {FLASH_RED (
            [sound]
                name=magic-dark-big-miss.ogg
            [/sound]
            [kill]
                id=Malifor
                fire_event=yes # probably required if he’s the last enemy leader
                animate=no
            [/kill]
        )}

        [message]
            speaker=second_unit
            message= _ "Oh no, he just... disappeared."
        [/message]
    [/event]

    # Victory dialog
    [event]
        name=enemies defeated

        [message]
            speaker=Tallin
            message= _ "We have finally secured the mines. But what should we do about that foul lich? He is a menace to all that lives, and must be ended."
        [/message]

        [message]
            speaker=Hamel
            # wmllint: local spelling dwarvenkind
            message= _ "Aye! We’ll have to lay both his skeletons and himself to final rest before these caves will be fit for dwarvenkind again."
        [/message]

        [message]
            speaker=Tallin
            message= _ "But I’m sore vexed. We need better weapons. Luck and spirit can carry us only so far."
        [/message]

        [message]
            speaker=Hamel
            message= _ "Aye. We must do both. I’m thinking it might be best if I muster my folk to start on the weapon-making while you and your followers pursue yon lich. By the time you’ve laid him to final rest and return here, we’ll ha’ made a good start on the work."
        [/message]

        [message]
            speaker=Tallin
            message= _ "So it shall be."
        [/message]

        [role]
            type=Dwarvish Steelclad,Dwarvish Fighter,Dwarvish Dragonguard,Dwarvish Thunderguard,Dwarvish Thunderer,Dwarvish Explorer,Dwarvish Pathfinder,Dwarvish Scout
            role=follower
        [/role]

        [message]
            role=follower
            message= _ "With all respect, Lord Hamel, some o’ us would like to fare forth with Tallin. He’s lucky, he is — or he makes his own luck."
        [/message]

        [message]
            speaker=Hamel
            message= _ "And so it shall be. You’ve my leave and welcome. Try to keep the lad safe..."
        [/message]

        [message]
            role=follower
            message= _ "Thank you, Lord Hamel."
        [/message]

        # Lord Hamel becomes unavailable for following scenarios until the
        # big showdown.
        [kill]
            id=Hamel
            animate=no
            fire_event=no
        [/kill]

        [disallow_recruit]
            side=1
            type=Dwarvish Fighter,Dwarvish Thunderer,Dwarvish Scout,Dwarvish Guardsman
        [/disallow_recruit]

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

    # And hero deaths
    {HERODEATH_TALLIN}
    {HERODEATH_CAMERIN}
    {HERODEATH_HAMEL}

    {SUPPORTER_DEATH_HANDLER}
[/scenario]
