#textdomain wesnoth-low
#ifdef MULTIPLAYER
[multiplayer]
    random_start_time=no
#ifndef DEBUG_MODE
    allow_new_game=no
#endif
#else
[scenario]    
#endif
    id=11_Battle_of_the_book
    name= _ "Battle of the book"
    next_scenario=12_Revelations
    {LOW_MAP 11_Battle_of_the_book.map}
    {TURNS 30 34 38}
    {DEFAULT_SCHEDULE}

    {INTRO_AND_SCENARIO_MUSIC frantic.ogg the_dangerous_symphony.ogg}
    {EXTRA_SCENARIO_MUSIC battle.ogg}
    {EXTRA_SCENARIO_MUSIC nunc_dimittis.ogg}
    {EXTRA_SCENARIO_MUSIC suspense.ogg}

    {LOW_PRESTART}

    [story]
        [part]
            show_title=yes
            delay=4000
            {TO_BATTLE_OF_THE_BOOK}
        [/part]
        [part]
            story= _ "Quickening their pace, Elves and Dwarves raced towards the smoke...."
            {TO_BATTLE_OF_THE_BOOK_BATTLE}
        [/part]
    [/story]

    #wmllint: validate-off
    [side]
        {KALENZ}
        # wmllint: recognize Kalenz
        recruit={ELVES},{DWARVES}
        fog=yes
        [unit]
            {LANDAR}
            # wmllint: recognize Landar
            placement=leader
        [/unit]
        [unit]
            {CLEODIL}
            # wmllint: recognize Cleodil
            placement=leader
        [/unit]
        [unit]
            {OLURF}
            # wmllint: recognize Olurf
            placement=leader
        [/unit]
    [/side]
    #wmllint: validate-on
    [event]
        name=prestart
        {RECALL_LOYALS}
    [/event]

    [side]
        side=2
        allow_player=no
        type=Arch Mage
        id=Aquagar
        name= _ "Aquagar"
        canrecruit=yes
        controller=ai
        {GOLD 230 290 320}
        recruit=Drake Warrior, Drake Burner, Drake Clasher, Drake Fighter, Drake Blademaster, Drake Enforcer, Fire Drake, Drake Flameheart, Drake Flare, Drake Thrasher, Sky Drake, Drake Arbiter, Drake Warden, Drake Glider, Hurricane Drake, Inferno Drake
        team_name=drakes
        user_team_name= _ "Enemies"
    [/side]

    [side]
        side=3
        allow_player=no
        type=Elder Mage
        id=Crelanu
        name= _ "Crelanu"
        profile="portraits/crelanu.png"
        canrecruit=yes
        controller=ai
        {GOLD 100 90 80}
        [ai]
            passive_leader=yes
        [/ai]
        recruit=Mage, Gryphon
        team_name=player
        user_team_name= _ "Player"
        fog=yes
        share_view=no
    [/side]
    {STARTING_VILLAGES_ALL 3}

    [side]
        side=4
        allow_player=no
        type=Troll Warrior
        id=Trigrul
        name=_ "Trigrul"
        canrecruit=yes
        controller=ai
#ifdef EASY
        recruit=Troll Rocklobber, Troll Whelp
#else
        recruit=Troll, Troll Rocklobber, Troll Warrior
#endif
        {INCOME 5 10 20}
        {GOLD 140 160 210}
        team_name=drakes
        user_team_name= _ "Enemies"
    [/side]

#ifdef MULTIPLAYER
    [side]
        side=5
        {LANDAR}
        recruit={ELVES}
        fog=yes
        share_view=yes
    [/side]
    [side]
        side=6
        {OLURF}
        recruit={DWARVES}
        fog=yes
        share_view=yes
    [/side]
#endif

#TODO what if Crelanu moves into sight?
    [event]
        name=sighted
        [filter]
            id=Crelanu
        [/filter]
        [filter_second]
            side=1,5
        [/filter_second]
        [message]
            id=Crelanu
            message= _ "I sense a presence that is not one of Aquagar's creatures. Who are you, and what is your purpose here?"
        [/message]
        [message]
            id=Cleodil
            message= _ "That, I think, must be the mage of which Olurf spoke. But he is not the one I sensed as we approached this place..."
        [/message]
        [message]
            id=Landar
            message= _ "I feel the shadow of destiny on my soul. There is something I am fated to do here, but I know not what."
        [/message]
        [message]
            id=Kalenz
            message= _ "If you are the mage Crelanu, we have come to seek your help."
        [/message]
        [message]
            id=Crelanu
            message= _ "I am Crelanu...but if you want my help you must begin by helping me, for I am besieged here and in no state to aid anyone else."
        [/message]
        [message]
            id=Landar
            message= _ "Ahhh. A fight! Perhaps this is my fate. Come, Kalenz, let us make a rescue."
        [/message]
        [modify_side]
            side=3
            share_view=yes
        [/modify_side]
    [/event]

    [event]
        name=prestart
        [objectives]
            side=0
            [objective]
                description= _ "Defeat Aquagar"
                condition=win
            [/objective]
            [objective]
                description= _ "Death of Kalenz"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Landar"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Olurf"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Cleodil"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Crelanu"
                condition=lose
            [/objective]
            [objective]
                description= _ "Turns run out"
                condition=lose
            [/objective]
            note={EARLY_FINISH_BONUS_NOTE}
        [/objectives]
    [/event]

    [event]
        name=start

        [message]
            id=Landar
            message= _ "Looks like your mage friend is in trouble. There is a horde of drakes attacking him!"
        [/message]
        [message]
            id=Kalenz
            message= _ "Indeed. Before he can aid us, we will have to aid him."
        [/message]
        [message]
            id=Aquagar
            message= _ "Fools! The book will be mine!"
        [/message]
        [message]
            id=Cleodil
            message= _ "There...I sense magic emanating from that stone keep east of the lake. That is where we will find the mage."
        [/message]
    [/event]

    [event]
        name=last breath
        [filter]
            id=Aquagar
        [/filter]
        [message]
            speaker=unit
            # wmllint: local spelling Morogoth
            message= _ "I die, but I will not go unavenged! Cursed will you be Kalenz! You will never find lasting peace in all your years. You will lose your dearest. And you, Crelanu, your book will bring woe on you and haunt all its future owners to their graves! This will be the price for slaying me, Aquagar, great drake wizard of Morogoth."
        [/message]

        [message]
            id=Olurf
            message= _ "Some scary fellow this Aquagar thinks he is! Come now, I think Crelanu owes us some drinks."
        [/message]

        [endlevel]
            result=victory
            save=no
            bonus=yes
        [/endlevel]
    [/event]

    [event]
        name=last breath
        [filter]
            id=Crelanu
        [/filter]
        [message]
            id=Kalenz
            message= _ "There goes our last hope!"
        [/message]
        [endlevel]
            result=defeat
        [/endlevel]
    [/event]

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