#textdomain wesnoth-ei
[scenario]
    id=16_Weldyn_under_Attack
    name= _ "Weldyn under Attack"
    next_scenario=17a_The_Duel
    map_data="{campaigns/Eastern_Invasion/maps/16_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}

    {INTRO_AND_SCENARIO_MUSIC the_city_falls.ogg loyalists.ogg}
    {EXTRA_SCENARIO_MUSIC vengeful.ogg}
    {EXTRA_SCENARIO_MUSIC battle.ogg}

    {campaigns/Eastern_Invasion/utils/deaths.cfg}

    [side]
        type=Lieutenant
        id=Gweddry
        name= _ "Gweddry"
        side=1
        canrecruit=yes
        controller=human
        team_name=good
        user_team_name=_"Wesnothians"
        {GOLD 250 200 200}
        {FLAG_VARIANT loyalist}
    [/side]

    {AI_CONTROLLER () 1 2,3,4 ()}

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

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

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

    [side]
        type=Lich
        id=Mal-Uknalu
        name= _ "Mal-Uknalu"
        side=7
        canrecruit=yes
        recruit=Nightgaunt,Revenant,Banebow
        team_name=undead
        user_team_name=_"Undead"
        {GOLD 425 600 700}
        [ai]
            recruitment_pattern=scout,fighter,fighter,scout,fighter,archer,fighter
            {NO_SCOUTS}
        [/ai]
        {FLAG_VARIANT undead}
    [/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
                show_turn_counter=yes
            [/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]

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

            {AI_CONTROLLER_NOTE}
        [/objectives]
    [/event]

    #start event
    [event]
        name=start
        [recall]
            id=Dacyn
        [/recall]
        [recall]
            id=Owaec
        [/recall]
        [recall]
            id=Grug
        [/recall]
        [recall]
            id=Engineer
        [/recall]
        [unit]
            id=Konrad
            name= _ "Konrad II"
            profile=portraits/konrad_II.png
            {IS_HERO}
            type=General
            side=1
            x=21
            y=20
        [/unit]
        [object]
            id=sceptre of fire
            silent=yes
            duration=forever

            [filter]
                id=Konrad
            [/filter]

            {SCEPTRE_OF_FIRE_EFFECT}
        [/object]
        [message]
            speaker=Gweddry
            message= _ "We will fight soon, my lord. Look, night approaches; they will soon attack. I hope we can hold them off."
        [/message]
        [message]
            speaker=Konrad
            message= _ "Very well. But this... Mal-Ravanal, that you spoke of, is he here?"
        [/message]
        [message]
            speaker=Dacyn
            message= _ "I do not sense his magic, but he might be concealing his presence."
        [/message]
        [message]
            speaker=Owaec
            message= _ "In any case, the undead are attacking now. Let us hope we can last out the night."
        [/message]
    [/event]

    [event]
        name=last breath
        [filter]
            id=Konrad
        [/filter]
        [message]
            speaker=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
        id=Messenger of Doom
        name= _ "Messenger of Doom"
        x=43
        y=1
    [/unit]
    {MOVE_UNIT (id=Messenger of Doom) 39 4}
    [message]
        speaker=Messenger of Doom
        message= _ "I come bearing a message from my leader."
    [/message]
    [message]
        speaker=Dacyn
        message= _ "Very well, you may read it. It might tell us something useful."
    [/message]
    [message]
        speaker=Messenger of Doom
        message= _ "He says: <i>“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.”</i>"
    [/message]
    [message]
        speaker=Gweddry
        message= _ "What is the point of this message? Does it consist of anything more than insults?"
    [/message]
    [message]
        speaker=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]
        speaker=Gweddry
        message= _ "What are his terms? I won’t accept anything obviously weighted towards his victory!"
    [/message]
    [message]
        speaker=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]
        speaker=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]
        speaker=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]
        speaker=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]
        speaker=Gweddry
        message= _ "Hmm..."
        [option]
            message= _ "I will accept this challenge. By your own master’s terms, that proves I am no coward."
            [command]
                [endlevel]
                    result=victory
                    next_scenario=17a_The_Duel
                    {NEW_GOLD_CARRYOVER 40}
                [/endlevel]
            [/command]
        [/option]
        [option]
            message= _ "I will not accept a fight in which he will obviously cheat! I refuse!"
            [command]
                [endlevel]
                    result=victory
                    next_scenario=17b_Weldyn_Besieged
                    {NEW_GOLD_CARRYOVER 40}
                [/endlevel]
            [/command]
        [/option]
    [/message]
#enddef

    [event]
        name=time over

        [message]
            speaker=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]
