#textdomain wesnoth-ei
[scenario]
    id=07b_Undead_Crossing
    name= _ "Undead Crossing"
    map_data="{campaigns/Eastern_Invasion/maps/07b_Undead_Crossing.map}"
    turns=21
    next_scenario=08_Training_the_Ogres

    {INTRO_AND_SCENARIO_MUSIC revelation.ogg the_king_is_dead.ogg}
    {EXTRA_SCENARIO_MUSIC suspense.ogg}
    {EXTRA_SCENARIO_MUSIC transience.ogg}
    {EXTRA_SCENARIO_MUSIC the_city_falls.ogg}

    {DEFAULT_SCHEDULE}

    {EI_TRACK {JOURNEY_07B_NEW} }

    # wmllint: validate-off
    [side]
        side=1
        controller=human
        {GOLD 160 150 140}
        team_name=good
        user_team_name= _ "Wesnothians"
        {FLAG_VARIANT loyalist}

        # wmllint: recognize Gweddry
        {CHARACTER_STATS_GWEDDRY}
    [/side]
    # wmllint: validate-on

    {STARTING_VILLAGES 1 7}

    [side]
        type=Necromancer
        id=Mal-un-Karad
        name= _ "Mal-un-Karad"
        side=2
        canrecruit=yes
        controller=ai
        recruit=Blood Bat,Ghost,Skeleton,Skeleton Archer,Ghoul
        {GOLD 130 160 200}
        team_name=undead
        user_team_name=_"Undead"
        {FLAG_VARIANT undead}

        [ai]
            grouping=no
            passive_leader=yes
            villages_per_scout=12
            recruitment_pattern=scout,scout,fighter,fighter,archer
        [/ai]

        {LOYAL_UNIT 2 (Skeleton) 18 5} {GUARDIAN}
        {LOYAL_UNIT 2 (Skeleton) 17 10} {GUARDIAN}
        {LOYAL_UNIT 2 (Skeleton Archer) 26 10} {GUARDIAN}
    [/side]

    {LIMIT_CONTEMPORANEOUS_RECRUITS 2 "Blood Bat" 3}

    {STARTING_VILLAGES 2 7}

    [side]
        no_leader=yes
        side=3
        controller=null
        team_name=undead
        user_team_name=_"Monsters"
        hidden=yes
    [/side]

    [event]
        name=prestart

        [objectives]
            side=1
            [objective]
                description= _ "Defeat the enemy leader"
                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]

            {TURNS_RUN_OUT}

            [gold_carryover]
                bonus=no
                carryover_percentage=70
            [/gold_carryover]
        [/objectives]
    [/event]

    [event]
        name=start
        [recall]
            id=Dacyn
        [/recall]
        [recall]
            id=Owaec
        [/recall]
        [message]
            speaker=Gweddry
            message= _ "These fens look impassable. I don’t think we will be able to continue on this road; it is time to turn northwards, away from these undead."
        [/message]
        [message]
            speaker=Dacyn
            message= _ "We must cross this river, then. We must make haste, already we have wasted too much time. Undead have positioned themselves in the middle of the ford."
        [/message]
        [message]
            speaker=Owaec
            message= _ "Across this river lie the Northlands. Ogres live there, as do orcs. We should proceed with caution. The undead are dangerous, but the orcs may be more dangerous still."
        [/message]
        [message]
            speaker=Mal-un-Karad
            message= _ "I will leave your bodies to rot in the river, then I will raise you up to serve in my Master’s undead hordes!"
        [/message]
    [/event]

    [event]
        name=spawn creatures

        [message]
            speaker=Mal-un-Karad
            message= _ "Creatures from the deep, I summon thee to destroy this foe!"
        [/message]

        [scroll_to_unit]
            id=Mal-un-Karad
        [/scroll_to_unit]

        [delay]
            time=250
        [/delay]

        [animate_unit]
            [filter]
                id=Mal-un-Karad
            [/filter]

            flag=recruiting
        [/animate_unit]

        [sound]
            name=lightning.ogg
        [/sound]

        [color_adjust]
            red=100
            green=100
            blue=100
        [/color_adjust]

        [delay]
            time=10
        [/delay]

        [color_adjust]
            red=0
            green=0
            blue=0
        [/color_adjust]

        [modify_side]
            side=3
            controller=ai
            hidden=no
        [/modify_side]

        [micro_ai]
            side=3
            ai_type=big_animals
            action=add

            [filter]
            [/filter]

            [filter_location]
                [filter]
                    side=1
                [/filter]
            [/filter_location]

            [filter_location_wander]
                terrain=S*,W*
            [/filter_location_wander]
        [/micro_ai]

#define DRAMATIC_ENTRANCE
    [+unit]
        animate=yes
    [/unit]
#enddef

        {LOYAL_UNIT 3 (Cuttle Fish) 11 9} {DRAMATIC_ENTRANCE}
        {LOYAL_UNIT 3 (Cuttle Fish) 21 14} {DRAMATIC_ENTRANCE}
        {LOYAL_UNIT 3 (Water Serpent) 15 21} {DRAMATIC_ENTRANCE}

#ifndef EASY
        {LOYAL_UNIT 3 (Sea Serpent) 24 2} {DRAMATIC_ENTRANCE}
#ifdef HARD
        {LOYAL_UNIT 3 (Cuttle Fish) 34 12} {DRAMATIC_ENTRANCE}
#endif
#endif

#undef DRAMATIC_ENTRANCE

        [message]
            speaker=Dacyn
            message= _ "It seems as if in addition to summoning undead this foul sorcerer has learned to call up monsters from the deep!"
        [/message]
    [/event]

    [event]
        name=turn 8

        [fire_event]
            name=spawn creatures
        [/fire_event]
    [/event]

    [event]
        name=moveto

        [filter]
            side=1

            [filter_location]
                [filter]
                    id=Mal-un-Karad
                [/filter]

                radius=3
            [/filter_location]
        [/filter]

        [fire_event]
            name=spawn creatures
        [/fire_event]
    [/event]

    [event]
        name=last breath

        [filter]
            id=Mal-un-Karad
        [/filter]

        [message]
            speaker=unit
            message= _ "I failed my Master..."
        [/message]
    [/event]

    [event]
        name=die

        [filter]
            id=Mal-un-Karad
        [/filter]

        [filter_condition]
            [have_unit]
                side=3
            [/have_unit]
        [/filter_condition]

        [message]
            side=3
            message= _ "<i>HISS!</i>"
        [/message]

        [kill]
            side=3
            animate=no
        [/kill]

        [message]
            speaker=Owaec
            message= _ "The sea creatures are gone!"
        [/message]
    [/event]

    [event]
        name=enemies defeated

        [message]
            speaker=Dacyn
            message= _ "We have no time to lose! Let's get moving quickly before the rest of their army catches up with us."
        [/message]

        [endlevel]
            result=victory
            bonus=no
            {NEW_GOLD_CARRYOVER 70}
        [/endlevel]
    [/event]

    {WESNOTH_DEFEAT}

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