#textdomain wesnoth-dm
[scenario]
    id=15_save_the_king
    name= _ "Save the King"
    next_scenario=16_dark_sky_over_weldyn
    {MEMOIRS_MAP save_the_prince.map}
    {TURNS 35 30 25}
    {DEFAULT_SCHEDULE}

    {INTRO_AND_SCENARIO_MUSIC loyalists.ogg vengeful.ogg}
    {EXTRA_SCENARIO_MUSIC the_dangerous_symphony.ogg}
    {EXTRA_SCENARIO_MUSIC the_city_falls.ogg}
    {EXTRA_SCENARIO_MUSIC northerners.ogg}

    [story]
        [part]
            show_title=yes
            {TO_SAVE_THE_PRINCE}
        [/part]
        [part]
            story= _ "Following Delfador, the elves moved to unite with the Wesnothian forces and meet Zorlan head-on..."
            delay=4000
            background="maps/wesnoth.png"
            {TO_SAVE_THE_PRINCE_BATTLE}
        [/part]
        [part]
            story= _ "but the King was in an unenviable position..."
            delay=8000
        [/part]
    [/story]

    #wmllint: validate-off
    [side]
        # wmllint: recognize Delfador
        {YOUNG_DELFADOR}
        type=Journeyman Mage
        recruit={ELVES}
        team_name=kalenz
        user_team_name= _ "Player"
    [/side]
    #wmllint: validate-on

    [side]
        type=King of Wesnoth
        id=Garard II
        name=_ "Garard II"
        profile="portraits/garard.png"
        side=2
        canrecruit=yes
        controller=ai
        team_name=kalenz
        user_team_name= _ "Player"
        recruit=Heavy Infantryman, Spearman, Bowman, Cavalryman, Horseman, Mage, Royal Guard, Shock Trooper, Swordsman
        {GOLD 400 460 600}
        {INCOME 0 2 2}
        [ai]
            passive_leader=yes
            [protect_unit]
                id="Garard II"
                #TODO find the right value without that tag should do nothing?
                #value=
            [/protect_unit]
        [/ai]
        [ai]
            # Avoid everywhere north of the southernmost reach of the river
            [avoid]
                x=1-30
                y=1-19,21-28
            [/avoid]
            # Also avoid the southwestern keep
            [avoid]
                x=18-30
                y=1-28
            [/avoid]
        [/ai]
        [ai]
            # Avoid southwestern keep until side 4 gets gold for its
            # second wave.
            turns=1-12
            [avoid]
                x=1-11
                y=1-28
            [/avoid]
        [/ai]
    [/side]

    [side]
        type=Orcish Warlord
        id=Zorlan
        name=_ "Zorlan"
        profile="portraits/zorlan.png"
        side=3
        canrecruit=yes
        controller=ai
#ifdef EASY
        recruit=Orcish Archer, Orcish Assassin, Orcish Grunt, Wolf Rider, Orcish Crossbowman, Goblin Pillager, Goblin Knight, Goblin Spearman
#endif

#ifdef NORMAL
        recruit=Orcish Archer, Orcish Assassin, Orcish Grunt, Wolf Rider, Orcish Crossbowman, Goblin Knight, Orcish Slayer, Goblin Pillager, Goblin Spearman
#endif

#ifdef HARD
        recruit=Orcish Archer, Orcish Assassin, Orcish Grunt, Wolf Rider, Orcish Crossbowman, Orcish Warrior, Goblin Knight, Goblin Pillager, Orcish Slayer, Goblin Spearman
#endif
        {GOLD 150 260 330}
        team_name=orcs
    [/side]
    [side]
        type=Orcish Warrior
        id="T'bhan"
        name=_ "T'bhan"
        side=4
        canrecruit=yes
        controller=ai
#ifdef EASY
        recruit=Orcish Archer, Orcish Assassin, Orcish Grunt, Wolf Rider, Orcish Crossbowman, Goblin Pillager, Goblin Knight, Goblin Spearman
#endif

#ifdef NORMAL
        recruit=Orcish Archer, Orcish Assassin, Orcish Grunt, Wolf Rider, Orcish Crossbowman, Goblin Knight, Orcish Slayer, Goblin Pillager, Goblin Spearman
#endif

#ifdef HARD
        recruit=Orcish Archer, Orcish Assassin, Orcish Grunt, Wolf Rider, Orcish Crossbowman, Orcish Warrior, Goblin Knight, Goblin Pillager, Orcish Slayer, Goblin Spearman
#endif
        {GOLD 150 230 300}
        team_name=orcs
    [/side]
    [side]
        type=Orcish Warrior
        id=Qgthun
        name=_ "Qgthun"
        side=5
        canrecruit=yes
        controller=ai

#ifdef EASY
        recruit=Orcish Archer, Orcish Assassin, Orcish Grunt, Wolf Rider, Orcish Crossbowman, Goblin Pillager, Goblin Knight, Goblin Spearman
#endif

#ifdef NORMAL
        recruit=Orcish Archer, Orcish Assassin, Orcish Grunt, Wolf Rider, Orcish Crossbowman, Goblin Knight, Orcish Slayer, Goblin Pillager, Goblin Spearman
#endif

#ifdef HARD
        recruit=Orcish Archer, Orcish Assassin, Orcish Grunt, Wolf Rider, Orcish Crossbowman, Orcish Warrior, Goblin Knight, Goblin Pillager, Orcish Slayer, Goblin Spearman
#endif
        {GOLD 150 230 300}
        team_name=orcs
    [/side]
    [side]
        type=Great Troll
        id=Trgrau
        name=_ "Trgrau"
        side=6
        canrecruit=yes
        controller=ai
#ifdef EASY
        recruit=Troll Whelp
#endif
#ifdef NORMAL
        recruit=Troll Whelp,Troll,Troll Rocklobber
#endif

#ifdef HARD
        recruit=Troll Whelp,Troll,Troll Warrior,Troll Rocklobber
#endif

        {GOLD 150 230 300}
        team_name=orcs
    [/side]
    [event]
        name=prestart

        [recall]
            id=Chantal
        [/recall]

        [recall]
            id=Kalenz
        [/recall]

        [objectives]
            side=1
            [objective]
                description= _ "Defeat Zorlan"
                condition=win
            [/objective]
            [objective]
                description= _ "Death of Kalenz"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Delfador"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Chantal"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Garard"
                condition=lose
            [/objective]
            [objective]
                description= _ "Turns run out"
                condition=lose
            [/objective]
            note={EARLY_FINISH_BONUS_NOTE}
        [/objectives]
        [recall]
            id=Chantal
        [/recall]
        [recall]
            id=Clogrin
        [/recall]
        [recall]
            id=Droni
        [/recall]
        [recall]
            id=Arthur
        [/recall]
        [recall]
            id=Theorsten
        [/recall]
        [recall]
            id=Igler
        [/recall]
        [recall]
            id=Larsin
        [/recall]
        [recall]
            id=Glen
        [/recall]
        [recall]
            id=Aldrin
        [/recall]
    [/event]

    [event]
        name=start

        [message]
            id=Delfador
            message= _ "It appears we have arrived just in time! The King stands at bay, surrounded by the enemy."
        [/message]
        [message]
            id=Chantal
            message= _ "I fear we may be too late. This new warlord must have united every orcish tribe north of the Great River. Look at their army, it is vast!"
        [/message]
        [message]
            id=Zorlan
            message= _ "Elves! I heard you have been looking for me! But you will save neither the human prince, nor yourselves."
        [/message]
        [message]
            id=Kalenz
            message= _ "We must destroy this warlord now, before his power grows any greater!"
        [/message]
    [/event]

    [event]
        name=victory
        [message]
            id=Kalenz
            message= _ "Victory! "
        [/message]
        [message]
            id="Garard II"
            message= _ "Delfador! And you, elvish friends! The kingdom of Wesnoth is in your debt today!"
        [/message]
        [message]
            id=Delfador
            message= _ "My King, this is Kalenz, High Lord of the Elves."
        [/message]
        [message]
            id="Garard II"
            message= _ "You will be forever welcome in the court of Wesnoth."
        [/message]
        [message]
            id=Kalenz
            message= _ "We look forward to fighting beside you to defeat those threats that remain."
        [/message]
        [message]
            id=Delfador
            message= _ "Your Majesty, we have more urgent matters. Leollyn sent me on a mission to find out why the dead are restless. A foul necromancer has opened a portal to the land of the dead. It must be closed at all costs, and I am afraid my skills may be insufficient for that task."
        [/message]
        [message]
            id=Kalenz
            message= _ "Delfador, our weapons are weak against the undead, but perhaps we have other help to give you. Centuries ago the great mage Crelanu entrusted to us a book of lore, powerful knowledge, perilous secrets that it took Crelanu all his life to gather."
        [/message]
        [message]
            id=Kalenz
            message= _ "Crelanu charged us to guard his book until someone worthy of it appeared. We believe you are that one, Delfador. The book may help you find a way to close that portal."
        [/message]
        [message]
            id=Delfador
            message= _ "Friends, your words do me perhaps greater honor than I deserve. I am not sure I am worthy of this charge."
        [/message]
        [message]
            id=Kalenz
            message= _ "Chantal and I are sure of your quality. But be warned: there is a curse on this book. Crelanu fairly warned us that his arts would bring much woe down upon us. And so it proved, though at the time we had no other choice. The victories you win with it may cost you as dearly."
        [/message]
        [message]
            id=Delfador
            message= _ "Curse or no, we must close that portal soon, or else we are all doomed."
        [/message]
        [message]
            id=Kalenz
            message= _ "This is a decision you will have to make. If we fight the undead without the book's help, it will be an honor to fight by your side, no matter what the outcome."
        [/message]
        [message]
            id=Delfador
            message= _ "I think I, too, have no choice but to accept the book. I cannot allow the sure death of many humans and elves for fear of the curse."
        [/message]
        [message]
            id=Chantal
            message= _ "Then here it is, Delfador. May it help you bring a swift end to the undead menace. And may it cost you less than it has cost us..."
        [/message]
        [message]
            id=Delfador
            message= _ "Thank you, friends. May we meet again in happier times. Now I must make haste, for I need to study the book and prepare for the battle with the undead."
        [/message]

        {ELVES_DEPART}
    [/event]

    [event]
        name=last breath
        [filter]
            id=Zorlan
        [/filter]
        [message]
            id=Qgthun
            message=  _  "Invincible Zorlan is dead? Quick, run for your lives!"
        [/message]
        [message]
            id=Kalenz
            message=  _  "You will terrorize Wesnoth no more!"
        [/message]
#ifdef EASY
        [endlevel]
            result=victory
        [/endlevel]
#else
        [objectives]
            side=1
            [objective]
                description=_ "New Objective: Defeat all enemies"
                condition=win
            [/objective]
            [objective]
                description= _ "Defeat Zorlan"
                condition=win
            [/objective]
            [objective]
                description= _ "Death of Kalenz"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Delfador"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Chantal"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Garard"
                condition=lose
            [/objective]
            [objective]
                description= _ "Turns run out"
                condition=lose
            [/objective]
            note={EARLY_FINISH_BONUS_NOTE}
        [/objectives]
#endif
    [/event]

    ## Extra help for Garard in case Delf and Kalenz are a bit late
    #  but this is only once
    [event]
        name=moveto
        [filter]
            side=3,4,5,6
            x=12-17
            y=20-24
        [/filter]

        [message]
            speaker="Garard II"
            message= _ "The enemy is drawing near. My personal guards must join the fight. We can only hope help arrives soon."
        [/message]

        [move_unit_fake]
            type=Royal Guard
            side=2
            x=12,12
            y=19,20
        [/move_unit_fake]

        [unit]
            id=Adamar
            name= _ "Adamar"
            type=Royal Guard
            side=2
            x=12
            y=20
            [modifications]
                {TRAIT_RESILIENT}
                {TRAIT_STRONG}
            [/modifications]
            facing=sw
        [/unit]
#ifndef HARD
        [move_unit_fake]
            type=Royal Guard
            side=2
            x=16,17
            y=23,24
        [/move_unit_fake]
        [unit]
            id=Mitbreen
            name= _ "Mitbreen"
            type=Royal Guard
            side=2
            x=17
            y=24
            [modifications]
                {TRAIT_RESILIENT}
                {TRAIT_STRONG}
            [/modifications]
            facing=sw
        [/unit]
#endif
        [move_unit_fake]
            type=Iron Mauler
            side=2
            x=12,12
            y=19,20,21,22,23
        [/move_unit_fake]

        [unit]
            id=Ronduger
            name= _ "Ronduger"
            type=Iron Mauler
            side=2
            x=12
            y=23
            [modifications]
                {TRAIT_RESILIENT}
                {TRAIT_STRONG}
            [/modifications]
            facing=sw
        [/unit]

        [scroll_to_unit]
            x=12
            y=20
        [/scroll_to_unit]

        [message]
            speaker=Adamar
            message= _ "For the King!"
        [/message]
    [/event]

    # Second orc shouldn't be a pushover
    [event]
        name=turn 12
        [gold]
            side=4
            {QUANTITY amount 160 180 200}
        [/gold]
    [/event]

    [event]
        name=enemies defeated
        [endlevel]
            result=victory
            save=no
        [/endlevel]
    [/event]

    {MEMOIRS_DEATHS}
[/scenario]
