#textdomain wesnoth-Invasion_from_the_Unknown

[unit_type]
    id=Skeleton Rider
    name= _ "Skeleton Rider"
    race=undead
    image="units/undead-skeletal/rider.png"
    [movement_anim]
        start_time=0
        [frame]
            duration=150
            image="units/undead-skeletal/rider-move.png"
        [/frame]
    [/movement_anim]
    hitpoints=36
    movement_type=undeadmountedfoot
    movement=8
    experience=48
    level=1
    alignment=chaotic
    advances_to=Bone Knight
    cost=22
    usage=scout
    description= _ "Once great warriors thundering across the plains, these mounted riders atop their skeletal horses were raised from the grave by unholy magic to spread fear and destruction."
    die_sound={SOUND_LIST:SKELETON_DIE}
    {DEFENSE_ANIM "units/undead-skeletal/rider-defend.png" "units/undead-skeletal/rider.png" {SOUND_LIST:SKELETON_HIT} }
    [abilities]
        {ABILITY_SUBMERGE}
    [/abilities]
    [attack]
        name=axe
        description={I18N:ATTACK_AXE}
        type=blade
        range=melee
        damage=7
        number=3
        icon=attacks/axe-undead.png
    [/attack]
    [attack_anim]
        [filter_attack]
            name=axe
        [/filter_attack]
        start_time=-150
        [frame]
            duration=75
            image="units/undead-skeletal/rider-move.png"
        [/frame]
        [if]
            hits=no
            [frame]
                duration=150
                image="units/undead-skeletal/rider-melee.png"
                sound={SOUND_LIST:MISS}
            [/frame]
        [/if]
        [else]
            hits=yes
            [frame]
                duration=150
                image="units/undead-skeletal/rider-melee.png"
                sound=axe.ogg
            [/frame]
        [/else]
        [frame]
            duration=25
            image="units/undead-skeletal/rider-move.png"
        [/frame]
    [/attack_anim]
[/unit_type]


#textdomain wesnoth-Invasion_from_the_Unknown

[unit_type]
    id=Death Baron
    name= _ "Death Baron"
    race=undead
    image="units/undead-skeletal/death-baron.png"
    profile=portraits/undead/death-knight.png
    [leading_anim]
        start_time=-150
        [frame]
            duration=100
            image="units/undead-skeletal/death-baron-leading.png"
        [/frame]
        [frame]
            duration=100
            image="units/undead-skeletal/death-baron-leading.png"
        [/frame]
        [frame]
            duration=100
            image="units/undead-skeletal/death-baron-leading.png"
        [/frame]
    [/leading_anim]
    hitpoints=51
    movement_type=undeadfoot
    movement=5
    experience=100
    level=2
    alignment=chaotic
    advances_to=Death Knight
    [advancefrom]
        unit=Skeleton
    [/advancefrom]
    cost=34
    [abilities]
        {ABILITY_LEADERSHIP}
        {ABILITY_SUBMERGE}
    [/abilities]
    [resistance]
        blade=60
        pierce=40
        impact=120
    [/resistance]
    usage=fighter
    description= _ "Sometimes the mightiest warriors and generals, cursed with hate and angst, come back to this world as Death Knights. Death Barons serve them whilst accruing enough unholy power to advance to the level of their masters. In the process, they pick up a good deal of the Knight’s skills, including the ability to easily and effectively command underlings."
    die_sound=skeleton-big-die.ogg
    {DEFENSE_ANIM_RANGE "units/undead-skeletal/death-baron-defend.png" "units/undead-skeletal/death-baron.png" {SOUND_LIST:SKELETON_BIG_HIT} melee}
    {DEFENSE_ANIM_RANGE "units/undead-skeletal/death-baron-defend.png" "units/undead-skeletal/death-baron-crossbow.png" {SOUND_LIST:SKELETON_BIG_HIT} ranged}
    [attack]
        name=axe
        description={I18N:ATTACK_AXE}
        icon=attacks/axe-undead.png
        type=blade
        range=melee
        damage=8
        number=3
    [/attack]
    [attack]
        name=crossbow
        description={I18N:ATTACK_CROSSBOW}
        icon=attacks/crossbow-undead.png
        type=pierce
        range=ranged
        damage=5
        number=2
    [/attack]
    [attack_anim]
        [filter_attack]
            name=crossbow
        [/filter_attack]
        start_time=-400
        [missile_frame]
            begin=-150
            end=0
            image="projectiles/missile-n.png"
            image_diagonal="projectiles/missile-ne.png"
        [/missile_frame]
        [frame]
            duration=100
            image="units/undead-skeletal/death-baron-crossbow.png"
        [/frame]
        [if]
            hits=yes
            [frame]
                duration=150
                image="units/undead-skeletal/death-baron-crossbow-attack1.png"
                sound=crossbow.ogg
            [/frame]
        [/if]
        [else]
            hits=no
            [frame]
                duration=150
                image="units/undead-skeletal/death-baron-crossbow-attack1.png"
                sound=crossbow-miss.ogg
            [/frame]
        [/else]
        [frame]
            duration=150
            image="units/undead-skeletal/death-baron-crossbow-attack2.png"
        [/frame]
    [/attack_anim]
    [attack_anim]
        [filter_attack]
            name=axe
        [/filter_attack]
        [frame]
            begin=-250
            end=-225
            image="units/undead-skeletal/death-baron.png"
        [/frame]
        [frame]
            begin=-225
            end=-125
            image="units/undead-skeletal/death-baron-attack-1.png"
        [/frame]
        [if]
            hits=yes
            [frame]
                begin=-125
                end=25
                image="units/undead-skeletal/death-baron-attack-2.png"
                sound={SOUND_LIST:SWORD_SWISH}
            [/frame]
        [/if]
        [else]
            hits=no
            [frame]
                begin=-125
                end=25
                image="units/undead-skeletal/death-baron-attack-2.png"
                sound={SOUND_LIST:MISS}
            [/frame]
        [/else]
        [frame]
            begin=25
            end=175
            image="units/undead-skeletal/death-baron-attack-3.png"
        [/frame]
        [frame]
            begin=175
            end=200
            image="units/undead-skeletal/death-baron.png"
        [/frame]
    [/attack_anim]
[/unit_type]


#textdomain wesnoth-did
[textdomain]
    name="wesnoth-did"
[/textdomain]

# wmlscope: set export=no
[campaign]
    id=Descent_into_Darkness
    rank=100
    year="389 YW"
    icon="data/campaigns/Descent_Into_Darkness/images/units/dark-mage.png~RC(magenta>red)"
    background="data/campaigns/The_Rise_Of_Wesnoth/images/story/trow_intro_03.jpg"
    name= _ "Descent into Darkness"
    abbrev= _ "DiD"
    define=CAMPAIGN_DESCENT
    first_scenario=01_Saving_Parthyn

    [modify_unit_type]
        type="Dark Sorcerer"
        remove_advancement="Lich"
    [/modify_unit_type]
    {CAMPAIGN_DIFFICULTY EASY   "units/undead-necromancers/adept.png~RC(magenta>black)" ( _ "Neophyte") ( _ "Easy")}
    {CAMPAIGN_DIFFICULTY NORMAL "units/undead-necromancers/dark-sorcerer.png~RC(magenta>black)" ( _ "Evoker") ( _ "Normal")} {DEFAULT_DIFFICULTY}
    {CAMPAIGN_DIFFICULTY HARD   "units/undead-necromancers/lich.png~RC(magenta>black)" ( _ "Summoner") ( _ "Challenging")}

    description=_ "The northern frontier town of Parthyn is annually raided by neighboring tribes of orcs. Malin Keshar, an outcast mage, seeks to defend his home and wreak vengeance on the orcs by any means necessary, even if it means sacrificing his own soul in the process.

" + _"(Intermediate level, 10 scenarios.)"

    [about]
        title = _ "Original Campaign Design"
        [entry]
            name = "esci"
        [/entry]
    [/about]
    [about]
        title = _ "Latest Campaign Revision"
        [entry]
            name = "nemaara"
        [/entry]
    [/about]
    [about]
        title = _ "Artwork and Graphics Design"
        [entry]
            name = "Blarumyrran"
            comment = "story images"
        [/entry]
        [entry]
            name = "Emilien Rotival (LordBob)"
            comment = "current portraits"
        [/entry]
        [entry]
            name= "theycallmerooster"
            comment = "old portraits"
        [/entry]
    [/about]
    [about]
        title = _ "Miscellaneous"
        [entry]
            name = "josteph"
            comment = "dialogue comments and revisions"
        [/entry]
    [/about]
[/campaign]

#ifdef CAMPAIGN_DESCENT
{campaigns/Descent_Into_Darkness/utils}
[units]
    {campaigns/Descent_Into_Darkness/units}
[/units]
[binary_path]
    path=data/campaigns/Descent_Into_Darkness
[/binary_path]
[lua]
    code = <<
        wesnoth.dofile('campaigns/Descent_Into_Darkness/lua/' .. 'skip_animations.lua')
    >>
[/lua]
{campaigns/Descent_Into_Darkness/scenarios}

#endif

# wmllint: directory spelling Malin Dela Keshar Drogan Darken Volk Karres


#textdomain wesnoth-did

[scenario]
    id=01_Saving_Parthyn
    name= _ "Saving Parthyn"
    map_file=01_Saving_Parthyn.map
    turns=13
    next_scenario=02_Peaceful_Valley
    victory_when_enemies_defeated=no

    {DEFAULT_SCHEDULE}

    {SCENARIO_MUSIC       northerners.ogg}
    {EXTRA_SCENARIO_MUSIC loyalists.ogg}
    {EXTRA_SCENARIO_MUSIC battle.ogg}

    [story]
        [part]
            music=elvish-theme.ogg
            #                          **THIS TEXT CONTAINS SPOILERS**
            # po: Comments about dialogue style and characterization:
            # po: Drogan: although he is the captain of Parthyn's guard, he shows signs of recklessness and inflexibility; he's stiff and stubborn, which causes him to butt heads with Malin
            # po:           often, we see that Drogan says something to Malin (e.g. banishing him) without a clearly good reason why, and that's because of his ego and confidence in his own righteousness
            # po:           Drogan speaks with a country accent, using things like "ta" instead of "to", "ya" instead of "you", "thar" instead of "there", and some incorrect grammatical constructs like "them orcs" instead of "the orcs"
            # po: Darken Volk: he talks a little more formally than Malin, and has quite a few ellipses in his speech. These are at points where he's not speaking exactly what he's thinking in his head because in reality,
            # po:           he's trying to manipulate Malin for his own gain. His mode of speech is a little more formal.
            # po: Dela: little more of a minor character, she's what you might expect from a sister. She isn't wholly against Malin until he kills Drogan, but she also doesn't really want to do much with a necromancer either.
            # po:           She tries to be understanding, but falls short in the end because of her prejudice against dark magic. Note: Dela also speaks with a country accent like Drogan, but not as heavily so.
            # po:           More "country accent" words: "s'ppose" instead of suppose, "’em" instead of them, dropping the g at the end of a word for ’ (bickering -> bickerin’), "’bout" instead of "about", "’im" instead of him
            # po:           "woulda" -> would have, "o’" -> of, "gotta" -> have to
            # po: Malin: rash and impulsive, he cares a lot about his home, but doesn't see that power itself can be a corrupting force (though he does not seek power just for the sake of it, it is for another purpose which is
            # po:           to drive off the orcs). He's a little more informal in his speech, meaning more contractions and colloquialisms, stemming from his "country accent" (which is not as strong as Drogan's or Dela's due to his time on Alduin).
            # po: Things to be careful about while editing: there are some poems in S8 and S11, please be mindful when making wording changes there. Some commas are added for readability even though they may not be grammatically correct.
            # po:
            # po: If the target language has a specialized term for a fortified town, like Latin "oppidum", use it for Parthyn.
            story= _ "Malin Keshar was born ten years after the death of Haldric IV. He grew up in the northern border town of Parthyn, the second child and eldest son of the city’s baron. Every summer, by the time the mountainous paths and high passes shed their wintry gowns of snow, orcs descended from the northern hills to ravage the settlements at the frontier. Every year, Malin’s father led the townsfolk to repel the raids and force the orcs to retreat back to the north."
            {STORYTXT_BACKGROUND_BIGMAP_DID}
        [/part]
        [part]
            story= _ "When Malin was ten, a passing mage sensed strong magical abilities in the boy and suggested he be sent to the Isle of Alduin for training in the magical arts. Malin studied there for eight years, learning all manner of magic from basic control over the elements, to the mystic arts and scrying, to alchemy and simple medicine."
            {STORYTXT_BACKGROUND_BIGMAP_DID}
        [/part]
        [part]
            story= _ "Although his life on Alduin was luxurious and peaceful, Malin found the teachings of the scholarly mages to be too philosophical for his tastes. His thoughts turned back to Parthyn, where more practical magics were necessary to drive off the orcs. Malin began to research these magics on his own, but his lack of patience and general indiscretion eventually led to several confrontations with his teachers and other students. Believing Malin to be too reckless, the mages expelled him from Alduin."
            {STORYTXT_BACKGROUND_BIGMAP_DID}
        [/part]
        [part]
            story= _ "When Malin returned to Parthyn, orcs had already begun to attack the city. Although he tried his best to fight them off, the raids were far more relentless and the town guard was far weaker than he had remembered. One night, a particularly powerful band of orcs overran the city walls and Malin could only watch as his father was cut down by one of the savage orcish warriors."
            {STORYTXT_BACKGROUND_BIGMAP_DID}
        [/part]
        [part]
            story= _ "Shaken by the loss of their commander, the human defense began to falter. The orcs roared in anticipation of victory, but before they could overrun the city, skeleton warriors poured out of the woods to their rear. The undead cut down orc after orc, swords and axes hacking through flesh and bone with ruthless efficiency. The soldiers watched in half amazement, half fear as the orcs dropped and the skeletons turned toward them, empty eyes bleeding with fetid magic. All was dreadfully still as the blood and carnage settled in the rank darkness."
            {STORYTXT_BACKGROUND_BIGMAP_DID}
        [/part]
        [part]
            story= _ "The silence was broken by the irregular shuffle of a man emerging from the trees. He stood before them, a hunched figure with a rasping voice reminiscent of crackling bones. “I am Darken Volk. While I know you do not love my kind, I think it is vital that we put aside our differences. The orcish menace grows in the north and they will soon return in even greater force. You cannot hope to defend against them without my... help. For now, I ask only to refresh myself in your town.”"
            {STORYTXT_BACKGROUND_BIGMAP_DID}
        [/part]
        # Drogan uses 'I' here because he thinks of himself in charge when technically, Dela or Malin should be (as the children of the Baron)
        # He also does this later when he tells them to be quiet and to stop bickering
        [part]
            story= _ "Drogan, the captain of the guard, replied, “Nay, ye surely know that tha law says tha penalty fer necromancy be death. But, since you’ve saved our town, I’ll let ya rest here fer up ta three days. After, I’m banishin’ ya from Parthyn. Should ye return, we’ll attack ya on sight.”"
            {STORYTXT_BACKGROUND_BIGMAP_DID}
        [/part]
        [part]
            story= _ "Malin, troubled by his father’s death and the strength of the orcish assault, argued to no avail that Darken Volk be allowed to stay. After a couple days, the necromancer left Parthyn without incident."
            {STORYTXT_BACKGROUND_BIGMAP_DID}
        [/part]
    [/story]

    {DID_TRACK {JOURNEY_01_NEW}}

    # wmllint: validate-off
    [side]
        side=1
        controller=human
        recruit=Walking Corpse
        {GOLD 90 70 50}
        team_name=town guard
        user_team_name= _ "Defenders"
        {FLAG_VARIANT undead}
        color=darkblue

        # wmllint: recognize Malin Keshar
        {CHARACTER_STATS_MALIN_KESHAR}

        facing=nw

        # Starting units for Malin
        {LOYAL_UNIT 1 (Spearman) 28 11}
        {LOYAL_UNIT 1 (Bowman)   26 15}
        {LOYAL_UNIT 1 (Spearman) 23 12}
    [/side]
    # wmllint: validate-on

    [side]
        side=2
        controller=ai
        recruit=Orcish Grunt,Orcish Archer,Wolf Rider,Orcish Crossbowman
        {GOLD 70 105 140}
        {INCOME 2 4 6}
        team_name=orcs
        user_team_name= _ "Orcs"
        {FLAG_VARIANT6 ragged}
        color=white

        type=Orcish Warrior
        id=Kreg'a'shar Trr
        name= _ "Kreg’a’shar Trr"
        canrecruit=yes

        facing=se

        [ai]
            aggression=0.8
            leader_value=3
            grouping=offensive
            caution=0.1
            recruitment_pattern=fighter,archer,scout
        [/ai]
    [/side]

    [side]
        side=3
        controller=ai
        recruit=Peasant,Woodsman,Spearman
        {GOLD 40 30 20}
        team_name=town guard
        user_team_name= _ "Defenders"
        {FLAG_VARIANT loyalist}
        color=green

        type=Sergeant
        id=Drogan
        name= _ "Drogan"
        experience=17
        profile=portraits/drogan.png
        canrecruit=yes
        unrenamable=yes

        facing=ne

        # Starting units for Drogan
        {LOYAL_UNIT 3 (Swordsman) 15 17} {GUARDIAN}
        {UNIT 3 (Spearman) 9 16 ()}
        {UNIT 3 (Spearman) 7 13 ()}

        [unit]
            # wmllint: recognize Dela Keshar
            {CHARACTER_STATS_DELA_KESHAR}
            ai_special=guardian
            x,y=4,17
        [/unit]

        [ai]
            village_value=0
            caution=0.5
            [goal]
                name=protect_unit
                [criteria]
                    id=Malin Keshar
                [/criteria]
                value=4
            [/goal]

            # Don't block Malins keep
            [avoid]
                x=21
                y=14
            [/avoid]
        [/ai]
    [/side]

    {STARTING_VILLAGES 3 15}
    {STARTING_VILLAGES 2 5}
    {STARTING_VILLAGES 1 5}

    # Signpost to mark area defended
    {PLACE_IMAGE scenery/signpost.png 17 16}
    {PLACE_IMAGE items/book2.png 20 17}
    {PLACE_IMAGE scenery/white-monolith.png 30 15}
    {PLACE_IMAGE scenery/wreck.png 31 9}

    [event]
        name=prestart

        [objectives]
            side=1
            [objective]
                condition=win
                description= _ "Defend the river fort for two nights"
            [/objective]
            [objective]
                {ALTERNATIVE_OBJECTIVE_CAPTION}
                condition=win
                description= _ "Kill the orcish leader"
            [/objective]
            [objective]
                condition=lose
                description= _ "Orcs reach the outskirts of Parthyn"
            [/objective]
            [objective]
                condition=lose
                description= _ "Death of Malin Keshar"
            [/objective]
            [objective]
                condition=lose
                description= _ "Death of Dela Keshar"
            [/objective]
            [objective]
                condition=lose
                description= _ "Death of Drogan"
            [/objective]

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

        {VARIABLE malin_used_necromancy no}
    [/event]

    [event]
        name=start

        [message]
            speaker=Dela Keshar
            message= _ "You really think it was a good idea to send out a raidin’ party right after the orcs just attacked us? Father isn’t even here with us any more..."
        [/message]

        [message]
            speaker=Malin Keshar
            message= _ "Nor is Darken Volk. We are truly defenseless."
        [/message]

        [message]
            speaker=Dela Keshar
            message= _ "Not like we even need him. No way we’re trusting a necromancer."
        [/message]

        [message]
            speaker=Drogan
            message= _ "Quit bickerin’, you two. With most o’ them orcs dead now, their camps will be lots weaker. Our raiders will clear ’em out and leave us a quiet summer."
        [/message]

        [scroll_to]
            x,y=14,2
        [/scroll_to]

        [delay]
            time=1000
        [/delay]

        [message]
            speaker=Malin Keshar
            message= _ "So much for quiet, Drogan. Orcs amass north of the river!"
        [/message]

        [message]
            speaker=Drogan
            message= _ "What? Curses! Why be thar still so many o’ ’em?"
        [/message]

        [message]
            speaker=Dela Keshar
            message= _ "Well ya sent out a bunch of our soldiers before we even started ta fix the city walls..."
        [/message]

        [message]
            speaker=Drogan
            message= _ "Quiet, you. Malin, you’ve got ta hold tha river fort or they’ll overrun us. Tha raidin’ party should be back in two days ta help us fight ’em off. Fer now, I’ll send tha remaining guards to help ya."
        [/message]
    [/event]

    # In-scenario events
    [event]
        name=recruit
        first_time_only=yes
        [filter]
            type=Walking Corpse
        [/filter]

        [message]
            speaker=Drogan
            message= _ "What in blazes is that... that thing? Has tha necromancer returned already? His timin’ couldn’t be any worse..."
        [/message]

        [message]
            speaker=Malin Keshar
            message= _ "No, Drogan. I raised this corpse with the skills Darken Volk taught me before he left. I have no love for it, but we need to take action, or we’ll never be able to repel the orcs!"
        [/message]

        [message]
            speaker=Drogan
            message= _ "I’m ’shamed of ya, Malin. Even if it’d ensure our survival, nothin’ good ever comes of necromancy. The moment ya use it, you’ve already sold yer soul ta black magic!"
        [/message]

        [message]
            speaker=Malin Keshar
            message= _ "What?! I am hardly evil, Drogan!"
        [/message]

        [message]
            speaker=Drogan
            message= _ "Ya say that, but you’ve been very quiet ’bout why tha mages sent you home from Alduin. I’m beginning ta think you were already dabblin’ in this witchcraft even before ya met that necromancer!"
        [/message]

        [message]
            speaker=Malin Keshar
            message= _ "No! No... it was something stupid, something silly... it does not matter now! I’ll not stand by and allow the orcs to destroy my home while I have the power to prevent it!"
        [/message]

        {VARIABLE malin_used_necromancy yes}
    [/event]

    [event]
        name=moveto
        [filter]
            side=1
            x,y=17,16
        [/filter]

        [message]
            speaker=narrator
            message= _ "Welcome to Parthyn"
            image=scenery/signpost.png
        [/message]
    [/event]

    [event]
        name=moveto
        [filter]
            x,y=20,17
            id=Malin Keshar
        [/filter]
        [message]
            speaker=narrator
            message= _ "Ignorance is the parent of fear."
        [/message]

        {GIVE_MALIN_EXPERIENCE 4}
    [/event]

    [event]
        name=moveto
        [filter]
            x,y=30,15
            id=Malin Keshar
        [/filter]
        [message]
            speaker=narrator
            message= _ "A monolith of pale stone, luminous and bright, but cold and brittle to the touch."
        [/message]

        {GIVE_MALIN_EXPERIENCE 8}
    [/event]

    [event]
        name=moveto
        [filter]
            x,y=31,9
            side=1
        [/filter]

        [sound]
            name=zombie-hit-1.ogg
        [/sound]
        [delay]
            time=500
        [/delay]
        [unit]
            side=1
            x,y=31,9
            type=Soulless
            name= _ "Sushi"
            variation=swimmer
            animate=yes
        [/unit]

        # leaving a dead fish was something done by the mafia as a warning to the recipient, basically saying "you're going to sleep with the fishes"
        [message]
            speaker=Malin Keshar
            message= _ "Someone left a dead fish here."
        [/message]
    [/event]

    # Defeat Conditions
    [event]
        name=moveto
        [filter]
            side=2
            x=0-17
            y=13-20
        [/filter]

        [message]
            speaker=Malin Keshar
            message= _ "The orcs have broken through. Parthyn is open to attack!"
        [/message]

        [endlevel]
            result=defeat
        [/endlevel]
    [/event]

    # This shouldn't happen, but just in case
    [event]
        name=last breath
        [filter]
            id=Drogan
        [/filter]

        [message]
            speaker=unit
            message= _ "Who will be left to defend Parthyn?"
        [/message]

        [endlevel]
            result=defeat
        [/endlevel]
    [/event]

    [event]
        name=last breath
        [filter]
            id=Dela Keshar
        [/filter]

        [message]
            speaker=unit
            message= _ "I’m... dying..."
        [/message]

        [endlevel]
            result=defeat
        [/endlevel]
    [/event]

    # Victory Conditions
    [event]
        name=time over

        [unit]
            type=Swordsman
            x,y=5,17
            side=3
            id=Soldier
        [/unit]
        [unit]
            type=Longbowman
            x,y=6,17
            side=3
        [/unit]
        [unit]
            type=Javelineer
            x,y=6,18
            side=3
        [/unit]

        [message]
            speaker=Soldier
            message= _ "We’re back from the raid, Drogan. Seems like we made it just in time!"
        [/message]
        [message]
            speaker=Kreg'a'shar Trr
            message= _ "More humans! We’ll need more fighters to squash ’em all. Grunts, retreat!"
        [/message]

        [kill]
            side=2
        [/kill]

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

    # This is very unlikely, but just in case...
    [event]
        name=enemies defeated

        [message]
            speaker=Malin Keshar
            message= _ "The orcs are dead!"
        [/message]

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

    [event]
        name=victory

        [kill]
            side=2
            animate=no
            fire_event=no
        [/kill]

        [if]
            [variable]
                name=malin_used_necromancy
                boolean_equals=yes
            [/variable]
            [then]
                [message]
                    speaker=Drogan
                    message= _ "By all rights, Malin, I should have ya kill’d on tha spot. I can’t believe ya let that necromancer corrupt you. I s’ppose part o’ this is my fault since I let ’im into Parthyn, but still... Since I showed ’im mercy, I’ll show ya the same. I’m banishin’ you from Parthyn."
                [/message]

                [message]
                    speaker=Malin Keshar
                    message= _ "Fine words, Drogan. Would you rather have let the orcs overrun the town?"
                [/message]

                [message]
                    speaker=Drogan
                    # po: ’least is short for at least
                    message= _ "Aye, better that than ta even dabble in dark magic. We woulda rebuilt this place like always. Even if I died, ’least it woulda been with dignity. Too bad tha mages didn’t teach ya more sense."
                [/message]

                [message]
                    speaker=Malin Keshar
                    message= _ "I only did it to protect what I care about! Is this really what I deserve for saving your hides?"
                [/message]

                [message]
                    speaker=Drogan
                    message= _ "Yes, yes it is. Nobody’ll support ya on yer crazy path to depravity."
                [/message]

                # po: Hint, that the loyal units stay behind
                [message]
                    side=1
                    race=human
                    [not]
                        id=Malin Keshar,Dela Keshar,Drogan
                    [/not]
                    message= _ "We should all be glad to see you gone, necromancer. I detest having fought by your side."
                [/message]

                [message]
                    speaker=Malin Keshar
                    message= _ "Dela? Sister?"
                [/message]

                [message]
                    speaker=Dela Keshar
                    message= _ "Well..."
                [/message]

                [message]
                    speaker=Drogan
                    message= _ "Ya can’t support ’im on this one, Dela."
                [/message]

                [message]
                    speaker=Dela Keshar
                    message= _ "I... guess you’re right. You’ve decided your magic is more important than us, Malin. I can’t help you."
                [/message]

                [message]
                    speaker=Drogan
                    message= _ "Begone, Malin. I’ve no wish to see yer face around here ever again."
                [/message]
            [/then]
            [else]
                [message]
                    speaker=Drogan
                    message= _ "Bravely done holdin’ off them orcs by yerself, Malin. But we’re not outta trouble yet. The raidin’ party reports that more warlords be gatherin’ their armies in the hills, just a few days north o’ tha Great River. I don’t know if we can fight ’em all off."
                [/message]

                [message]
                    speaker=Malin Keshar
                    message= _ "Then we must seek help. It has not been long since Darken Volk’s departure. Perhaps I can find him and ask him to aid us."
                [/message]

                [message]
                    speaker=Drogan
                    message= _ "I’ll pretend like I didn’t hear that."
                [/message]

                [message]
                    speaker=Malin Keshar
                    message= _ "Then what would you have us do, Drogan? Let the orcs overrun Parthyn? Abandon our families to those savages?"
                [/message]

                [message]
                    speaker=Drogan
                    message= _ "Yes. Leave Parthyn fer now and rebuild later, like we always do."
                [/message]

                [message]
                    speaker=Malin Keshar
                    message= _ "Or we can drive off the orcs altogether and make sure they never attack us again. Surely I cannot be the only one who sees that what Drogan says is madness!"
                [/message]

                [message]
                    speaker=Drogan
                    message= _ "If ya go out on a quest to seek depravity, none o’ us will support ya."
                [/message]

                # po: Hint, that the loyal units stay behind
                [message]
                    side=1
                    race=human
                    [not]
                        id=Malin Keshar,Dela Keshar,Drogan
                    [/not]
                    message= _ "Better to die than to ally ourselves with a necromancer."
                [/message]

                [message]
                    speaker=Malin Keshar
                    message= _ "Dela? Sister?"
                [/message]

                [message]
                    speaker=Dela Keshar
                    message= _ "I hope that you’ll stay with us, Malin. Be reasonable."
                [/message]

                [message]
                    speaker=Malin Keshar
                    message= _ "Be reasonable? I am the only one who sees reason here. If no one will help me, I will go by myself."
                [/message]

                [message]
                    speaker=Dela Keshar
                    message= _ "Malin, seekin’ out the help of a necromancer is just... just foolhardy! We need ya here to help protect the town!"
                [/message]

                [message]
                    speaker=Malin Keshar
                    message= _ "You will eventually see that I am right, Dela. I am resolved."
                [/message]
            [/else]
        [/if]

        [modify_unit]
            [filter]
                side=1
                race=human
                [not]
                    id=Malin Keshar
                [/not]
            [/filter]
            side=3
        [/modify_unit]
    [/event]

    {HERODEATH_MALIN}
[/scenario]


#textdomain wesnoth-did

[scenario]
    id=02_Peaceful_Valley
    name= _ "Peaceful Valley"
    map_file=02_Peaceful_Valley.map
    victory_when_enemies_defeated=no
    {TURNS 19 17 15}
    next_scenario=03_A_Haunting_in_Winter

    {DEFAULT_SCHEDULE_MORNING}

    {SCENARIO_MUSIC       nunc_dimittis.ogg}
    {EXTRA_SCENARIO_MUSIC knolls.ogg}
    {EXTRA_SCENARIO_MUSIC casualties_of_war.ogg}

    [story]
        [part]
            music=the_king_is_dead.ogg
            story= _ "Bitter and alone, Malin follows the back-trail of the orcish band north from Parthyn. He curses the mages for casting him out from the Isle of Alduin only half-trained, unprepared for conflict. He curses Drogan for lacking the resolve to make the necessary sacrifices to protect their home. Most fiercely, he curses the orcs for their mindless savagery, pillagers and raiders who view violence as little more than sport."
            {STORYTXT_BACKGROUND_BIGMAP_DID}
        [/part]
        [part]
            story= _ "Three days’ travel northeast, Malin stumbles upon Darken Volk, the necromancer who had saved Parthyn and taught him to raise the dead. The dark mage suggests that they travel together; Malin obliges, having been abandoned by his kinsmen. As the weeks pass, Darken Volk teaches Malin more dark magic."
            {STORYTXT_BACKGROUND travel.jpg}
        [/part]
    [/story]

    {DID_TRACK {JOURNEY_02_NEW}}

    # wmllint: validate-off
    [side]
        side=1
        controller=human
        recruit=Walking Corpse,Vampire Bat
        {GOLD 105 90 75}
        team_name=good
        user_team_name= _ "Malin Keshar"
        {FLAG_VARIANT undead}
        color=darkblue

        # wmllint: recognize Malin Keshar
        {CHARACTER_STATS_MALIN_KESHAR}

        fog=yes
        shroud=yes
        facing=nw

        [unit]
            x,y=15,12
            facing=nw

            # wmllint: recognize Darken Volk
            {CHARACTER_STATS_DARKEN_VOLK}
        [/unit]
    [/side]
    # wmllint: validate-on

    [side]
        side=2
        controller=ai
        recruit=Goblin Rouser,Goblin Impaler,Wolf Rider
        {GOLD 25 40 55}
        team_name=goblins
        user_team_name= _ "Goblins"
        {FLAG_VARIANT6 ragged}
        color=white

        type=Goblin Knight
        id="T'shar Lggi"
        name= _ "T’shar Lggi"
        canrecruit=yes

        fog=yes
        facing=se

        [ai]
            village_value=2
            caution=0.5
            recruitment_pattern=scout,fighter
        [/ai]
    [/side]

    {STARTING_VILLAGES_ALL 2}
    {PLACE_IMAGE items/scarecrow.png 11 4}
    {PLACE_IMAGE items/straw-bale2.png 9 3}
    {PLACE_IMAGE items/key.png 7 9}
    {PLACE_IMAGE items/cage.png 4 12}
    {PLACE_IMAGE scenery/whitefang-flag.png 6 2}

    [event]
        name=prestart

        {CLEAR_CORPSE_HORDE}

        [objectives]
            side=1
            [objective]
                condition=win
                description= _ "Occupy all of the goblin villages"
            [/objective]
            [objective]
                condition=lose
                description= _ "Death of Malin Keshar"
            [/objective]
            [objective]
                condition=lose
                description= _ "Death of Darken Volk"
            [/objective]

            {TURNS_RUN_OUT}

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

        [item]
            x,y=8,2
            image=terrain/castle/encampment/tent2.png
        [/item]

        {VARIABLE key 0}
    [/event]

    [event]
        name=start

        [message]
            speaker=Darken Volk
            message= _ "In truth, I share your hatred for the orcs. The Northlands have been my home for many years and the orcs have been a growing infestation in recent times. They despoil the beauty of the land wherever they go, hacking and burning everything without care or concern. If you are interested, I would be happy to take you on as my... apprentice... so that I can teach you to fight against them."
        [/message]

        [message]
            speaker=Malin Keshar
            message= _ "Yes! These orcs have threatened my friends and my home for too long. It’s time I gained the power to put them in their place."
        [/message]

        [message]
            speaker=Darken Volk
            message= _ "Yes, perhaps removing the threat of orcish raids will persuade the people of Parthyn to welcome you back. But for now, I must train you. The orcs are powerful in the hills, strong enough that even I dare not confront them directly."
        [/message]

        [message]
            speaker=Malin Keshar
            message= _ "Then what shall we do?"
        [/message]

        [message]
            speaker=Darken Volk
            message= _ "Strike at them where they are weak. A goblin village lies in this valley, just ahead. They are the bastard children of the orcs, feeble creatures individually, but annoying enough in large numbers. Subduing them will provide us a supply of fresh corpses and souls to use against the orcs."
        [/message]

        [message]
            speaker=Darken Volk
            message= _ "... It will be a worthwhile test of your skills."
        [/message]
    [/event]

    # In-scenario events
    [event]
        name=capture
        first_time_only=yes
        [filter]
            side=1
        [/filter]

        [message]
            speaker=Darken Volk
            message= _ "Beware the goblin guards in the villages."
        [/message]
    [/event]

    [event]
        name=moveto
        [filter]
            x,y=7,9
            id=Malin Keshar
        [/filter]
        [message]
            speaker=Malin Keshar
            message= _ "Someone dropped a key here."
        [/message]
        {REMOVE_IMAGE 7 9}
        {VARIABLE key 1}
    [/event]

    [event]
        name=moveto
        [filter]
            x,y=4,12
            id=Malin Keshar
        [/filter]
        [filter_condition]
            [variable]
                name=key
                numerical_equals=1
            [/variable]
        [/filter_condition]

        [message]
            speaker=Malin Keshar
            message= _ "There are some rotten corpses in this cage."
        [/message]

        [message]
            speaker=Darken Volk
            message= _ "Make use of them."
        [/message]

        [delay]
            time=1000
        [/delay]

        [message]
            speaker=Darken Volk
            message= _ "A necromancer must always use whatever supplies he is given. Do it."
        [/message]

        [message]
            speaker=Malin Keshar
            message= _ "..."
        [/message]

        [animate_unit]
            [filter]
                id=Malin Keshar
            [/filter]
            [primary_attack]
                range=ranged
            [/primary_attack]
            flag=attack
        [/animate_unit]

        [delay]
            time=300
        [/delay]

        [sound]
            name=zombie-hit-2.ogg
        [/sound]

        [delay]
            time=300
        [/delay]

        [unit]
            side=1
            x,y=4,12
            type=Walking Corpse
            variation=goblin
            animate=yes
        [/unit]

        [unit]
            side=1
            x,y=4,12
            type=Soulless
            variation=goblin
            animate=yes
        [/unit]

        {REMOVE_IMAGE 4 12}
        {VARIABLE key 2}
    [/event]

    [event]
        name=attack
        [filter]
            id=Malin Keshar
        [/filter]

        [message]
            speaker=second_unit
            message= _ "Eeeek! Don’t kill me!"
        [/message]

        [message]
            speaker=Malin Keshar
            message= _ "..."
        [/message]

        [message]
            speaker=Darken Volk
            message= _ "Why do you hesitate? Did the orcs show your people any mercy when they attacked Parthyn?"
        [/message]

        # Malin answers first. For the time being, he's not deadened to merciless killing
        [message]
            speaker=Malin Keshar
            message= _ "... No."
        [/message]

        [delay]
            time=1000
        [/delay]
    [/event]

    [event]
        name=attack
        [filter]
            type=Ghoul
        [/filter]

        [message]
            speaker=second_unit
            message= _ "Ruuuun! The monster’s going to eat us!"
        [/message]
    [/event]

    [event]
        name=capture
        first_time_only=no
        [filter]
            side=1
        [/filter]

        [filter_condition]
            [variable]
                name=village_$x1|_$y1|_cleared
                boolean_not_equals=yes
            [/variable]
            [have_location]
                terrain=*^V*

                [not]
                    owner_side=1
                [/not]
            [/have_location]
        [/filter_condition]
        {VARIABLE_OP number_of_guards rand "0..2"}
        [random_placement]
            num_items="$number_of_guards"
            allow_less=yes
            variable=guard_location
            [filter_location]
                [filter_adjacent_location]
                    x,y=$x1,$y1
                [/filter_adjacent_location]
                [not]
                    [filter]
                    [/filter]
                [/not]
            [/filter_location]
            [command]
                [move_unit_fake]
                    side=2
                    type=Goblin Spearman
                    x=$x1,$guard_location.x
                    y=$y1,$guard_location.y
                [/move_unit_fake]

                [unit]
                    id=guard_$x1|_$y1|_$guard_location.n
                    name= _ "Villager"
                    type=Goblin Spearman
                    side=2
                    x,y=$guard_location.x,$guard_location.y
                    random_traits=yes
                [/unit]
            [/command]
        [/random_placement]
        {VARIABLE village_$x1|_$y1|_cleared yes}

        # Trigger an easter egg sometime after three villages have been taken
        [if]
            [variable]
                name=done_shaun
                not_equals=yes
            [/variable]
            [variable]
                name=number_of_guards
                numerical_equals=2
            [/variable]
            [have_location]
                owner_side=1
                count=3-infinity
            [/have_location]

            # Make sure the guards actually exist, in case there was no space for them
            [have_unit]
                # wmllint: recognize guard_$x1|_$y1|_1
                id=guard_$x1|_$y1|_1
            [/have_unit]
            [have_unit]
                # wmllint: recognize guard_$x1|_$y1|_2
                id=guard_$x1|_$y1|_2
            [/have_unit]

            [then]
                [modify_unit]
                    [filter]
                        id=guard_$x1|_$y1|_1
                    [/filter]
                    #po: Shaun and Ed are characters from the zombie film "Shaun of the Dead".
                    #po: If the names cannot be translated into your language so that the
                    #po: movie reference remains recognizable, then simply translate these the
                    #po: same as "Villager" above.
                    name= _ "Shaun"
                [/modify_unit]
                [modify_unit]
                    [filter]
                        id=guard_$x1|_$y1|_2
                    [/filter]
                    name= _ "Ed"
                [/modify_unit]

                {VARIABLE done_shaun yes}
            [/then]
        [/if]

        # If there was a goblin next to the village before the guards spawned, the player may have
        # already commanded their unit to attack. But as there are now more enemies, give the
        # player a chance to choose a different opponent.
        [if]
            [variable]
                name=number_of_guards
                greater_than=0
            [/variable]
            [then]
                [cancel_action][/cancel_action]
            [/then]
        [/if]

        {CLEAR_VARIABLE number_of_guards,guard_location}
    [/event]

    [event]
        name=enter hex
        [filter]
            side=1
            x,y=13-19,8-10
        [/filter]

        [message]
            speaker=Darken Volk
            message= _ "Ahhh... I did not realize there was a swamp near this village. Malin, it would be beneficial for your training if we were to investigate."
        [/message]
    [/event]

    [event]
        name=moveto
        [filter]
            id=Darken Volk,Malin Keshar
            [filter_location]
                terrain=Ss,Ss^*,Sm,Sm^*
            [/filter_location]
        [/filter]

        [message]
            speaker=Darken Volk
            message=_ "Rise from the realms of death and decay!"
        [/message]

        [scroll_to]
            x,y=19,6
        [/scroll_to]

        {GENERIC_UNIT 1 Ghoul 19 6}
        [+unit]
            facing=sw
        [/unit]

        {GENERIC_UNIT 1 Ghoul 20 5}
        [+unit]
            facing=sw
        [/unit]

        {GENERIC_UNIT 1 Ghoul 20 6}
        [+unit]
            facing=sw
        [/unit]

        [redraw]
            side=1
            clear_shroud=yes
        [/redraw]

        [delay]
            time=1000
        [/delay]

        [redraw]
            side=1
        [/redraw]

        [message]
            speaker=Malin Keshar
            message= _ "What are these things?"
        [/message]

        [message]
            speaker=Darken Volk
            message= _ "They are ghouls — noxious beings fashioned from living flesh into carcasses of disease and poison. Those that outlive their masters gravitate towards the natural decay present in swamps and bogs."
        [/message]

        [message]
            speaker=Malin Keshar
            message= _ "Isn’t it cruel to turn men into such hideous forms?"
        [/message]

        [message]
            speaker=Darken Volk
            message= _ "You need not pity them. Once, these were... evil men... murderers and outlaws, no better than the orcs you hunt. I have transformed them so their physical forms match the spirits within. Is that not fitting? No punishment is too great for their kind."
        [/message]

        [message]
            speaker=Malin Keshar
            message= _ "I suppose so..."
        [/message]
    [/event]

    [event]
        name=die
        [filter]
            id="T'shar Lggi"
        [/filter]

        [message]
            speaker=Malin Keshar
            message= _ "The big wolf is done with."
        [/message]
    [/event]

    # Victory Condition
    [event]
        name=capture
        first_time_only=no
        [filter]
            side=1
        [/filter]
        # When capturing a village we check if we own all villages of the map
        [filter_condition]
            [not]
                [have_location]
                    terrain=*^V*

                    [not]
                        owner_side=1
                    [/not]
                [/have_location]
            [/not]
        [/filter_condition]

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

    [event]
        name=victory

        [message]
            speaker=Malin Keshar
            message= _ "Sacking goblin villages is all well and good, but corpses and bats will not stand up to full orcish warriors."
        [/message]

        [message]
            speaker=Darken Volk
            message= _ "Have some patience. We have only just begun your training. These carcasses will supply you sufficient resources for practice. When you have mastered the basics, we will then assault the orcs and you will see your forces grow quickly."
        [/message]

        [store_villages]
            variable=villages
        [/store_villages]

        [foreach]
            array=villages
            [do]
                {VARIABLE_OP village_var value "village_$this_item.x|_$this_item.y|_cleared"}

                {CLEAR_VARIABLE $village_var}
            [/do]
        [/foreach]

        {CLEAR_VARIABLE villages,village_var,done_shaun,key}
    [/event]

    {HERODEATH_MALIN}
    {HERODEATH_VOLK}

    {TIME_OVER_DEFEAT}
[/scenario]