#textdomain wesnoth-ei
[scenario]
    id=Weldyn_Attack
    name= _ "Weldyn under Attack"
    map_data="{campaigns/Eastern_Invasion/maps/Weldyn_under_Attack.map}"
    turns=18

    {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}
    {DAWN}
    {DAWN}

    next_scenario=Duel

    {DEFAULT_MUSIC_PLAYLIST}

    {campaigns/Eastern_Invasion/utils/deaths.cfg}

    [side]
        type=Lieutenant
        description=Gweddry
        user_description= _ "Gweddry"
        side=1
        canrecruit=yes
        controller=human
        team_name=good
        {GOLD 250 200 150}
    [/side]

    [side]
        type=General
        description=Halrad
        user_description= _ "Halrad"
        side=2
        canrecruit=yes
        recruit=Heavy Infantryman,Swordsman,Mage
        controller=ai
        {GOLD 200 150 100}
        team_name=good
        [ai]
            recruitment_pattern=fighter,fighter,mixed fighter
            villages_per_scout=0
        [/ai]
    [/side]
    [side]
        type=General
        description=Halric
        user_description= _ "Halric"
        side=3
        canrecruit=yes
        recruit=Heavy Infantryman,Swordsman,Red Mage
        controller=ai
        {GOLD 250 200 150}
        team_name=good
        [ai]
            recruitment_pattern=fighter,fighter,mixed fighter
            villages_per_scout=0
        [/ai]
    [/side]
    [side]
        type=General
        description=Halrod
        user_description= _ "Halrod"
        side=4
        canrecruit=yes
        recruit=Shock Trooper,Swordsman,Mage
        controller=ai
        {GOLD 250 200 150}
        team_name=good
        [ai]
            recruitment_pattern=fighter,fighter,mixed fighter
            villages_per_scout=0
        [/ai]
    [/side]

    [side]
        type=Lich
        description=Mal-Grekulak
        user_description= _ "Mal-Grekulak"
        side=5
        canrecruit=yes
        recruit=Spectre,Revenant,Banebow
        team_name=undead
        {GOLD 425 600 700}
        [ai]
            recruitment_pattern=scout,fighter,fighter,scout,fighter,archer,fighter
            {NO_SCOUTS}
        [/ai]
    [/side]

    [side]
        type=Lich
        description=Mal-Xakralan
        user_description= _ "Mal-Xakralan"
        side=6
        canrecruit=yes
        recruit=Necrophage,Revenant,Banebow,Blood Bat
        team_name=undead
        {GOLD 425 600 700}
        [ai]
            recruitment_pattern=scout,fighter,fighter,scout,fighter,archer,fighter
            {NO_SCOUTS}
        [/ai]
    [/side]

    [side]
        type=Lich
        description=Mal-Uknalu
        user_description= _ "Mal-Uknalu"
        side=7
        canrecruit=yes
        recruit=Nightgaunt,Revenant,Banebow
        team_name=undead
        {GOLD 425 600 700}
        [ai]
            recruitment_pattern=scout,fighter,fighter,scout,fighter,archer,fighter
            {NO_SCOUTS}
        [/ai]
    [/side]

    {STARTING_VILLAGES 1 5}
    {STARTING_VILLAGES 2 5}
    {STARTING_VILLAGES 3 5}
    {STARTING_VILLAGES 4 5}

    [event]
        name=prestart
        [objectives]
            side=1
            [objective]
                description= _ "Survive until end of turns"
                condition=win
            [/objective]
            [objective]
                description= _ "Death of Gweddry"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Dacyn"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Owaec"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Konrad II"
                condition=lose
            [/objective]
        [/objectives]
    [/event]

    #start event
    [event]
        name=start
        [recall]
            description=Dacyn
        [/recall]
        [recall]
            description=Owaec
        [/recall]
        [recall]
            description=Grug
        [/recall]
        [recall]
            description=Engineer
        [/recall]
        [unit]
            description=Konrad
            user_description= _ "Konrad II"
            profile=portraits/konrad_II.png
            type=General
            side=1
            x=21
            y=20
        [/unit]
        [message]
            description=Gweddry
            message= _ "We will fight soon, my lord. Look, night approaches; they will soon attack. I hope we can hold them off."
        [/message]
        [message]
            description=Konrad
            message= _ "Very well. But this... Mal-Ravanal, that you spoke of, is he here?"
        [/message]
        [message]
            description=Dacyn
            message= _ "I do not sense his magic, but he might be concealing his presence."
        [/message]
        [message]
            description=Owaec
            message= _ "In any case, the undead are attacking now. Let us hope we can last out the night."
        [/message]
    [/event]

    [event]
        name=die
        [filter]
            description=Konrad
        [/filter]
        [message]
            description=Konrad
            message= _ "I have died, and with me gone the city shall fall."
        [/message]
        [endlevel]
            result=defeat
        [/endlevel]
    [/event]

    # you can win either by waiting till the turns run out or by defeating the enemies,
    # so what happens next is macroified here so it doesn't need to be manually repeated
#define MESSENGER_AND_CHOICE
    [unit]
        type=Spectre
        side=7
        description=Messenger of Doom
        user_description= _ "Messenger of Doom"
        x=43
        y=1
    [/unit]
    {MOVE_UNIT (description=Messenger of Doom) 39 4}
    [message]
        description=Messenger of Doom
        message= _ "I come bearing a message from my leader."
    [/message]
    [message]
        description=Dacyn
        message= _ "Very well, you may read it. It might tell us something useful."
    [/message]
    [message]
        description=Messenger of Doom
        message= _ "He says: 'Well done; you have defeated some of my less powerful captains, and a small fraction of my horde. Were I to bring the whole might of my Dread Legions to bear I could crush you like an insect. But I seek a victory that will reveal the true extent of my personal power. Unlike the Great General Gweddry I do not seek to hide behind the armored skirts of my soldiers! You, O commander Gweddry, are a coward! The bards may sing that you defeated my captains, but in reality you did nothing but cower far behind the lines in safety while others braver than you fought and died in your name.'"
    [/message]
    [message]
        description=Gweddry
        message= _ "What is the point of this message? Does it consist of anything more than insults?"
    [/message]
    [message]
        description=Messenger of Doom
        message= _ "The point is that you did not defeat my Lord's minions, it was others doing the work for you! The mighty Gweddry himself would last but a few moments in actual combat. And my master seeks to prove this. He challenges you, Gweddry, to a contest, a battle."
    [/message]
    [message]
        description=Gweddry
        message= _ "What are his terms? I won't accept anything obviously weighted towards his victory!"
    [/message]
    [message]
        description=Messenger of Doom
        message= _ "That only proves you are a coward. Nevertheless, these are his terms: You pick your six best warriors and he will pick his six best. Then you will fight, to the death; until either you or he is destroyed!"
    [/message]
    [message]
        description=Owaec
        message= _ "Gweddry, I don't think you should accept. He is bound to bring more than six Undead to the battle; he will bring an army!"
    [/message]
    [message]
        description=Dacyn
        message= _ "Well, I think you should accept. There is a small chance that it will be a fair fight, and otherwise we will definitely have to face his whole undead army."
    [/message]
    [message]
        description=Messenger of Doom
        message= _ "I will simplify your choice. Accept, coward, or face the onslaught of my lord's hordes at dawn tomorrow!"
    [/message]
    [message]
        description=Gweddry
        message= _ "Hmm..."
        [option]
            message= _ "I will accept this challenge. By your own master's terms, that proves I am no coward."
            [command]
                [store_unit]
                    [filter]
                        description=Konrad
                    [/filter]
                    variable=konrad
                    kill=yes
                [/store_unit]
                [endlevel]
                    result=victory
                    next_scenario=Duel
                [/endlevel]
            [/command]
        [/option]
        [option]
            message= _ "I will not accept a fight in which he will obviously cheat! I refuse!"
            [command]
                [store_unit]
                    [filter]
                        description=Konrad
                    [/filter]
                    variable=konrad
                    kill=yes
                [/store_unit]
                [endlevel]
                    result=victory
                    next_scenario=Reject
                [/endlevel]
            [/command]
        [/option]
    [/message]
#enddef

    [event]
        name=time over

        [message]
            description=Dacyn
            message= _ "Look, the sun has risen, and the undead are retreating."
        [/message]

        {MESSENGER_AND_CHOICE}
    [/event]

    [event]
        name=enemies defeated

        {MESSENGER_AND_CHOICE}
    [/event]
[/scenario]
