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

    {DEFAULT_SCHEDULE}

    {INTRO_AND_SCENARIO_MUSIC loyalists.ogg revelation.ogg} {LET_INTRO_MUSIC_FINISH}

    {EI_TRACK {JOURNEY_07A_NEW} }

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

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

    [side]
        type=Bone Knight
        id=Garnad
        name= _ "Garnad"
        side=2
        canrecruit=yes
        controller=ai
        recruit=Skeleton Rider,Vampire Bat,Skeleton,Skeleton Archer
        [ai]
            recruitment_pattern=fighter,fighter,scout,scout,archer
            aggression=1.0
            grouping=no
            {NO_SCOUTS}
        [/ai]
        team_name=undead
        user_team_name=_"Undead"
        {GOLD 100 150 200}
        {FLAG_VARIANT undead}
    [/side]

    {LIMIT_CONTEMPORANEOUS_RECRUITS 2 "Vampire Bat" 3}

    [side]
        type=Orcish Ruler
        id=Draka-Kura
        name= _ "Draka-Kura"
        side=3
        canrecruit=yes
        controller=ai
        recruit=Wolf Rider,Orcish Grunt,Orcish Archer,Orcish Crossbowman,Goblin Pillager
        team_name=evil
        user_team_name=_"Evil"
        {GOLD 150 200 250}
        {FLAG_VARIANT6 ragged}

        {LOYAL_UNIT 3 (Orcish Grunt) 19 9} {GUARDIAN}
        {LOYAL_UNIT 3 (Orcish Archer) 25 8} {GUARDIAN}
        {LOYAL_UNIT 3 (Orcish Grunt) 32 8} {GUARDIAN}
    [/side]

    {LIMIT_RECRUITS 3 "Orcish Crossbowman" 1}
    {LIMIT_CONTEMPORANEOUS_RECRUITS 3 "Goblin Pillager" 1}

    [side]
        type=Ogre
        id=Grug
        name= _ "Grug"
        unrenamable=yes
        side=4
        canrecruit=yes
        facing=sw
        controller=ai
        recruit=Young Ogre
        team_name=monster
        user_team_name=_"Monsters"
        {GOLD 150 130 100}
        [ai]
            [goal]
                name=target
                [criteria]
                    side=3
                [/criteria]
                value=100
            [/goal]
            recruitment_pattern=fighter
            {NO_SCOUTS}
        [/ai]
    [/side]

    [event]
        name=prestart

        [objectives]
            side=1
            [objective]
                description= _ "Move Gweddry, Owaec, and Dacyn across the river"
                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]

        [hide_unit]
            id=Garnad
        [/hide_unit]

        [message]
            speaker=Gweddry
            message= _ "We have come to the Great River. Should we cross here, or try to find a ford?"
        [/message]
        [message]
            speaker=Dacyn
            message= _ "We must cross here. The undead are chasing us, and their hordes are much too great for us to defeat. We've haven't faced even a small part of their force yet. We need to cross the river before the bulk of their army arrives!"
        [/message]
        [message]
            speaker=Owaec
            message= _ "Across this river lie the Northlands. If we can get there, we may be able to get some ogres to help us — but the orcs will definitely attack us before that happens."
        [/message]
        [message]
            speaker=Grug
            message= _ "Grug say we no help you! We finish must battle orc with!"
        [/message]
        [message]
            speaker=Draka-Kura
            message= _ "Was that comprehensible to anyone? Silence, foolish ogre. I will deal with you later. Right now there are men trying to cross this river."
        [/message]
        [message]
            speaker=Grug
            message= _ "Orc foolish! Die you now!"
        [/message]
        [message]
            speaker=Dacyn
            message= _ "If we show ourselves as enemies of the orcs, they may aid us. But first we need to cross the river."
        [/message]
    [/event]

    [event]
        name=side 2 turn 1

        [move_unit_fake]
            x=37,37,36
            y=31,30,29
            side=2
            type=Bone Knight
        [/move_unit_fake]

        [unhide_unit]
            id=Garnad
        [/unhide_unit]

        [terrain]
            x,y=36,29
            terrain=Ke
        [/terrain]

        [terrain]
            x=35,35,36,36,37
            y=29,30,28,30,30
            terrain=Ce
        [/terrain]

        {REPLACE_SCENARIO_MUSIC "legends_of_the_north.ogg"}
        {APPEND_MUSIC "casualties_of_war.ogg"}
        {APPEND_MUSIC "siege_of_laurelmor.ogg"}

        [message]
            speaker=Garnad
            message= _ "We have you now, mortals!"
        [/message]
        [message]
            speaker=Dacyn
            message= _ "They're closing in on us! We must get moving quickly."
        [/message]
    [/event]

    [event]
        name=side 2 turn 7
        {GENERIC_UNIT 2 (Revenant) 32 30}
        {GENERIC_UNIT 2 (Revenant) 34 30}
        {GENERIC_UNIT 2 (Bone Shooter) 32 31}
#ifdef HARD
        {GENERIC_UNIT 2 (Bone Shooter) 34 31}
#endif
        [unit]
            type=Lich
            id=Mal-Hakralan
            name= _ "Mal-Hakralan"
            side=2
            canrecruit=yes
            x=33
            y=31
        [/unit]

        [modify_unit]
            [filter]
                id=Garnad
            [/filter]

            canrecruit=no
            {IS_EXPENDABLE_LEADER}
        [/modify_unit]

        [message]
            speaker=Mal-Hakralan
            message= _ "I see, this is where the scared dogs ran to. Don't think you can get away <b>this</b> easily."
        [/message]
        [message]
            speaker=Dacyn
            message= _ "The undead reinforcements have arrived! We must cross the river immediately!"
        [/message]

#ifdef EASY
        [gold]
            side=2
            amount=500
        [/gold]
#else
#ifdef NORMAL
        [gold]
            side=2
            amount=600
        [/gold]

#else
        [gold]
            side=2
            amount=750
        [/gold]

#endif
#endif
        [allow_recruit]
            side=2
            type=Deathblade,Revenant,Bone Shooter,Blood Bat
        [/allow_recruit]
    [/event]

    [event]
        name=moveto

        [filter]
            y=1-12
            [not]
                [filter_location]
                    terrain=W*
                [/filter_location]
            [/not]
            [and]
                id=Gweddry
                [or]
                    id=Owaec
                [/or]
                [or]
                    id=Dacyn
                [/or]
            [/and]
        [/filter]

        [message]
            speaker=unit
            message= _ "Hurry up. We must get across before these undead slaughter us!"
        [/message]

        [allow_undo]
        [/allow_undo]
    [/event]

    #event where you win if you get to the other side
    [event]
        name=moveto
        first_time_only=no
        [filter]
            [filter_location]
                y=1-12
                [not]
                    terrain=W*
                [/not]
            [/filter_location]
            [and]
                id=Gweddry
                [or]
                    id=Owaec
                [/or]
                [or]
                    id=Dacyn
                [/or]
            [/and]
        [/filter]
        [if]
            [have_unit]
                id=Gweddry
                [filter_location]
                    y=1-12
                    [not]
                        terrain=W*
                    [/not]
                [/filter_location]
            [/have_unit]
            [have_unit]
                id=Owaec
                [filter_location]
                    y=1-12
                    [not]
                        terrain=W*
                    [/not]
                [/filter_location]
            [/have_unit]
            [have_unit]
                id=Dacyn
                [filter_location]
                    y=1-12
                    [not]
                        terrain=W*
                    [/not]
                [/filter_location]
            [/have_unit]
            [then]
                [message]
                    speaker=Dacyn
                    message= _ "Good! We have crossed. Now let’s see if we can get the ogres to join us. They have been convinced to work for the Crown in the past; maybe it can be done again."
                [/message]
                [if]
                    [have_unit]
                        id=Grug
                    [/have_unit]
                    [then]
                        [message]
                            speaker=Grug
                            message= _ "Grug say join you will he."
                        [/message]

                        [modify_unit]
                            [filter]
                                id=Grug
                            [/filter]

                            side=1
                            canrecruit=no
                            {IS_LOYAL}

                            [modifications]
                                {TRAIT_LOYAL}
                                {TEAM_COLOR_OVERRIDE () purple}
                            [/modifications]
                        [/modify_unit]

                        [unit]
                            name= _ "Gork"
                            side=1
                            type=Ogre
                            x,y=recall,recall
                            random_traits=yes
                        [/unit]
                        [unit]
                            name= _ "Drog"
                            side=1
                            type=Ogre
                            x,y=recall,recall
                            random_traits=yes
                        [/unit]

                        [endlevel]
                            result=victory
                            next_scenario=09_Xenophobia
                            bonus=no
                            {NEW_GOLD_CARRYOVER 70}
                        [/endlevel]
                    [/then]

                    [else]
                        [endlevel]
                            result=victory
                            bonus=no
                            {NEW_GOLD_CARRYOVER 70}
                        [/endlevel]
                    [/else]
                [/if]
            [/then]
            [else]
                [allow_undo]
                [/allow_undo]
            [/else]
        [/if]
    [/event]

    {WESNOTH_DEFEAT}

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