#textdomain wesnoth-ei
[scenario]
    id=Duel
    name= _ "The Duel"
    map_data="{campaigns/Eastern_Invasion/maps/The_Arena.map}"
    turns=-1
    next_scenario=Epilog

    {UNDERGROUND}

    {INTRO_AND_SCENARIO_MUSIC underground.ogg the_deep_path.ogg}
    {EXTRA_SCENARIO_MUSIC the_dangerous_symphony.ogg}
    {EXTRA_SCENARIO_MUSIC legends_of_the_north.ogg}

    [side]
        type=Lieutenant
        id=Gweddry
        name= _ "Gweddry"
        side=1
        canrecruit=yes
        controller=human
        team_name=good
        user_team_name=_"Wesnothians"
        gold=200
    [/side]

    [side]
        type=Ancient Lich
        id=Mal-Ravanal
        name= _ "Mal-Ravanal"
        side=2
        canrecruit=yes
        recruit=
        controller=ai
        gold=0
        team_name=bad
        user_team_name=_"Undead"
        profile=portraits/mal-ravanal.png
        {FLAG_VARIANT undead}

        [ai]
            aggression=0.6
            caution=0.2
            leader_value=20

            [avoid]
                x=20
                y=4
            [/avoid]

            [avoid]
                x=28
                y=8
            [/avoid]
        [/ai]
    [/side]

    [event]
        name=prestart
        [objectives]
            side=1
            [objective]
                description= _ "Defeat Mal-Ravanal"
                condition=win
            [/objective]
            [objective]
                description= _ "Death of Gweddry"
                condition=lose
            [/objective]
        [/objectives]
    [/event]

    [event]
        name=start

        [message]
            speaker=Mal-Ravanal
            message= _ "I have waited a long time for this day to come. Prepare to die, Gweddry of Wesnoth!"
        [/message]
        [scroll_to_unit]
            id=Gweddry
        [/scroll_to_unit]
        [message]
            speaker=narrator
            #wmllint: display on
            message= _ "The rules of the duel are these:
You may recruit or recall up to 6 units.
At the end of your first turn, your keep will disappear, and you must battle with whatever troops you have at that time.
The first leader to fall loses the duel."
            #wmllint: display off
            image=wesnoth-icon.png
        [/message]
    [/event]

#define DUEL_UNIT TYPE X Y
    [unit]
        type={TYPE}
        side=2
        x={X}
        y={Y}
        random_traits=yes
        animate=yes
        moves=0
    [/unit]
#enddef

    [event]
        name=turn 2

        {DUEL_UNIT (Necromancer) 24 5}
        {DUEL_UNIT (Lich) 25 6}
        {DUEL_UNIT (Deathblade) 25 7}
        {DUEL_UNIT (Draug) 24 7}
        {DUEL_UNIT (Death Knight) 23 7}
        {DUEL_UNIT (Spectre) 23 6}

        [terrain]
            x,y=6,15
            terrain=Cud
        [/terrain]

        [terrain]
            x,y=24,6
            terrain=Cud
        [/terrain]
    [/event]

    [event]
        name=turn 5

        {DUEL_UNIT (Revenant) 20 4}
        {DUEL_UNIT (Bone Shooter) 28 8}
        {DUEL_UNIT (Necrophage) 25 9}

        [message]
            speaker=Gweddry
            message= _ "Wait - what just happened? He called more warriors out of the ground! That's not allowed!"
        [/message]
        [message]
            speaker=Mal-Ravanal
            message= _ "Stop talking and fight! The rules do not stop me from bringing up warriors that were already here."
        [/message]
    [/event]

    [event]
        name=last breath
        [filter]
            id=Mal-Ravanal
        [/filter]
        [message]
            speaker=Mal-Ravanal
            message= _ "I... lose?..."
        [/message]
        [endlevel]
            result=victory
            carryover_report=no
            save=no
        [/endlevel]
    [/event]

    [event]
        name=turn 11,turn 17,turn 23,turn 30,turn 38,turn 47,turn 57,turn 68,turn 80
        first_time_only=no

        [message]
            speaker=Mal-Ravanal
            message= _ "And more!"
        [/message]

        {DUEL_UNIT (Revenant) 20 4}
        {DUEL_UNIT (Bone Shooter) 28 8}
        {DUEL_UNIT (Necrophage) 25 9}
    [/event]

    {LATE_DEFEAT}
[/scenario]
