#textdomain wesnoth-low
[scenario]
    id=14_Human_Alliance
    name= _ "Human Alliance"
    {LOW_MAP 14_Human_Alliance.map}
    #out of turns leads to victory
    turns=25

    {DEFAULT_SCHEDULE}

    {STARTING_VILLAGES_ELF   1}
    {STARTING_VILLAGES_HUMAN 2}
    {STARTING_VILLAGES_TROLL 5}

    {INTRO_AND_SCENARIO_MUSIC revelation.ogg loyalists.ogg}
    {EXTRA_SCENARIO_MUSIC the_city_falls.ogg}
    {EXTRA_SCENARIO_MUSIC knolls.ogg}
    {EXTRA_SCENARIO_MUSIC heroes_rite.ogg}
    {EXTRA_SCENARIO_MUSIC breaking_the_chains.ogg}

    next_scenario=15_The_Treaty
    [story]
        [part]
            story= _ "With the human-elf alliance revived, our heroes hurried to the battlefield..."
            delay=4000
            {TO_HUMAN_ALLIANCE}
        [/part]
        [part]
            show_title=yes
            {TO_HUMAN_ALLIANCE_BATTLE}
        [/part]
    [/story]

    #wmllint: validate-off
    [side]
        {KALENZ}
        # wmllint: recognize Kalenz
        recruit={ELVES},{DWARVES}
        {GOLD 300 250 200}
    [/side]
    #wmllint: validate-on
    [side]
        type=General
        id=Aldar
        name= _ "Aldar"
        profile="portraits/aldar.png"
        side=2
        controller=ai
        canrecruit=yes
        {GOLD 550 500 450}
        recruit=Heavy Infantryman,Dragoon,Longbowman,Duelist,Halberdier,Horseman,Cavalier,Cavalryman, Royal Guard, Mage, Swordsman, Bowman
        team_name=kalenz
        [ai]
            passive_leader=yes
            [avoid]
                x=1-47
                y=1-14
            [/avoid]
        [/ai]
    [/side]

    [side]
        type=Orcish Warlord
        id=Pirror
        name=_ "Pirror"
        side=3
        canrecruit=yes
#ifdef EASY
        recruit={ORCS1}, Orcish Crossbowman, Goblin Pillager, Goblin Knight
#endif

#ifdef NORMAL
        recruit=Orcish Archer, Orcish Assassin, Orcish Grunt, Wolf Rider, Orcish Crossbowman, Goblin Pillager, Goblin Knight, Orcish Slayer, Orcish Warrior, 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, Goblin Impaler, Goblin Rouser, Direwolf Rider
#endif
        {GOLD 320 400 430}
        team_name=orcs
        [ai]
            {NO_SCOUTS}
            recruitment_ignore_bad_movement=yes
            recruitment_pattern=scout,fighter,fighter,archer,mixed fighter
            {ATTACK_DEPTH 4 5 6}
        [/ai]
        [ai]
            time_of_day=dusk,first_watch,second_watch
            aggression=0.75
            caution=0.0
            grouping=no
        [/ai]
        {INCOME 4 8 12}
    [/side]

    [side]
        type=Orcish Warlord
        id=Tan-Grub
        name=_ "Tan-Grub"
        profile="portraits/orcs/warlord.png"
        side=4
        canrecruit=yes
#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 Pillager, Goblin Knight, Orcish Slayer, Orcish Warrior, 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, Goblin Impaler
#endif
        {GOLD 220 300 360}
        team_name=orcs
        [ai]
            {NO_SCOUTS}
            recruitment_ignore_bad_movement=yes
            recruitment_pattern=scout,fighter,fighter,archer,mixed fighter
            {ATTACK_DEPTH 4 5 6}
        [/ai]
        [ai]
            time_of_day=dusk,first_watch,second_watch
            aggression=0.75
            caution=0.0
            grouping=no
        [/ai]
        {INCOME 4 8 12}
    [/side]

    [side]
        type=Great Troll
        id=Grol
        name=_ "Grol"
        side=5
        canrecruit=yes
#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 220 260 300}
        team_name=orcs
        [ai]
            {NO_SCOUTS}
            recruitment_ignore_bad_movement=yes
#ifdef EASY
            recruitment_pattern=fighter
#else
            recruitment_pattern=fighter,fighter,mixed fighter
#endif
            grouping=no
            {ATTACK_DEPTH 4 5 6}
        [/ai]

        {INCOME 4 8 12}
    [/side]

    [side]
        type=Orcish Warlord
        id=Khafa-Urg
        name=_ "Khafa-Urg"
        side=6
        canrecruit=yes
#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 Pillager, Goblin Knight, Orcish Slayer, Orcish Warrior, 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, Goblin Impaler
#endif
        {GOLD 320 400 450}
        team_name=orcs
        [ai]
            {NO_SCOUTS}
            recruitment_ignore_bad_movement=yes
            recruitment_pattern=scout,fighter,fighter,archer,mixed fighter
            {ATTACK_DEPTH 4 5 6}
        [/ai]
        [ai]
            time_of_day=dusk,first_watch,second_watch
            aggression=0.75
            caution=0.0
            grouping=no
        [/ai]
        {INCOME 4 8 12}
    [/side]

    [event]
        name=prestart

        [objectives]
            side=1
            [objective]
                description= _ "Defeat all enemy leaders"
                condition=win
            [/objective]
            [objective]
                description= _ "Last for 25 turns"
                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 Aldar"
                condition=lose
            [/objective]
        [/objectives]

        {RECALL_LOYALS}

        [recall]
            id=Olurf
        [/recall]

        {CHECK_LANDAR}
        {CHECK_CLEODIL}
        {CHECK_OLURF}
    [/event]

    [event]
        name=start
        [message]
            id=Kalenz
            message= _ "Here we are! Prepare to fight!"
        [/message]
        [message]
            id=Aldar
            message= _ "So it is true! The elves have come to our help!"
        [/message]
        [move_unit_fake]
            type=Horseman
            x=24,24,24
            y=23,22,21
        [/move_unit_fake]

        [unit]
            id=Aldun
            name=_ "Aldun"
            type=Horseman
            side=1
            x=24
            y=21
            facing=sw
        [/unit]
        [message]
            id=Aldun
            message= _ "General Aldar has received your message that you will be coming. He asks that you cut off the orcish reinforcements from the north. They must not be allowed to enter the battle! Our reinforcements should arrive in a few days."
        [/message]
        [message]
            id=Kalenz
            message= _ "Very well, but where are the elvish troops? We cannot hold without them!"
        [/message]
    [/event]

    [event]
        name=turn 2

        [set_variable]
            name,value=j,15
        [/set_variable]

        {FOREACH l3_selector_store i}
            #This says to try to place the unit at 14,15+i
            {VARIABLE l3_selector_store[$i].x 14}
            {VARIABLE l3_selector_store[$i].y $j}
            [set_variable]
                name=j
                add=1
            [/set_variable]

            #This says to unstore the unit and place it at its x,y coordinates
            [unstore_unit]
                find_vacant=yes
                variable=l3_selector_store[$i]
            [/unstore_unit]
            ############
        {NEXT i}
        {CLEAR_VARIABLE j}
        {CLEAR_VARIABLE l3_selector_store}

        [unit]
            id=Olontoril
            name= _ "Olontoril"
            type=Elvish Hero
            side=1
            x=4
            y=15
            [modifications]
                {TRAIT_STRONG}
                {TRAIT_RESILIENT}
            [/modifications]
        [/unit]
        [unit]
            id=Artolas
            name=_ "Artolas"
            type=Elvish Archer
            side=1
            x=1
            y=15
            [modifications]
                {TRAIT_STRONG}
                {TRAIT_RESILIENT}
            [/modifications]
        [/unit]
        [unit]
            type=Elvish Scout
            id=Irglus
            name=_ "Irglus"
            side=1
            x=3
            y=15
        [/unit]
        [unit]
            id=Antomeril
            name=_ "Antomeril"
            type=Elvish Fighter
            side=1
            x=2
            y=15
            [modifications]
                {TRAIT_STRONG}
                {TRAIT_RESILIENT}
            [/modifications]
        [/unit]
        [unit]
            id=Lirdomer
            name=_ "Lirdomer"
            type=Elvish Fighter
            side=1
            x=2
            y=16
            [modifications]
                {TRAIT_STRONG}
                {TRAIT_RESILIENT}
            [/modifications]
        [/unit]
        [unit]
            id=Eomil
            name=_ "Eomil"
            type=Elvish Archer
            side=1
            x=1
            y=16
            [modifications]
                {TRAIT_STRONG}
                {TRAIT_RESILIENT}
            [/modifications]
        [/unit]
        [unit]
            id=Toltilas
            name=_ "Toltilas"
            type=Elvish Archer
            side=1
            x=3
            y=16
            [modifications]
                {TRAIT_STRONG}
                {TRAIT_RESILIENT}
            [/modifications]
        [/unit]
        [message]
            id=Olontoril
            message= _ "Kalenz is here!"
        [/message]
        [message]
            id=Kalenz
            message= _ "Where is the rest of the elvish army? They should be here!"
        [/message]
        [message]
            id=Olontoril
            message= _ "The council has decided it was too risky to send troops here. But we could not let you stand on your own."
        [/message]
    [/event]

    [event]
        name=time over

        [unit]
            type=Paladin
            id=Kulrad
            name=_ "Kulrad"
            side=2
            x=30
            y=30
        [/unit]
        [unit]
            id=Aronas
            name=_ "Aronas"
            type=Horseman
            side=2
            x=30
            y=34
        [/unit]
        [unit]
            id=Halard
            name=_ "Halard"
            type=Knight
            side=2
            x=35
            y=33
        [/unit]
        [unit]
            id=Insith
            name=_ "Insith"
            type=Horseman
            side=2
            x=34
            y=35
        [/unit]
        [unit]
            id=Aladan
            name=_ "Aladan"
            type=Horseman
            side=2
            x=31
            y=34
        [/unit]
        [unit]
            id=Korrigan
            name=_ "Korrigan"
            type=Knight
            side=2
            x=35
            y=36
        [/unit]
        [unit]
            id=Prager
            name=_ "Prager"
            type=Horseman
            side=2
            x=35
            y=37
        [/unit]
        [unit]
            id=Mirqas
            name=_ "Mirqas"
            type=Horseman
            side=2
            x=33
            y=37
        [/unit]
        [unit]
            id=Undor
            name=_ "Undor"
            type=Horseman
            side=2
            x=33
            y=39
        [/unit]
        [message]
            id=Kulrad
            message= _ "Here we are, men! Charge!"
        [/message]
        [message]
            id=Tan-Grub
            message= _ "More horses!! Run, let's get out of here!"
        [/message]
        [endlevel]
            result=victory
            bonus=no
        [/endlevel]
    [/event]

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

    #wmllint: recognize Cleodil
    [event]
        name=victory
        [message]
            id=Kalenz
            message= _ "We have stopped the orcs once again!"
        [/message]
        [message]
            id=Cleodil
            message= _ "And we have revived the alliance with the humans!"
        [/message]
        [message]
            id=Aldar
            message= _ "The King is here! Hail Haldric II, King of Wesnoth!"
        [/message]
        [kill]
            id=Aldun
        [/kill]
    [/event]

    [event]
        name=last breath
        [filter]
            id=Aldar
        [/filter]
        [message]
            speaker=unit
            message= _ "Tath will fall, we have failed!!"
        [/message]
        [endlevel]
            result=defeat
        [/endlevel]
    [/event]

    [event]
        name=last breath
        [filter]
            id=Grol
        [/filter]
        [message]
            speaker=unit
            message= _ "I die? Great Chief never said anything about fighting elves and dwarves!"
        [/message]
    [/event]

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