#textdomain wesnoth-low

#TODO make the ugly map border nicer

[scenario]
    id=03_Kalian
    name= _ "Ka'lian under attack"
    next_scenario=04_Elvish_Treasury

    {LOW_MAP  Kalian.map}
    {LOW_MASK 03_Kalian.mask}
    [event]
        name=prestart
        # make some part of the map unpassable
        [terrain]
            terrain=_off^_usr #wmllint: noconvert
            x=0-45,0-9 , 0-45
            y=0-5 ,0-44,39-44
        [/terrain]
    [/event]

    {TURNS 35 30 25}

    {INTRO_AND_SCENARIO_MUSIC northerners.ogg elvish-theme.ogg}
    {EXTRA_SCENARIO_MUSIC the_city_falls.ogg}
    {EXTRA_SCENARIO_MUSIC wanderer.ogg}
    {EXTRA_SCENARIO_MUSIC siege_of_laurelmor.ogg}
    {EXTRA_SCENARIO_MUSIC suspense.ogg}

    {DEFAULT_SCHEDULE}

    [story]
        [part]
            story= _ "Kalenz and his band finally made it to the Ka'lian, but things were not as they had hoped..."
            delay=4000
        [/part]
        [part]
            delay=4000
            show_title=yes
            {TO_KALIAN}
        [/part]
    [/story]

    #### Kalenz's code ####
    #wmllint: validate-off
    [side]
        side=1
        no_leader=yes
        controller=human
        team_name=kalenz
        save_id=Kalenz
        recruit={ELVES}
        {GOLD 300 200 100}
    [/side]

    {RECALL_KALENZ 43 15}
    # wmllint: recognize Kalenz

    [event]
        name=prestart
        {RECALL_LOYALS}
        {CHECK_LANDAR}
        # wmllint: recognize Landar
    [/event]

    #### /Kalenz's code ####

    [side]
        side=2
        no_leader=yes
        team_name=kalenz
        recruit={ELVES}
        [unit]
            {GALTRID}
            # wmllint: recognize Galtrid
            x=33
            y=26
        [/unit]

        {GOLD 200 210 220}

        [ai]
            recruitment_pattern=healer,archer,fighter,archer,fighter,archer,healer,scout
            villages_per_scout=10
            passive_leader=yes
            grouping=defensive
            caution=0.5
            aggression=0.0
        [/ai]
    [/side]
    {STARTING_VILLAGES_ALL 2}
    #wmllint: validate-on

    #### Side3 code ####
    [side]
        side=3
        no_leader=yes
        team_name=orcs
        [unit]
            type=Orcish Warlord
            id=Mutaf-uru
            name= _ "Mutaf-uru"
            profile=portraits/orcs/warlord3.png
            canrecruit=yes
            x=17
            y=6
        [/unit]
#ifdef EASY
        recruit={ORCS1}, Orcish Crossbowman, Goblin Pillager, Goblin Knight
#endif
#ifdef NORMAL
        recruit={ORCS1}, Orcish Crossbowman, Goblin Knight, Orcish Slayer, Goblin Pillager, Goblin Impaler, Goblin Rouser, Orcish Warrior
#endif
#ifdef HARD
        recruit={ORCS1}, Orcish Crossbowman, Orcish Warrior, Goblin Knight, Goblin Pillager, Orcish Slayer, Goblin Rouser, Goblin Impaler
#endif
        {GOLD 150 280 460}
        {INCOME 4 8 12}
        [ai]
            {NO_SCOUTS}
            recruitment_ignore_bad_movement=yes
            recruitment_pattern=scout,fighter,fighter,archer,mixed fighter
        [/ai]
        [ai]
            time_of_day=dusk,first_watch,second_watch
            aggression=0.75
            caution=0.0
            grouping=offensive
        [/ai]
    [/side]
    [event]
        name=last breath
        [filter]
            id=Mutaf-uru
        [/filter]
        [message]
            speaker=unit
            message= _ "We die, but more come after us, Orcs will rule all!"
        [/message]
    [/event]
    #### /Side3 code ####

    [side]
        side=4
        no_leader=yes
        team_name=orcs
        [unit]
            type=Orcish Warlord
            id=Murudin
            name= _ "Murudin"
            canrecruit=yes
            x=11
            y=14
        [/unit]
#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, Orcish Warrior
#endif
#ifdef HARD
        recruit=Orcish Archer, Orcish Assassin, Orcish Grunt, Wolf Rider, Orcish Crossbowman, Goblin Knight, Goblin Pillager, Orcish Slayer, Goblin Spearman, Orcish Warrior
#endif
        {GOLD 200 360 500}
        {INCOME 4 8 12}
        [ai]
            villages_per_scout=3
            village_value=50
            scout_village_targeting=50
            recruitment_pattern=scout,scout,scout,fighter,archer,mixed fighter
        [/ai]
#disabled as long as the ai behaves strange
#        [ai]
#            recruitment_pattern=scout,scout,scout,fighter,fighter,archer,fighter,mixed fighter
#            villages_per_scout=3
#            village_value=50
#            scout_village_targeting=100
 #           scout_village_target=5
#            time_of_day=dusk,first_watch,second_watch
#            aggression=0.75
#            caution=0.0
#            grouping=offensive
#        [/ai]
    [/side]

    [event]
        name=prestart
        [objectives]
            side=1
            [objective]
                description= _ "Defeat all enemy leaders"
                condition=win
            [/objective]
            [objective]
                description= _ "Death of Kalenz"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Landar"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Galtrid"
                condition=lose
            [/objective]
            [objective]
                description= _ "Turns run out"
                condition=lose
            [/objective]
        [/objectives]
    [/event]

    [event]
        name=start

        [message]
            id=Kalenz
            message= _ "Oh no! The Ka'lian is under attack! We must help them!"
        [/message]
        [message]
            id=Galtrid
            message= _ "Are you our army's vanguard? Hurry, we are under attack!"
        [/message]
        [message]
            id=Kalenz
            message= _ "No, we are fleeing an attack on our home, northeast of here. Time enough for talk later; we must defeat these orcs together, or at least hold them off long enough for the humans to come to our aid."
        [/message]
        [message]
            id=Galtrid
            message= _ "Then you have not heard. King Haldric has broken the treaty. The humans will not come to our help!"
        [/message]
        [message]
            id=Mutaf-uru
            message= _ "What's that? More meat for my troops? Get them!"
        [/message]
    [/event]

    [event]
        name=victory
        [message]
            id=Kalenz
            message= _ "We won! The Ka'lian is safe!"
        [/message]

        [sound]
            name=horse-canter.wav
        [/sound]

        [move_unit_fake]
            type=Elvish Scout
            x=44,42,40,34,32,31
            y=13,12,12,15,18,22
        [/move_unit_fake]

        [unit]
            id=Huraldur
            name= _ "Huraldur"
            type=Elvish Scout
            side=1
            x=31
            y=22
            [modifications]
                {TRAIT_QUICK}
                {TRAIT_RESILIENT}
                {TRAIT_LOYAL}
            [/modifications]
            facing=se
        [/unit]

        [message]
            id=Huraldur
            message= _ "The elvish treasury is under attack! They need help desperately!"
        [/message]
        [message]
            id=Kalenz
            message= _ "Galtrid, your men are weary from long combat. Mine are fresher; I'll go."
        [/message]
        [message]
            id=Huraldur
            message= _ "Hurry! We were near overwhelmed as I left."
        [/message]
        [message]
            id=Galtrid
            message= _ "Yes, go, Kalenz, I'll guard the Ka'lian till our army returns from the front."
        [/message]
    [/event]

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