#textdomain wesnoth-thot

[scenario]
    id=07_Mages_and_Drakes
    name= _ "Mages and Drakes"
    map_data="{campaigns/The_Hammer_of_Thursagan/maps/07_Mages_and_Drakes.map}"
    {TURNS 30 25 20}
    next_scenario=08_Fear
    victory_when_enemies_defeated=yes

    {DEFAULT_SCHEDULE}

    {SCENARIO_MUSIC       revelation.ogg}
    {EXTRA_SCENARIO_MUSIC traveling_minstrels.ogg}
    {EXTRA_SCENARIO_MUSIC nunc_dimittis.ogg}

    {THOT_TRACK {JOURNEY_STAGE7}}

    # wmllint: validate-off
    [side]
        side=1
        controller=human
        recruit="Dwarvish Fighter,Dwarvish Thunderer,Dwarvish Guardsman, Dwarvish Scout"
        {GOLD 175 150 125}
        team_name=northern_alliance
        user_team_name= _ "Alliance"
        {FLAG_VARIANT knalgan}

        # wmllint: recognize Aiglondur
        {CHARACTER_STATS_AIGLONDUR}

        facing=se
    [/side]
    # wmllint: validate-on

    [side]
        side=2
        controller=ai
        recruit=Mage
        {GOLD 140 120 100}
        team_name=northern_alliance
        user_team_name=_"Alliance"

        type=Great Mage
        id=Master Perrin
        name= _ "Master Perrin"
        profile=portraits/perrin.png
        canrecruit=yes
        gender=male

        facing=se

        [unit]
            type=White Mage
            id=Preceptor
            name= _ "Preceptor"
            x,y=12,14
            facing=se
            {IS_LOYAL}
            [modifications]
                {TRAIT_LOYAL}
                {TRAIT_INTELLIGENT}
            [/modifications]
        [/unit]

        [unit]
            type=Red Mage
            id=Warder
            name= _ "Warder"
            x,y=14,14
            facing=se
            {IS_LOYAL}
            [modifications]
                {TRAIT_LOYAL}
                {TRAIT_STRONG}
            [/modifications]
        [/unit]

        [ai]
            {ATTACK_DEPTH 1 3 5}
            passive_leader=yes
            recruitment_pattern=mixed fighter
        [/ai]
    [/side]

    [side]
        side=3
        controller=ai
        recruit=Drake Fighter,Drake Glider,Drake Burner,Drake Clasher
        {GOLD 120 140 160}
        {INCOME 0 5 10}
        team_name=drakes
        user_team_name= _ "Drakes"

        type=Drake Flameheart
        id=Glashal
        name= _ "Glashal"
        canrecruit=yes

        facing=nw

        [ai]
            {ATTACK_DEPTH 3 4 5}
            passive_leader=no
        [/ai]
    [/side]

    {STARTING_VILLAGES 2 7}

    [event]
        name=prestart

        [objectives]
            side=1
            [objective]
                description= _ "Defeat Glashal"
                condition=win
            [/objective]
            [objective]
                description= _ "Death of Aiglondur"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Angarthing"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Ratheln"
                condition=lose
            [/objective]

            {TURNS_RUN_OUT}

            [gold_carryover]
                bonus=yes
                carryover_percentage=40
            [/gold_carryover]
        [/objectives]

        [recall]
            id=Angarthing
            x,y=8,17
        [/recall]

        [recall]
            id=Ratheln
        [/recall]

        {MODIFY_UNIT (side=1) facing se}
    [/event]

    [event]
        name=start

        [message]
            speaker=Preceptor
            message= _ "Master Perrin! A mage comes down from the High Pass, with a company of dwarves. They are well-armed, but not in battle array."
        [/message]

        [message]
            speaker=Master Perrin
            message= _ "That will be Ratheln, I expect. Hail! You on the road! Who comes bearing arms into our valley?"
        [/message]

        [message]
            speaker=Glashal
            message= _ "‘Our’ valley, says Master Perrin. The arrogance of these mages is intolerable!"
        [/message]

        [message]
            speaker=Aiglondur
            message= _ "A delegation of the Northern Alliance, traveling east. I believe we’ve found a friend of yours in the High Pass."
        [/message]

        [message]
            speaker=Master Perrin
            message= _ "Well met, then. But if you intend to travel east of here, beware of the nest of drakes in the cliffs near the valley’s end. They were here before us, and have become more hostile to travelers of late."
        [/message]

        [message]
            speaker=Glashal
            message= _ "The axe-bearers must not be let near our nestlings. Attack!"
        [/message]
    [/event]

    [event]
        name=enemies defeated

        [if]
            [have_unit]
                id=Master Perrin
            [/have_unit]

            [then]
#ifdef EASY
                [message]
                    speaker=Master Perrin
                    message= _ "We’re grateful for your assistance. Moreover, I’d like to send a couple of our senior apprentices with you to the east. It has come time for them to be journeymen... and I sense something being born to the east that I do not like the feel of."
                [/message]
#else
                [message]
                    speaker=Master Perrin
                    message= _ "We’re grateful for your assistance. Moreover, I’d like to send one of our senior apprentices with you to the east. It has come time for him to be a journeyman... and I sense something being born to the east that I do not like the feel of."
                [/message]
#endif

#ifdef EASY
                [unit]
                    type=Mage
                    gender=female
                    id=Lorinne
                    name= _ "Lorinne"
                    experience=40
                    side=1
                    placement=leader
                    {IS_LOYAL}
                    [modifications]
                        {TRAIT_LOYAL}
                    [/modifications]
                [/unit]
#endif
                [unit]
                    type=Mage
                    id=Darchas
                    name= _ "Darchas"
                    experience=40
                    side=1
                    placement=leader
                    {IS_LOYAL}
                    [modifications]
                        {TRAIT_LOYAL}
                    [/modifications]
                [/unit]

                [allow_recruit]
                    side=1
                    type=Mage
                [/allow_recruit]

                [select_unit]
                    id=Darchas
                [/select_unit]

#ifdef EASY
                [message]
                    speaker=narrator
                    message= _ "The presence of Lorinne and Darchas gives you the ability to recruit mages."
                    image=wesnoth-icon.png
                [/message]
#else
                [message]
                    speaker=narrator
                    message= _ "The presence of Darchas gives you the ability to recruit mages."
                    image=wesnoth-icon.png
                [/message]
#endif

                [message]
                    speaker=Aiglondur
                    message= _ "What sort of thing?"
                [/message]

                [message]
                    speaker=Master Perrin
                    message= _ "There is some great magic brewing. Something... evil. I feel its traces in the currents of the earth and air."
                [/message]

#ifdef HARD
                [message]
                    speaker=Ratheln
                    message= _ "I would travel east with you if I could, but I have duties I must take up here."
                [/message]

                [message]
                    speaker=Aiglondur
                    message= _ "You have your duty, as we have ours. Fare well."
                [/message]

                [kill]
                    id=Ratheln
                [/kill]
#else
                {UNMAKE_HERO Ratheln}

                [unit_overlay]
                    id=Ratheln
                    image=misc/loyal-icon.png
                [/unit_overlay]

                [message]
                    speaker=Ratheln
                    message= _ "Perrin, I owe these dwarves a debt; I think it is my duty to aid them in their journey. I’ll return with your apprentices as soon as I may."
                [/message]

                [message]
                    speaker=Master Perrin
                    message= _ "As you will. Go safely and return swiftly."
                [/message]
#endif
            [/then]
            [else]
                [message]
                    speaker=Ratheln
                    message= _ "I would travel east with you if I could, but the school will need me all the more with Master Perrin gone."
                [/message]

                [message]
                    speaker=Aiglondur
                    message= _ "You have your duty, as we have ours. Fare well."
                [/message]

                [kill]
                    id=Ratheln
                [/kill]

                [message]
                    speaker=Angarthing
                    message= _ "I think we will regret Perrin’s passing. There is much he might have told us."
                [/message]
            [/else]
        [/if]

        [endlevel]
            result=victory
            bonus=yes
            {NEW_GOLD_CARRYOVER 40}
        [/endlevel]
    [/event]

    {HERODEATH_AIGLONDUR}
    {HERODEATH_ANGARTHING}
    {HERODEATH_RATHELN}

    # In this scenario only, losing Ratheln is fatal.
    # This avoids continuity problems in this scenario.
    # His death comment comes from the macro, above.
    [event]
        name=die
        [filter]
            id=Ratheln
        [/filter]

        [endlevel]
            result=defeat
        [/endlevel]
    [/event]
[/scenario]
