#textdomain wesnoth-did
[scenario]
    id=Beginning_of_the_Revenge
    next_scenario=Orc_war

    name=_ "Beginning of the Revenge"
    map_data="{campaigns/Descent_Into_Darkness/maps/Revenge.map}"
    turns=36

    victory_when_enemies_defeated=yes

    {STORY_BEGINNING_OF_THE_REVENGE}

    {DUSK}
    {FIRST_WATCH}
    {SECOND_WATCH}
    {DAWN}
    {MORNING}
    {AFTERNOON}

    [side]
        side=1
        controller=human
        type=Apprentice Mage
        description=Malin Keshar
        user_description=_ "Malin Keshar"
        unrenamable=yes
        canrecruit=yes
        recruit=Walking Corpse,Vampire Bat,Ghost,Ghoul,Skeleton Archer,Skeleton
        fog=no
        shroud=no
        gold=140
    [/side]

    [side]
        side=2
        controller=ai
        team_name=orcs
        type=Orcish Warlord
        description="Gron'r Hronk"
        user_description=_ "Gron'r Hronk"
        canrecruit=yes
        recruit=Orcish Archer,Orcish Crossbowman,Wolf Rider,Orcish Grunt
        {GOLD 120 150 180}
        fog=no
        shroud=no
        [ai]
            agression=0.5
            caution=0.1
            villages_per_scout=8
            village_value=0.5
            recruitment_pattern=scout,archer,archer,fighter
        [/ai]
    [/side]

    {STARTING_VILLAGES 2 8}

    [side]
        side=3
        controller=ai
        team_name=orcs
        type=Orcish Warlord
        description="K'rrlar Oban"
        user_description=_ "K'rrlar Oban"
        canrecruit=yes
        recruit=Orcish Crossbowman,Wolf Rider,Goblin Pillager,Orcish Grunt
        {GOLD 130 170 210}
        fog=no
        shroud=no
        [ai]
            aggression=0.5
            caution=0.2
            villages_per_scout=6
            recruitment_pattern=archer,scout,fighter
        [/ai]
    [/side]

    {STARTING_VILLAGES 3 8}

    [event]
        name=prestart
        [music]
            name=wanderer.ogg
        [/music]

        [objectives]
            side=1
            [objective]
                condition=win
                description=_ "Move Malin to the end of the mountain pass"
            [/objective]
            [objective]
                condition=win
                description=_ "Kill the orc leaders"
            [/objective]
            [objective]
                condition=lose
                description=_ "Death of Malin Keshar"
            [/objective]
            [objective]
                condition=lose
                description=_ "Death of Darken Volk"
            [/objective]
        [/objectives]

        # Signpost at the end of the pass
        {PLACE_IMAGE scenery/signpost.png 18 1}

        # {SCATTER_IMAGE (terrain=Gg) 2 scenery/oak-leaning.png}
        # {SCATTER_IMAGE (terrain=Gg) 3 scenery/snowbits.png}

        [recall]
            description=Darken Volk
        [/recall]

        {MODIFY_UNIT (description=Malin Keshar) profile (portraits/malold.png)}
    [/event]

    [event]
        name=start
        {DIALOGUE_BOTR_START}
    [/event]

    # In-scenario events
    [event]
        name=die
        first_time_only=yes
        [filter]
            race=orc
        [/filter]
        {DIALOGUE_BOTR_ORCDIE}
    [/event]

    [event]
        name=moveto
        first_time_only=yes
        [filter]
            x=7,8,9-10,11,11,12,12,13,14,15,18,19,20,22
            y=21-22,18-22,18-23,19,21-24,18-19,21-23,18-24,18-23,20-23,24,25,26,27
            [filter_location]
                terrain=Ai
            [/filter_location]
            [not]
                type=Ghost,Wraith,Spectre,Shadow,Nightgaunt,Vampire Bat,Blood Bat
            [/not]
        [/filter]
        # Warn the player
        {DIALOGUE_BOTR_ICE_WARNING}
        # Separate falling-through the ice events for undead and living creatures
        [event]
            # THIS MACRO NEEDS WORK -- UNDEAD UNIT CAN STILL DIE IN ALREADY-BROKEN ICE
            name=moveto
            first_time_only=no
            [filter]
                x=7,8,9-10,11,11,12,12,13,14,15,18,19,20,22
                y=21-22,18-22,18-23,19,21-24,18-19,21-23,18-24,18-23,20-23,24,25,26,27
                race=undead,bats
                [filter_location]
                    terrain=Ai
                [/filter_location]
                [not]
                    type=Ghost,Wraith,Spectre,Shadow,Nightgaunt,Vampire Bat,Blood Bat
                [/not]
            [/filter]
            {IF_ICE_BREAKS {DIALOGUE_BOTR_ICE_UNDEAD}}
        [/event]
        [event]
            name=moveto
            first_time_only=no
            [filter]
                x=7,8,9-10,11,11,12,12,13,14,15,18,19,20,22
                y=21-22,18-22,18-23,19,21-24,18-19,21-23,18-24,18-23,20-23,24,25,26,27
                [filter_location]
                    terrain=Ai
                [/filter_location]
                [not]
                    race=undead
                [/not]
            [/filter]
            {IF_ICE_BREAKS {DIALOGUE_BOTR_ICE_LIVING}}
        [/event]
    [/event]

    # Defeat Conditions
    {MALIN_DEATH}
    {VOLK_DEATH}
    {TIME_OUT_LOSE}

    # Victory Condition
    [event]
        name=moveto
        [filter]
            description=Malin Keshar
            x,y=18,1
        [/filter]
        [endlevel]
            bonus=yes
            result=victory
        [/endlevel]
    [/event]

    {@campaigns/Descent_Into_Darkness/utils/global-events.cfg}
[/scenario]
