#textdomain wesnoth-ei
[scenario]
    id=14_Approaching_Weldyn
    name= _ "Approaching Weldyn"
    map_data="{campaigns/Eastern_Invasion/maps/14_Approaching_Weldyn.map}"
    turns=24
    next_scenario=15_The_Council

    {DEFAULT_SCHEDULE}

    {INTRO_AND_SCENARIO_MUSIC loyalists.ogg frantic.ogg}
    {EXTRA_SCENARIO_MUSIC vengeful.ogg}
    {EXTRA_SCENARIO_MUSIC knalgan_theme.ogg}

    {EI_TRACK {JOURNEY_14_NEW} }

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

#define INVADER_AI_STUFF
    [ai]
        [goal]
            [criteria]
                side=1
            [/criteria]
            value=100
        [/goal]
        [goal]
            [criteria]
                side=5
            [/criteria]
            value=0.01
        [/goal]
    [/ai]
#enddef

    [side]
        type=Necromancer
        id=Mal-un-Darak
        name= _ "Mal-un-Darak"
        side=2
        canrecruit=yes
        facing=sw
        controller=ai
        recruit=Skeleton,Skeleton Archer,Ghost
        {GOLD 250 300 350}
        [ai]
            recruitment_pattern=fighter,archer,scout
        [/ai]
        team_name=undead
        user_team_name=_"Undead"
        {INVADER_AI_STUFF}
        {FLAG_VARIANT undead}
    [/side]

    [side]
        type=Necromancer
        id=Mal-un-Zanrad
        name= _ "Mal-un-Zanrad"
        side=3
        canrecruit=yes
        controller=ai
        recruit=Walking Corpse,Vampire Bat,Skeleton
        {GOLD 250 300 350}
        [ai]
            recruitment_pattern=fighter,fighter,scout
        [/ai]
        team_name=undead
        user_team_name=_"Undead"
        {INVADER_AI_STUFF}
        {FLAG_VARIANT undead}
    [/side]

    [side]
        type=Necromancer
        id=Mal-un-Xadrux
        name= _ "Mal-un-Xadrux"
        side=4
        canrecruit=yes
        controller=ai
        recruit=Revenant,Bone Shooter,Wraith
        {GOLD 325 375 425}
        [ai]
            recruitment_pattern=fighter,archer,scout
        [/ai]
        team_name=undead
        user_team_name=_"Undead"
        {INVADER_AI_STUFF}
        {FLAG_VARIANT undead}
    [/side]

    [side]
        type=General
        id=Konrad II
        name= _ "Konrad II"
        profile=portraits/konrad_II.png
        side=5
        canrecruit=yes
        facing=sw
        controller=ai
        recruit=Swordsman,Pikeman,Longbowman
        {GOLD 200 150 100}
        team_name=good
        user_team_name=_"Wesnothians"
        [ai]
            passive_leader=yes
        [/ai]
        {FLAG_VARIANT loyalist}
    [/side]

    {STARTING_VILLAGES 5 8}

    [event]
        name=prestart
        [objectives]
            side=1
            [objective]
                description= _ "Move Gweddry to Weldyn castle"
                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]

            {TURNS_RUN_OUT}

            [gold_carryover]
                bonus=yes
                carryover_percentage=40
            [/gold_carryover]
        [/objectives]
        {GENERIC_UNIT 5 (Swordsman) 16 31} {GUARDIAN}
        {GENERIC_UNIT 5 (Swordsman) 15 28} {GUARDIAN}
        {GENERIC_UNIT 5 (Swordsman) 15 24} {GUARDIAN}
        {GENERIC_UNIT 5 (Swordsman) 19 22} {GUARDIAN}
        {GENERIC_UNIT 5 (Swordsman) 26 22} {GUARDIAN}
        {GENERIC_UNIT 5 (Swordsman) 29 27} {GUARDIAN}
    [/event]

    [event]
        name=start
        [recall]
            id=Dacyn
        [/recall]
        [recall]
            id=Owaec
        [/recall]
        [recall]
            id=Grug
        [/recall]
        [recall]
            id=Engineer
        [/recall]
        [recall]
            id=Terraent
        [/recall]
        [message]
            speaker=Gweddry
            message= _ "We have finally reached Weldyn, but it seems the undead have it surrounded. We must break through to reach the king!"
        [/message]
        [message]
            speaker=Dacyn
            message= _ "It would be best not to waste time defeating these undead, they are but a small fraction of the host we face. We should go straight to the city and prepare our defenses."
        [/message]
    [/event]

    [event]
        name=moveto
        [filter]
            x=20-24
            y=26-29
            id=Gweddry
        [/filter]
        [message]
            speaker=Gweddry
            message= _ "My liege, we have vital information about the leader of these undead."
        [/message]
        [message]
            speaker=Konrad II
            message= _ "Come, into the castle."
        [/message]
        [endlevel]
            result=victory
            bonus=yes
            {NEW_GOLD_CARRYOVER 40}
        [/endlevel]
    [/event]

    [event]
        name=last breath
        [filter]
            id=Konrad II
        [/filter]
        [message]
            speaker=Konrad II
            message= _ "Weldyn has been captured, and Wesnoth is no more..."
        [/message]
        [endlevel]
            result=defeat
        [/endlevel]
    [/event]

    {LATE_DEFEAT}

    {HERODEATH_GWEDDRY}
    {HERODEATH_DACYN}
    {HERODEATH_OWAEC}
    {HERODEATH_GRUG}
    {HERODEATH_ENGINEER}
[/scenario]
