#textdomain wesnoth-The_Haunted_Woods
[multiplayer]
    id=13_The_Battle_for_Elensefar
    name= _ "The Battle for Elensefar"
    description= _ "Take 3 adventurers along a quest to uncover the secrets in the Grey Woods."
    next_scenario=14_Re_Entering_The_Grey_Woods
    map_data="{~/add-ons/The_Haunted_Woods/maps/Elensefar_big.map}"
    victory_when_enemies_defeated=yes
    turns=41
    random_start_time=no
    allow_new_game=no
    experience_modifier=100
    force_lock_settings=yes
    {~/add-ons/The_Haunted_Woods/utils/shops.cfg}
    {~/add-ons/The_Haunted_Woods/utils/deaths.cfg}
    {~/add-ons/The_Haunted_Woods/utils/schedules.cfg}
    {~/add-ons/The_Haunted_Woods/utils/menus.cfg}
    {~/add-ons/The_Haunted_Woods/utils/abilities.cfg}
    {~/add-ons/The_Haunted_Woods/utils/misc.cfg}
    {~/add-ons/The_Haunted_Woods/utils/journey.cfg}

    [story]
        [part]
            delay=4000
            {JOURNEY_BATTLE_FOR_ELENSEFAR}
            show_title=yes
            background=maps/wesnoth.png
        [/part]
    [/story]

    {THW_ALL_MENUS}

    {DEFAULT_SCHEDULE}

    {DEFAULT_MUSIC_PLAYLIST}

    [side]
        share_view=yes
        team_lock=yes
        gold_lock=yes
        income_lock=yes
        faction_from_recruit=yes
        side=1
        fog=no
        shroud=no
        gold=150
        village_gold=2
        income=0
        id=Fioril
        name= _ "Fioril"
        gender=female
        unrenamable=no
        type=Elvish Ranger
        controller=human
        canrecruit=yes
        [modifications]
            {TRAIT_STRONG}
            {TRAIT_DEXTROUS}
        [/modifications]
        save_id=thwp1
        persistent=yes
        team_name=good
        user_team_name= _ "Adventurers"
        recruit=Elvish Fighter, Elvish Archer, Elvish Shaman, Elvish Scout, Wose
    [/side]

    [side]
        share_view=yes
        team_lock=yes
        gold_lock=yes
        income_lock=yes
        faction_from_recruit=yes
        side=2
        fog=no
        shroud=no
        gold=150
        village_gold=2
        income=0
        id=Aigatus
        name= _ "Aigatus"
        gender=male
        unrenamable=no
        type=Dwarvish Stalwart
        controller=human
        canrecruit=yes
        [modifications]
            {TRAIT_QUICK}
            {TRAIT_RESILIENT}
        [/modifications]
        save_id=thwp2
        persistent=yes
        team_name=good
        user_team_name= _ "Adventurers"
        recruit=Dwarvish Fighter, Dwarvish Thunderer, Dwarvish Ulfserker, Dwarvish Guardsman, Footpad, Thief, Poacher
    [/side]

    [side]
        share_view=yes
        team_lock=yes
        gold_lock=yes
        income_lock=yes
        faction_from_recruit=yes
        side=3
        fog=no
        shroud=no
        gold=150
        village_gold=2
        income=0
        id=Cariddry
        name= _ "Cariddry"
        gender=male
        unrenamable=no
        type=Lieutenant
        controller=human
        canrecruit=yes
        [modifications]
            {TRAIT_STRONG}
            {TRAIT_INTELLIGENT}
        [/modifications]
        save_id=thwp3
        persistent=yes
        team_name=good
        user_team_name= _ "Adventurers"
        recruit=Spearman, Bowman, Heavy Infantryman, Fencer, Cavalryman
    [/side]

    [side]
        side=4
        controller=ai
        allow_player=no
        team_name=good
        user_team_name=_ "Lord Throlas"
        type=Elvish High Lord
        canrecruit=yes
        id=Throlas
        name= _ "Throlas"
        team_lock=yes
        gold_lock=yes
        income_lock=yes
        unrenamable=no
        gold=200
        village_gold=3
        income=0
        recruit=Elvish Fighter, Elvish Archer, Elvish Shaman
        [modifications]
            [object]
                silent=yes
                [effect]
                    apply_to=movement
                    set=0
                [/effect]
            [/object]
        [/modifications]
        [ai]
            aggression=-1.0
            caution=5.0
            leader_value=50
            grouping=yes
        [/ai]
    [/side]
    [side]
        side=5
        controller=ai
        allow_player=no
        generate_name=yes
        team_name=bad
        user_team_name=_ "Orcs"
        type=Orcish Warlord
        canrecruit=yes
        team_lock=yes
        gold_lock=yes
        income_lock=yes
        unrenamable=no
        gold=400
        village_gold=2
        income=5
        recruit=Orcish Warrior, Orcish Grunt, Orcish Crossbowman, Wolf Rider, Orcish Archer, Orcish Slayer, Orcish Assassin, Goblin Pillager
        [ai]
            aggression=1.0
            caution=-5.0
            leader_value=50
            grouping=yes
        [/ai]
    [/side]
    {LIMIT_RECRUITS 5 (Goblin Pillager) 3}
    [side]
        side=6
        controller=ai
        allow_player=no
        generate_name=yes
        team_name=bad
        user_team_name=_ "Orcs"
        type=Orcish Warlord
        canrecruit=yes
        team_lock=yes
        gold_lock=yes
        income_lock=yes
        unrenamable=no
        gold=300
        village_gold=2
        income=4
        recruit=Orcish Warrior, Orcish Grunt, Orcish Crossbowman, Wolf Rider, Orcish Archer, Orcish Slayer, Orcish Assassin, Goblin Pillager
        [ai]
            aggression=1.0
            caution=-5.0
            leader_value=50
            grouping=yes
        [/ai]
    [/side]
    {LIMIT_RECRUITS 5 (Goblin Pillager) 3}
    [side]
        side=7
        controller=ai
        allow_player=no
        generate_name=yes
        team_name=bad
        user_team_name=_ "Orcs"
        type=Orcish Warlord
        canrecruit=yes
        team_lock=yes
        gold_lock=yes
        income_lock=yes
        unrenamable=no
        gold=300
        village_gold=2
        income=4
        recruit=Orcish Warrior, Orcish Grunt, Orcish Crossbowman, Wolf Rider, Orcish Archer, Orcish Slayer, Orcish Assassin, Goblin Pillager
        [ai]
            aggression=1.0
            caution=-5.0
            leader_value=50
            grouping=yes
        [/ai]
    [/side]
    {LIMIT_RECRUITS 7 (Goblin Pillager) 3}
    [side]
        side=8
        controller=ai
        allow_player=no
        generate_name=yes
        team_name=bad
        user_team_name=_ "Trolls"
        type=Troll Warrior
        canrecruit=yes
        team_lock=yes
        gold_lock=yes
        income_lock=yes
        unrenamable=no
        gold=400
        village_gold=2
        income=5
        recruit=Troll Whelp, Troll Rocklobber, Troll
        [ai]
            aggression=1.0
            caution=-5.0
            leader_value=50
            grouping=yes
        [/ai]
    [/side]
    [side]
        side=9
        controller=ai
        allow_player=no
        team_name=evil
        user_team_name=_ "Undead"
        type=Lich
        name="Mal M'Atool"
        id=atool
        canrecruit=yes
        team_lock=yes
        gold_lock=yes
        income_lock=yes
        unrenamable=no
        gold=1000
        village_gold=2
        income=0
        recruit=Skeleton, Skeleton Archer, Walking Corpse, Soulless, Wraith, Shadow, Revenant, Bone Shooter, Blood Bat, Vampire Bat, Necrophage, Ghoul, Ghost, Dark Adept, Dark Sorcerer
        [ai]
            aggression=1.0
            caution=-5.0
            leader_value=50
            grouping=no
        [/ai]
    [/side]

    {PLACE_IMAGE (units/transport/transport-galleon.png) 51 28}
    {PLACE_IMAGE (units/transport/transport-galleon.png) 52 28}
    {PLACE_IMAGE (units/transport/transport-galleon.png) 52 29}
    {PLACE_IMAGE (units/transport/transport-galleon.png) 31 13}
    {PLACE_IMAGE (units/transport/transport-galleon.png) 9 17}
    {PLACE_IMAGE (units/transport/transport-galleon.png) 63 40}
    {PLACE_IMAGE (units/transport/transport-galleon.png) 85 38}

    {GOLD_XP_CONVERT_SHOP 85 55}
    {GOLD_XP_CONVERT_SHOP 32 34}

    {EQUIPMENT_SHOP 82 58}
    {EQUIPMENT_SHOP 27 36}

    {POTION_SHOP 78 51}
    {POTION_SHOP 29 34}

    {THW_DEFAULT_DIFFICULTY_SETUP}
    [event]
        name=prestart
        [objectives]
            side=0
            [objective]
                description= _ "Save Elensefar!"
                condition=win
            [/objective]
            [objective]
                description= _ "Death of any heroes"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of Lord Throlas"
                condition=lose
            [/objective]
            [objective]
                description= _ "Death of all units of your side"
                condition=lose
            [/objective]
            note={NO_GOLD_CARRYOVER_NOTE}
        [/objectives]
        [unit]
            side=4
            name= _ "Thrion"
            id=Thrion
            type=Elvish Captain
            ai_special=guardian
            x=30
            y=27
            [modifications]
                {TRAIT_LOYAL}
                {TRAIT_STRONG}
            [/modifications]
            {IS_HERO}
        [/unit]
        [store_unit]
            [filter]
                side=9
                canrecruit=yes
            [/filter]
            variable=stored_lich
            kill=yes
        [/store_unit]
    [/event]

    [event]
        name=start
        [recall]
            id=instructor
        [/recall]
        [recall]
            id=dwarf_leader
        [/recall]
        [recall]
            id=Urymir
        [/recall]
        [recall]
            id=woseleader
        [/recall]
        [recall]
            id=scout
        [/recall]
        [recall]
            id=urza
        [/recall]
        [recall]
            id=Ameldor
        [/recall]
        [recall]
            id=Owaron
        [/recall]
        [if]
            [variable]
                name=mermen_found
                equals=1
            [/variable]
            [then]
                [allow_recruit]
                    side=3
                    type=Merman Hunter
                [/allow_recruit]
                [allow_recruit]
                    side=1
                    type=Mermaid Initiate
                [/allow_recruit]
                [allow_recruit]
                    side=2
                    type=Merman Fighter
                [/allow_recruit]
            [/then]
        [/if]
        [if]
            [variable]
                name=has_gryphon_eggs
                equals=1
            [/variable]
            [then]
                [if]
                    [variable]
                        name=player_2
                        equals=yes
                    [/variable]
                    [then]
                        [allow_recruit]
                            side=2
                            type=Gryphon Rider
                        [/allow_recruit]
                    [/then]
                    [else]
                        [allow_recruit]
                            side=$thw_players.side
                            type=Gryphon Rider
                        [/allow_recruit]
                    [/else]
                [/if]
            [/then]
        [/if]
        [if]
            [have_unit]
                id=instructor
            [/have_unit]
            [then]
                [store_unit]
                    [filter]
                        id=instructor
                    [/filter]
                    variable=instructor_stored
                [/store_unit]
                [allow_recruit]
                    side=$instructor_stored.side
                    type=Mage
                [/allow_recruit]
                {CLEAR_VARIABLE instructor_stored}
            [/then]
        [/if]
        [message]
            speaker=Fioril
            message= _ "I wonder if this might be a trap?"
        [/message]
        [message]
            speaker=Aigatus
            message= _ "Maybe it i-"
        [/message]
        [message]
            speaker=Cariddry
            message= _ "Do <i>not</i> say that, Aigatus!"
        [/message]
        [message]
            speaker=Thrion
            message= _ "Adventurers! You have arrived right in the nick of time to save us! With haste, there is still hope that Elensefar can be rescued from this siege."
        [/message]
        [message]
            speaker=Cariddry
            message= _ "Err... Where is General Sutuzov?"
        [/message]
        [message]
            speaker=Throlas
            message= _ "He left the day before the orcs arrived in Carcyn and took over the city."
        [/message]
        [message]
            type=Orcish Warlord
            message= _ "More enemies have arrived! That is just more for us to kill!"
        [/message]
        [message]
            speaker=Aigatus
            message= _ "There is no more time to talk! Now is the time for action!"
        [/message]
    [/event]
    [event]
        name=die
        [filter]
            id=Thrion
        [/filter]
        [message]
            speaker=Thrion
            message= _ "I fall in battle, friends!"
        [/message]
    [/event]
    [event]
        name=die
        [filter]
            id=Throlas
        [/filter]
        [message]
            speaker=Throlas
            message= _ "Hope for the rescue of Elensefar has been extinguished!"
        [/message]
        [endlevel]
            result=defeat
        [/endlevel]
    [/event]
    [event]
        name=turn 5
        [unstore_unit]
            variable=stored_lich
        [/unstore_unit]
        [message]
            speaker=atool
            message= _ "Fools! I will kill you all and doom your souls to eternal suffering!"
        [/message]
    [/event]
    [event]
        name=last breath
        first_time_only=no
        [filter_second]
            type=Soulless, Walking Corpse
        [/filter_second]
        [message]
            speaker=unit
            message= _ "Ugh! I am doomed to eternal suffering!"
        [/message]
    [/event]
    [event]
        name=last breath
        [filter]
            id=atool
        [/filter]
        [message]
            speaker=unit
            message= _ "HAHA! I was only a disguise! Did you think that the great Mal M'Atool could be defeated so easily? No! His only weakness is------"
        [/message]
        [kill]
            id=atool
            animate=yes
        [/kill]
        [message]
            speaker=second_unit
            message= _ "There, he is finished now!"
        [/message]
        [message]
            speaker=Aigatus
            message= _ "Why did you kill him so quickly? He was about to reveal Mal M'Atool's weakness to us!"
        [/message]
        [message]
            speaker=second_unit
            message= _ "Oh...well I really wanted the 24 experience."
        [/message]
    [/event]
    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=5,6,7,8,9
            [filter_location]
                terrain=Rp^Vhc
                [not]
                    [filter_adjacent_location]
                        count=1-6
                        [filter]
                            type=Peasant, Woodsman, Ruffian
                        [/filter]
                    [/filter_adjacent_location]
                [/not]
            [/filter_location]
        [/filter]
        {RANDOM 0..2}
        [switch]
            variable=random
            [case]
                value=0
                [unit]
                    side=4
                    name= _ "Angry Peasant"
                    type=Peasant
                    max_moves=0
                    moves=0
                    max_experience=50
                    [modifications]
                        {TRAIT_RESILIENT}
                        {TRAIT_STRONG}
                    [/modifications]
                    x=$x1
                    y=$y1
                [/unit]
                [message]
                    speaker=narrator
                    message= _ "Get off of my yard!"
                    caption= _ "Angry Peasant"
                    image=portraits/humans/transparent/peasant.png
                [/message]
                [sound]
                    name=spear.ogg
                [/sound]
                {VARIABLE invader_hp_subtract $unit.hitpoints}
                {VARIABLE_OP invader_hp_subtract add -5}
                {MODIFY_UNIT x,y=$x1,$y1 hitpoints $invader_hp_subtract}
                [floating_text]
                    x,y=$x1,$y1
                    text="<span color='#FF0000'>5</span>"
                [/floating_text]
                {CLEAR_VARIABLE invader_hp_subtract}
            [/case]
            [case]
                value=1
                [unit]
                    side=4
                    name= _ "Angry Woodsman"
                    type=Woodsman
                    max_moves=0
                    moves=0
                    max_experience=50
                    [modifications]
                        {TRAIT_RESILIENT}
                        {TRAIT_STRONG}
                    [/modifications]
                    x=$x1
                    y=$y1
                [/unit]
                [message]
                    speaker=narrator
                    message= _ "Get off of my hunting patch!"
                    caption= _ "Angry Woodsman"
                    image=portraits/humans/transparent/woodsman.png
                [/message]
                [sound]
                    name=bow-puny.ogg
                [/sound]
                {VARIABLE invader_hp_subtract $unit.hitpoints}
                {VARIABLE_OP invader_hp_subtract add -8}
                {MODIFY_UNIT x,y=$x1,$y1 hitpoints $invader_hp_subtract}
                [floating_text]
                    x,y=$x1,$y1
                    text="<span color='#FF0000'>8</span>"
                [/floating_text]
                {CLEAR_VARIABLE invader_hp_subtract}
            [/case]
            [case]
                value=2
                [unit]
                    side=4
                    name= _ "Angry Ruffian"
                    type=Ruffian
                    max_moves=0
                    moves=0
                    max_experience=50
                    [modifications]
                        {TRAIT_RESILIENT}
                        {TRAIT_STRONG}
                    [/modifications]
                    x=$x1
                    y=$y1
                [/unit]
                [message]
                    speaker=narrator
                    message= _ "Get off of my tavern!"
                    caption= _ "Angry Ruffian"
                    image=portraits/humans/transparent/thief.png
                [/message]
                [sound]
                    name=club.ogg
                [/sound]
                {VARIABLE invader_hp_subtract $unit.hitpoints}
                {VARIABLE_OP invader_hp_subtract add -6}
                {MODIFY_UNIT x,y=$x1,$y1 hitpoints $invader_hp_subtract}
                [floating_text]
                    x,y=$x1,$y1
                    text="<span color='#FF0000'>6</span>"
                [/floating_text]
                {CLEAR_VARIABLE invader_hp_subtract}
            [/case]
        [/switch]
    [/event]
    [event]
        name=enemies defeated
        [endlevel]
            result=victory
            bonus=no
            carryover_percentage=40
            carryover_add=yes
        [/endlevel]
    [/event]
[/multiplayer]
