#textdomain wesnoth-low
#ifdef MULTIPLAYER
[multiplayer]
    random_start_time=no
#ifndef DEBUG_MODE
    allow_new_game=no
#endif
#else
[scenario]
#endif

    id=04_Elvish_Treasury
    name= _ "The Elvish Treasury"
    {LOW_MAP 04_Elvish_Treasury.map}
    {TURNS 35 30 25}

    {DEFAULT_SCHEDULE}

    {STARTING_VILLAGES_ALL 2}
    {STARTING_VILLAGES 3 14}

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

    {LOW_PRESTART}

    next_scenario=05_Saurian_Treasury
    [story]
        [part]
            story= _ "Kalenz and his forces raced to relieve the siege of the Elvish Treasury..."
            delay=4000
            {TO_ELVISH_TREASURY}
        [/part]
        [part]
            {TO_ELVISH_TREASURY_BATTLE}
            show_title=yes
        [/part]
    [/story]

#define PLAYER_GOLD
    {GOLD 280 250 220}
#enddef

    #wmllint: validate-off
    [side]
        {KALENZ}
        {PLAYER_GOLD}
        fog=no
        # wmllint: recognize Kalenz
        recruit={ELVES}
#ifndef MULTIPLAYER
        [unit]
            {LANDAR}
            placement=leader
            # wmllint: recognize Landar
        [/unit]
#endif
    [/side]
    #wmllint: validate-on

    [side]
        side=2
        allow_player=no
        controller=ai
        type=Saurian Ambusher
        {FLAG_VARIANT undead}
        id=Shurm
        name= _ "Shurm"
        canrecruit=yes
        {GOLD 190 280 340}
        {INCOME 4 8 12}
        team_name=Liz
        user_team_name= _ "Enemies"
#ifdef EASY
        recruit=Saurian Skirmisher, Saurian Augur
#else
        recruit=Saurian Skirmisher, Saurian Augur,  Saurian Ambusher
#endif
        {ai/aliases/stable_singleplayer.cfg}
        [ai]
            {AI_SIMPLE_ALWAYS_ASPECT recruitment_ignore_bad_movement yes}
            {AI_SIMPLE_ALWAYS_ASPECT recruitment_pattern "scout, scout, healer"}
            {AI_SIMPLE_ALWAYS_ASPECT aggression 0.75}
        [/ai]
    [/side]

    [side]
        side=3
        allow_player=no
        controller=ai
        type=Saurian Ambusher
        {FLAG_VARIANT undead}
        id=Trigr
        name= _ "Trigr"
        canrecruit=yes
        {GOLD 190 280 350}
        {INCOME 4 8 12}
        team_name=Liz
        user_team_name= _ "Enemies"
#ifdef EASY
        recruit=Saurian Skirmisher, Saurian Augur
#else
        recruit=Saurian Skirmisher, Saurian Augur, Saurian Ambusher
#endif
        {ai/aliases/stable_singleplayer.cfg}
        [ai]
            {AI_SIMPLE_ALWAYS_ASPECT recruitment_ignore_bad_movement yes}
            {AI_SIMPLE_ALWAYS_ASPECT recruitment_pattern "scout, scout, healer"}
        [/ai]
    [/side]

#ifdef MULTIPLAYER
    #wmllint: validate-off
    [side]
        side=4
        fog=no
        {LANDAR}
        {PLAYER_GOLD}
        # wmllint: recognize Landar
        recruit={ELVES}
    [/side]
    #wmllint: validate-on
#endif

    [item]
        x=13
        y=11
        image=scenery/temple1.png
    [/item]
    [item]
        x=11
        y=11
        image=units/elves-wood/shyde.png~RC(magenta>red)
    [/item]
    [item]
        x=11
        y=11
        image=items/cage.png
    [/item]

#define OBJECTIVES
    side=0
    [objective]
        description= _ "Defeat all enemy leaders"
        condition=win
    [/objective]
    [objective]
        description= _ "Death of Kalenz"
        condition=lose
    [/objective]
    [objective]
        description= _ "Death of Landar"
        condition=lose
    [/objective]
    [objective]
        description= _ "Turns run out"
        condition=lose
    [/objective]
    note={EARLY_FINISH_BONUS_NOTE}
#enddef

    [event]
        name=prestart
        [objectives]
            {OBJECTIVES}
        [/objectives]

        {RECALL_LOYALS}

        # wmllint: recognize Huraldur
        #{CHECK_LANDAR}
    [/event]

    # wmllint: directory spelling dastone
    [event]
        name=start

        [message]
            id=Kalenz
            message= _ "It seems that we are too late. The Treasury has fallen to the Saurians...."
        [/message]
        [message]
            id=Huraldur
            message= _ "And I see the remains of the garrison has been taken prisoner."
        [/message]

        {HIGHLIGHT_IMAGE 11 11 items/cage.png ("units/elves-wood/shyde.png~RC(magenta>red)")}
        [scroll_to_unit]
            id=Kalenz
        [/scroll_to_unit]

        [message]
            id=Kalenz
            message= _ "We must free them and make these saurians pay. Attack and leave no one alive!"
        [/message]
        [message]
            id=Shurm
            message= _ "More elves are coming! Too late, we've taken all your gold and we'll get more gold from the orcs for helping them out! "
        [/message]
        [message]
            id=Kalenz
            message= _ "You will not live to enjoy it!"
        [/message]
    [/event]

    [event]
        name=free cleodil

        {INCIDENTAL_MUSIC elvish-theme.ogg}

        [unit]
            {CLEODIL}
            # wmllint: recognize Cleodil
            x,y=11,11
        [/unit]


        [unit]
            id=Arkildur
            name= _ "Arkildur"
#ifdef MULTIPLAYER
            side=4
#else
            side=1
#endif
            type=Elvish Fighter
            x,y=11,11
            [modifications]
                {TRAIT_STRONG}
                {TRAIT_INTELLIGENT}
                {TRAIT_LOYAL}
            [/modifications]
            {IS_LOYAL}
        [/unit]
        [unit]
            id=Tameril-Isimeril
            name= _ "Tameril-Isimeril"
            side=1
            type=Elvish Archer
            x,y=11,11
            random_gender=yes
            [modifications]
                {TRAIT_DEXTROUS}
                {TRAIT_RESILIENT}
                {TRAIT_LOYAL}
            [/modifications]
            {IS_LOYAL}
        [/unit]
#ifdef EASY
        [unit]
            id=Laril
            name= _ "Laril"
            side=1
            type=Elvish Archer
            x,y=11,11
            [modifications]
                {TRAIT_DEXTROUS}
                {TRAIT_QUICK}
                {TRAIT_LOYAL}
            [/modifications]
            {IS_LOYAL}
        [/unit]
#endif
        [message]
            id=Cleodil
            message= _ "We are free! My lord Kalenz, from this day forward I and my men are your sworn followers. And there is that which you should know about the treasure the orcs seek..."
        [/message]
        [message]
            id=Kalenz
            message= _ "I accept your service gratefully, for I will need every sword and bow and spell with which to defeat these invaders. There will be time for talk later; now, we must fight."
        [/message]
    [/event]

    [event]
        name=moveto
        [filter]
            side=1,4
            x=11
            y=11
        [/filter]

        [removeitem]
        [/removeitem]

        [fire_event]
            name=free cleodil
        [/fire_event]

        [objectives]
            {OBJECTIVES}
            [objective]
                description= _ "Death of Cleodil"
                condition=lose
            [/objective]
        [/objectives]
    [/event]
#undef OBJECTIVES
    [event]
        name=victory

        [if]
            [not]
                [have_unit]
                    id=Cleodil
                [/have_unit]
            [/not]

            [then]
                [message]
                    id=Kalenz
                    message= _ "Without their leaders, the saurians flee in panic. Let us free the treasury's garrison before they can find it in them to rally and return."
                [/message]

                [fire_event]
                    name=free cleodil
                [/fire_event]
            [/then]
        [/if]

        [message]
            id=Kalenz
            message= _ "We have defeated the saurians and freed the garrison, and that is no small thing...but our gold is gone. "
        [/message]
        [message]
            id=Cleodil
            message= _ "The saurians happily carried away the Treasury gold, but they had come here looking for something more specific...some individual object they called 'dastone'. I am sorry, my lord Kalenz, I could not understand their distorted speech very well."
        [/message]
        [message]
            race=elf
            message= _ "The war with the Orcs goes poorly. The Ka'lian will need that gold back to buy arms and food, to hire artisans, to support its armies."
        [/message]
        [message]
            id=Kalenz
            message= _ "We will hunt down those saurians and retrieve our gold. More, we must teach them that it is lethal folly to raid us, else they will plague us like rats."
        [/message]
    [/event]

    [event]
        name=last breath
        [filter]
            id=Shurm
        [/filter]
        [message]
            speaker=unit
            message= _ "I am ashamed to die at the hands of tree-shaggers!"
        [/message]
        [message]
            speaker=second_unit
            message= _ "When you meet your kin in the dry hells, tell them you perished at the hands of the Kalenz's elves!"
        [/message]
    [/event]

    {campaigns/Legend_of_Wesmere/utils/deaths.cfg}
#ifndef MULTIPLAYER
[/scenario] 
#else
[/multiplayer]
#endif

#undef PLAYER_GOLD
