#textdomain wesnoth-low
[scenario]
    id=11_Battle_of_the_Book
    next_scenario=12_Revelations

    random_start_time=no
    allow_new_game=no
    force_lock_settings=yes

    experience_modifier=100
    name= _ "Battle of the Book"
    {LOW_MAP 11_Battle_of_the_Book.map}
    {TURNS 34 38 42}
    {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}
    {EXTRA_SCENARIO_MUSIC into_the_shadows.ogg}

    [story]
        [part]
            story= _ "Quickening their pace, the elves and dwarves raced towards the smoke..."
            {LOW_BIGMAP}
            {FLIGHT_COMPLETE}
            {TREASURY_COMPLETE}
            {BOOK_STAGE4}
        [/part]
    [/story]

#define PLAYER_GOLD
    {GOLD 310 290 260}
#enddef
#define MULTIPLAYER_GOLD
    {GOLD 100 95 90}
#enddef

    [side]
        side=1
        fog=yes
        {PLAYABLE}
        save_id=Kalenz
        disallow_shuffle=yes

        {KALENZ}
        x=20
        y=27

#ifndef MULTIPLAYER
        {PLAYER_GOLD}
        [unit]
            {LANDAR}
            x=25
            y=27
        [/unit]
        [unit]
            {OLURF}
            x=29
            y=28
        [/unit]
        [unit]
            {CLEODIL}
            x=15
            y=27
        [/unit]
#else
        {MULTIPLAYER_GOLD}
#endif
    [/side]

    # wmllint: skip-side
    {MP_SIDE 2 (
        {PLAYABLE}
        save_id=Landar
        disallow_shuffle=yes
        fog=yes
        no_leader=yes
        [unit]
            {LANDAR}
        [/unit]
    )}

    # wmllint: skip-side
    {MP_SIDE 3 (
        {PLAYABLE}
        save_id=Olurf
        disallow_shuffle=yes
        fog=yes
        no_leader=yes
        [unit]
            {OLURF}
        [/unit]
    )}

    # wmllint: skip-side
    {MP_SIDE 4 (
        {PLAYABLE}
        save_id=Cleodil
        disallow_shuffle=yes
        fog=yes
        no_leader=yes
        [unit]
            {CLEODIL}
        [/unit]
    )}

    [side]
        side=5
        allow_player=no
        type=Arch Mage
        id=Aquagar
        name= _ "Aquagar"
        canrecruit=yes
        controller=ai
        {GOLD 260 320 380}
        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=6
        allow_player=no
        type=Elder Mage
        id=Crelanu
        name= _ "Crelanu"
        profile="portraits/crelanu.webp"
        canrecruit=yes
        controller=ai
        {GOLD 100 90 80}
        [ai]
            passive_leader=yes
        [/ai]
        recruit=Mage, Gryphon
        {PLAYER_TEAM}
        fog=yes
        share_vision=none
    [/side]
    {STARTING_VILLAGES_ALL 3}

    [side]
        side=7
        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 200 260 300}
        team_name=drakes
        user_team_name= _ "Enemies"
    [/side]

    [event]
        name=prestart
        {RECALL_LOYALS}
    [/event]
    #TODO what if Crelanu moves into sight?
    [event]
        name=sighted
        [filter]
            id=Crelanu
        [/filter]
        [filter_second]
            side=1,2,3,4
        [/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=6
            share_vision=all
        [/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]

            {TURNS_RUN_OUT}

            [gold_carryover]
                bonus=yes
                carryover_percentage=40
            [/gold_carryover]
        [/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
#ifdef MULTIPLAYER
            bonus=0.3
#else
            bonus=yes
#endif
            {NEW_GOLD_CARRYOVER 40}
        [/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]

    {DEFAULT_VICTORY 0.3}
    {campaigns/Legend_of_Wesmere/utils/deaths.cfg}
[/scenario]

#undef PLAYER_GOLD
#undef MULTIPLAYER_GOLD
