#textdomain wesnoth-sof
[scenario]
    name= _ "The Dragon"
    id=8_The_Dragon
    turns=-1
    map_data="{campaigns/Sceptre_of_Fire/maps/8_The_Dragon.map}"
    next_scenario=9_Caverns_of_Flame

    victory_when_enemies_defeated=no

    {SCENARIO_MUSIC "knalgan_theme.ogg"}

    {UNDERGROUND}

    [time_area]
        x=1-4, 1-3,  1-2,1-4,1-3,  1-2
        y=1-5,6-10,11-14, 15, 16,17-24
        {DEFAULT_SCHEDULE}
    [/time_area]

    [side]
        type=Dwarvish Fighter
        id=Rugnur
        save_id=Rugnur
        side=1
        canrecruit=yes
        controller=human
        recruit=Dwarvish Fighter,Dwarvish Thunderer,Dwarvish Guardsman,Dwarvish Scout,Gryphon Rider
        gold=200
        shroud=yes
    [/side]

    [side]
        type=Elvish Marshal
        id=Landar
        name= _ "Landar"
        side=2
        canrecruit=yes
        controller=ai
        recruit=Elvish Avenger,Elvish Marshal,Elvish Champion,Elvish Outrider,Dwarvish Thunderguard,Dwarvish Berserker,Dwarvish Steelclad
        gold=1000
        income=50
        [ai]
            turns=1-12
            aggression=0.8
            caution=0.2
            leader_value=0
            village_value=0
            recruitment_pattern=scout,fighter,fighter,mixed fighter
            recruitment_ignore_bad_movement=yes
            recruitment_ignore_bad_combat=yes
            #grouping causes the dwarves to wait for the elves, who move slower
            grouping=none
            passive_leader=yes

            [target]
                side=1
                value=2.0
            [/target]
        [/ai]
        [ai]
            turns=12-FOREVER
            aggression=1.0
            caution=0.0
            leader_value=0
            village_value=0
            recruitment_pattern=scout,fighter,fighter,mixed fighter
            recruitment_ignore_bad_movement=yes
            recruitment_ignore_bad_combat=yes
            grouping=none
            passive_leader=yes

            [target]
                side=1
                value=20
            [/target]
        [/ai]
        team_name=elves
    [/side]

    [side]
        type=Fire Dragon
        id=Khrakrahs
        name= _ "Khrakrahs"
        profile=portraits/khrakrahs.png
        side=3
        canrecruit=yes
        controller=ai
        {RECRUIT (Vampire Bat) (Vampire Bat) (Vampire Bat,Blood Bat)}
        {GOLD 200 300 400}
        [ai]
            recruitment_pattern=scout
            aggression=0.9
            caution=0.1
            grouping=offensive
        [/ai]
        team_name=khrakrahs
    [/side]

    [story]
        [part]
            story= _ "Thus Alanin escaped from his elvish pursuers. But the dwarves were not so lucky. I would say that, perhaps, their betrayal of Durstorn was coming back to haunt them. For the section of the old eastern mines that they reached in their flight had long since become the lair of Khrakrahs... the dragon."
        [/part]
        [part]
            show_title=yes
            {TO_THE_DRAGON}
        [/part]
    [/story]

    {SOF_DEATHS}

    [event]
        name=prestart

        [objectives]
            side=1
            [objective]
                description= _ "Get all heroes to the end of the tunnel"
                condition=win
            [/objective]
            [objective]
                description= _ "Death of Rugnur"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Krawg"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Thursagan"
                condition=lose
            [/objective]

            note={NO_GOLD_CARRYOVER_NOTE}
        [/objectives]
    [/event]

#define RANDOM_MERCENARY TYPE
    {GENERIC_UNIT 2 {TYPE} 2 14}
#enddef
    [event]
        name=start

        {MOVE_UNIT id=Rugnur 12 7}

        [redraw]
            side=1
        [/redraw]

        [recall]
            id=Baglur
        [/recall]
        [recall]
            id=Krawg
        [/recall]
        [recall]
            id=Thursagan
        [/recall]

        #the enemy gets mercenaries
        {RANDOM_MERCENARY "Dwarvish Berserker"}
        {RANDOM_MERCENARY "Dwarvish Berserker"}
        {RANDOM_MERCENARY "Dwarvish Berserker"}
#ifdef EASY
#else
        {RANDOM_MERCENARY "Dwarvish Berserker"}
#endif
#ifdef HARD
        {RANDOM_MERCENARY "Dwarvish Berserker"}
        {RANDOM_MERCENARY "Dwarvish Berserker"}
#endif
        {RANDOM_MERCENARY "Dwarvish Lord"}
        {RANDOM_MERCENARY "Dwarvish Lord"}
        {RANDOM_MERCENARY "Dwarvish Lord"}
        {RANDOM_MERCENARY "Dwarvish Dragonguard"}
        {RANDOM_MERCENARY "Dwarvish Dragonguard"}

        [message]
            speaker=Rugnur
            message= _ "Well, Thursagan, we've reached the eastern mine, but the elves are hot on our trail. What do we do now?"
        [/message]
        [message]
            speaker=Thursagan
            message= _ "Well, we have two choices. We may either stand and fight, and assuredly die, or run as quickly as possible down this path into the depths of the cave, where we may find something that will help us. Also, remember, the elves can't run as fast in caves as we can, so we may be able to get ahead of them and perhaps lay a trap."
        [/message]
        [message]
            speaker=Krawg
            message= _ "Wyy yoo no urrendrr? Alddey woont iz za wagic doun!"	# wmllint: no spellcheck
            #po: "Why don't we just surrender? All they want is that magic stone!"
        [/message]
        [message]
            speaker=Rugnur
            message= _ "If we give them the ruby, then what? They'll probably kill us anyway. And, that ruby has the power to do great things, evil things. We can't let it fall into the wrong hands."
        [/message]
        [message]
            speaker=Thursagan
            message= _ "Then we shall run. I suggest calling to arms every last dwarf we possibly can here. This might be the last chance we'll get to do so."
        [/message]
        [if]
            [have_unit]
                id=Baglur
            [/have_unit]
            [then]
                [message]
                    speaker=Baglur
                    message= _ "So we're running away, eh? I dinna' like that, but it seems it's our only option."
                [/message]
                [message]
                    speaker=Rugnur
                    message= _ "If it makes you feel any better, we'll probably die this way, too."
                [/message]
            [/then]
        [/if]
    [/event]

    [event]
        name=sighted
        [filter]
            type=Fire Dragon
        [/filter]
        [redraw]
            side=1
        [/redraw]
        [scroll_to]
            x,y=$x1,$y1
        [/scroll_to]
        [message]
            speaker=Rugnur
            message= _ "Look, there's a dragon in these caves!"
        [/message]
        [message]
            speaker=Khrakrahs
            message= _ "Ah, fresh meat!"
        [/message]
        [message]
            speaker=Thursagan
            message= _ "And which of the great dragons are you?"
        [/message]
        [message]
            speaker=Khrakrahs
            # wmllint: local spelling Shek'kahan
            message= _ "I am Khrakrahs, greatest dragon of all time! Haldric killed Shek'kahan my brother, but he was weaker than me, and you will not find me so easy to defeat. Now get out of my volcano!"
        [/message]
        [message]
            speaker=Rugnur
            message= _ "I'd rather face one powerful dragon than hundreds of mighty elves. Continue!"
        [/message]
    [/event]

    [event]
        name=sighted
        [filter]
            race=dwarf
            side=2
        [/filter]
        [redraw]
            side=1
        [/redraw]
        [scroll_to]
            x,y=$x1,$y1
        [/scroll_to]
        [message]
            speaker=Thursagan
            message= _ "What's this? A dwarf fighting against us with the elves?!"
        [/message]
        [message]
            speaker=Baglur
            # wmllint: local spelling Surghan
            message= _ "It must be one of those Surghan mercenaries. I'll bet those elves have hired more of them. That's bad news for us, for they'll go as fast in caves as we do."
        [/message]
    [/event]

    [item]
        x,y=16,25
        image=items/altar.png
    [/item]

    [event]
        name=moveto
        [filter]
            x,y=16,25
            side=1
        [/filter]
        [if]
            [variable]
                name=unit.id
                value=Krawg
            [/variable]
            [then]
                [message]
                    speaker=Krawg
                    #po: "(excited bird cry) Look! Forge here!"
                    message= _ "Raaaawww! Loook! Forge heeeere!"	# wmllint: no spellcheck
                [/message]

                [message]
                    speaker=Thursagan
                    message= _ "It looks like a forge, heated by the lava. It looks magic, and it looks hot enough to make the Sceptre."
                [/message]
            [/then]
            [else]
                [message]
                    speaker=unit
                    message= _ "Look, I've found something here. It looks like a forge, heated by the lava. It looks magic, and it looks hot enough to make the Sceptre."
                [/message]
            [/else]
        [/if]
        [message]
            speaker=Khrakrahs
            message= _ "That pretty metal rock is mine! Get away from it!"
        [/message]
        [objectives]
            side=1
            [objective]
                description= _ "Move Thursagan to the forge"
                condition=win
            [/objective]
            [objective]
                description= _ "Defend Thursagan until the Sceptre of Fire is complete"
                condition=win
            [/objective]
            [objective]
                description= _ "Death of Rugnur"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Krawg"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Thursagan"
                condition=lose
            [/objective]

            note={NO_GOLD_CARRYOVER_NOTE}
        [/objectives]
    [/event]

    [event]
        name=moveto
        [filter]
            x,y=16,25
            id=Thursagan
        [/filter]
        [message]
            speaker=Thursagan
            message= _ "This forge will work perfectly. Give me a few days here, and I can reforge the Sceptre of Fire to fulfill its purpose."
        [/message]
        [set_variable]
            name=turnsleft
            value=10
        [/set_variable]
        [objectives]
            side=1
            [objective]
                description= _ "Survive for 9 turns"
                condition=win
            [/objective]
            [objective]
                description= _ "Death of Rugnur"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Krawg"
                condition=lose
            [/objective]
            [objective]
                description= _ "An enemy moves onto the forge"
                condition=lose
            [/objective]

            note={NO_GOLD_CARRYOVER_NOTE}
        [/objectives]
        [store_unit]
            [filter]
                id=Thursagan
            [/filter]
            variable=thur
            kill=yes
        [/store_unit]
        [event]
            name=moveto
            [filter]
                x,y=16,25
                side=2,3
            [/filter]
            [message]
                speaker=narrator
                caption= _ "Thursagan"
                image=portraits/thursagan.png
                message= _ "You fool, you let the enemy get at me as I was unarmed!"
            [/message]
            [message]
                speaker=narrator
                caption= _ "Thursagan"
                image=portraits/thursagan.png
                message= _ "Ayahahh..."	# wmllint: no spellcheck
                sound=dwarf-die-1.ogg
            [/message]
            [endlevel]
                result=defeat
            [/endlevel]
        [/event]
        [event]
            name=new turn
            first_time_only=no
            [set_variable]
                name=turnsleft
                add=-1
            [/set_variable]
            [if]
                [variable]
                    name=turnsleft
                    numerical_equals=0
                [/variable]
                [then]
                    [unstore_unit]
                        variable=thur
                        find_vacant=yes
                    [/unstore_unit]

                    [object]
                        id=sceptre of fire
                        silent=yes
                        duration=forever

                        [filter]
                            id=Thursagan
                        [/filter]

                        [effect]
                            apply_to=new_attack
                            name=sceptre of fire
                            description= _ "sceptre of fire"
                            icon=attacks/fireball.png
                            type=fire
                            range=ranged
                            [specials]
                                {WEAPON_SPECIAL_MAGICAL}
                            [/specials]
                            damage=14
                            number=4
                        [/effect]

                        [effect]
                            apply_to=new_animation

                            [attack_anim]
                                [filter_attack]
                                    name=sceptre of fire
                                [/filter_attack]

                                {MISSILE_FRAME_FIREBALL}

                                [frame]
                                    begin=-200
                                    end=0
                                    sound=fire.wav
                                [/frame]
                            [/attack_anim]
                        [/effect]
                    [/object]
                    [message]
                        speaker=Thursagan
                        message= _ "I have completed my work. Now it is truly the Sceptre of Fire, a powerful magical artifact."
                    [/message]
                    [message]
                        speaker=Rugnur
                        message= _ "Good. Now, let's get out of this cave, before the elves, dwarves or bats kill us!"
                    [/message]
                    [clear_variable]
                        name=turnsleft
                    [/clear_variable]
                    [endlevel]
                        result=victory
                        bonus=no
                        {NEW_GOLD_CARRYOVER 0}
                    [/endlevel]
                [/then]
                [else]
                    [message]
                        speaker=narrator
                        caption= _ "Thursagan"
                        image=portraits/thursagan.png
                        message= _ "In $turnsleft more turns I will have completed the Sceptre of Fire."
                    [/message]
                [/else]
            [/if]
        [/event]
    [/event]
[/scenario]
