#textdomain wesnoth
[binary_path]
    path=data/campaigns/Under_the_Burning_Suns
[/binary_path]
[+units]
    {campaigns/Under_the_Burning_Suns/units/Kaleh.cfg}
[/units]
[test]
    name="Test scenario"
    map_data="border_size=1
usage=map

Mm          , Mm          , Mm          , Mm          , Mm^Xm       , Mm^Xm       , Mm^Xm       , Gg          , Ww          , Gg          , Dd          , Gg          , Aa          , Gg          , Aa          , Gg          , Hh          , Gg          , Mm          , Gg          , Uu          , Gg          , Wo          , Wo          , Ch          , Wo          , Wo          , Wo          , Gg          , Wo          , Wo          , Wo          , Md          , Wo          , Wo          , Wo          , Rd          , Wo          , Wo          
Mm          , Mm          , Mm          , Mm          , Mm^Xm       , Mm^Xm       , Mm^Xm       , Gg^Vl       , Ww^Vm       , Gg          , Dd^Vda      , Gg          , Aa^Vea      , Aa^Vla      , Aa^Vha      , Gg          , Hh^Vhh      , Gg          , Mm^Vhh      , Gg          , Uu^Vu       , Gg          , Wo          , Wo          , Ch          , Wo          , Wo          , Wo          , Gg^Fet      , Wo          , Wo          , Wo          , Md          , Wo          , Wo          , Wo          , Rd          , 3 Wo          , Wo          
Mm          , Mm          , Mm          , Mm          , Mm          , Mm^Xm       , Gg          , Gg          , Gg          , Uu^Vud      , Gg          , Dd^Vdt      , Gg          , Gg^Ve       , Gg          , Gg^Vh       , Gg^Vo       , Ha^Vhha     , Gg          , Gs^Vht      , Wo          , Wo          , Cud         , Ch          , Wo          , Wo          , Ds          , Gg          , Wo          , Wo^Fet      , Hd^Fet      , Md^Fet      , Wo^Fet      , Wo          , Re          , Rd          , Wo          , Wo          , Wo          
Mm          , Mm          , Gg          , Gg          , Gg          , Gg          , Gg          , Ch          , Ch          , Ch          , Ch          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg^Vo       , Gg^Vo       , Gg          , Ss^Vhs      , Gg          , Cud         , Wo          , Wo          , Dd          , Ds          , Wo          , Wo          , Ha          , Hd          , Wo          , Wo          , Ql^Fet      , Re^Fet      , Wo          , Wo          , Uu^Fp       , Uu          , Uu          
Mm          , Mm          , Gg          , Gg          , Gg          , Gg          , Gg          , Ch          , 1 Kh        , Ch          , Ww          , Gg          , Gg          , Mm^Vhh      , Gg          , Gg          , Gg          , Gg          , Gg          , Gs^Fp       , Gs^Fp       , Gs^Fp       , Gs^Fp       , Dd          , Wo          , Wo          , Gs          , Ha          , Wo          , Wo          , Mm          , Ql          , Wo          , Wo          , Uh^Fp       , Uh^Fp       , Wo^Fp       , Wo^Fp       , Wo          
Mm          , Mm          , Gg          , Gg          , Gg          , Gg          , Gg          , Ch          , Ch          , Ch          , Gg          , Ww          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gs^Fp       , Gs^Fp       , Gs^Fp       , Gs^Fp       , Wo          , Gs          , Gs          , Gg^Vh       , Ww          , Ww^Fp       , Mm          , Ww          , Wo          , Rr          , Rr          , Wo^Fp       , Wo^Fp       , Gg^Fp       , Gg^Fp       , Gg          
Mm          , Mm          , Gg          , Gg          , Gg          , Gg          , Gg          , Ch          , Ch          , Ch          , Gg          , Gg          , Gg          , Gg          , Rr          , Gg          , Rr          , Rr          , Rr          , Gs^Fp       , Gs^Fp       , Gs^Fp       , Gs^Fp       , Gs^Fp       , Gg^Vh       , Rr          , Gg          , Ww^Fp       , Ww^Fp       , Hh^Fp       , Hh^Ft       , Hh^Ft       , Wo          , Wo          , Wo          , Gg^Fp       , Wo          , Gg          , Gg          
Mm          , Mm          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg^Ve       , Gg          , Gg^Ve       , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Rr          , Gg          , Rr          , Ggf         , Gg          , Gg          , Ggf         , Ggf         , Gg          , Gg          , Gg^Fdw      , Ww^Fdw      , Ww^Fp       , Ww^Fp       , Ww^Ft       , Gg^Ft       , Wo          , Mm^Xm       , Wo          , Gg          , Wo          , Ha          , Ha          
Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gs          , Gg          , Gg          , Rr          , Gg          , Gg          , Ggf         , Gg          , Ggf         , Ggf         , Gg          , Gg          , Gg          , Gg^Fdw      , Aa^Fdw      , Gg^Fp       , Gg          , Gg          , Wo          , Mm^Xm       , Wo          , Gg          , Wo          , Ha          , Ha          
Gg          , Gg          , Gs^Fp       , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gs          , Gg          , Gs          , Gg          , Gs          , Gg          , Gg          , Re          , Ggf         , Ggf         , Ggf         , Gg          , Ggf         , Ggf         , Gg          , Gg          , Gg          , Aa^Fdw      , Aa^Fdw      , Gg          , Gg          , Wo          , Aa          , Wo          , Gg          , Wo          , Hh          , Hh          
Gg          , Gg          , Gg          , Gg          , Gs^Ft       , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gs          , Gs          , Gs          , Gg          , Re          , Ggf         , Re          , Ggf         , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Wo          , Aa          , Wo          , Md          , Wo          , Hh          , Hh          
Gg          , Gg          , Dd^Do       , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gs          , Gg          , Gg          , Rd          , Gg          , Gg          , Re          , Re          , Re          , Ggf         , Gg          , Ch          , Ch          , Ch          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Wo          , Ai          , Wo          , Md          , Wo          , Ss^Bw|      , Ss^Bw|      
Gg          , Gg          , Gg          , Gg          , Gg^Fet      , Gg          , Gg          , Gg          , Gs^Fpa      , Ds^Fp       , Gs^Fp       , Gg          , Gg          , Rd          , Gg          , Rd          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Ch          , Ch          , Ch          , Gg          , Gg          , Gg          , Ww          , Gg          , Wo          , Gg          , Wo          , Ai          , Wo          , Mm          , Wo          , Ss          , Ss          
Xu          , Xu          , Xu          , Gg          , Gg          , Gg          , Gg          , Gg          , Re^Fp       , Gg^Fet      , Gg^Fp       , Ss^Vm       , Gg          , Rd          , Rd          , Rd          , Gg          , Re          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Wo^Bw\      , Wo^Bw/      , Wo^Bw|      , Ww          , Gg          , Wo          , Dd          , Wo          , Mm          , Wo          , Ss          , Ss          
Xu          , Xu          , Xu          , Ce          , Ce          , Ke          , Ce          , Gg          , Gg          , Re^Fp       , Gg^Ve       , Gg^Vh       , Gg          , Gg          , Gg          , Gg          , Ce          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Ss^Bw/      , Ww          , Ss^Bw|      , Ss^Bw\      , Gg          , Wo          , Dd          , Wo          , Qxu         , Wo          , Rr          , Rr          
Xu          , Xu          , Uu^Uf       , Xu          , Ce          , Ce          , Xu          , Gg          , Uh          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Ke          , Ce          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Ss^Bw\      , Wo          , Ds          , Wo          , Qxu         , Wo          , Rr          , Rr          
Xu          , Xu          , Uu^Uf       , Xu          , Xu          , Xu          , Xu          , Xu          , Uu          , Gg          , Uh          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Ss          , Gg          , Gg          , 2 Kh        , Gg          , Gg          , Wo          , Ds          , Wo          , Rd          , Wo          , Uh          , Uh          
Xu          , Xu          , Qxu         , Qxu         , Cud         , Xu          , Uu          , Uu^Ii       , Uu^Vu       , Gg          , Xu          , Gg          , Gg          , Gg          , Gg^Ve       , Gg          , Ch          , Gg          , Gg          , Chr         , Chr         , Gg          , Chw         , Ww          , Gg          , Chs         , Chs         , Gg          , Cud         , Gg          , Gg          , Gg          , Wo          , Gs          , Wo          , Rd          , Wo          , Uh          , Uh          
Xu          , Xu          , Xu          , Qxu         , Ql          , Cud         , Uh          , Uu^Vu       , Uu^Uf       , Xu          , Ql          , Gg^Ve       , Xu          , Gg          , Gg          , Gg          , Kh          , Ch          , Gg          , Khr         , Gg          , Gg          , Khw         , Chw         , Gg          , Khs         , Gg          , Gg          , Kud         , Cud         , Ww^Bw/      , Ww^Bw/      , Wo          , Gs          , Wo          , Re          , Wo          , Uu          , Uu          
Xu          , Xu          , Qxu         , Qxu         , Ql          , Ql          , Ql          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Wo          , Gg          , Wo          , Re          , Wo          , Uu          , Uu          
Xu          , Xu          , Qxu         , Qxu         , Ql          , Ql          , Ql          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Wo          , Gg          , Wo          , Re          , Wo          , Uu          , Uu          
"
    turns=-1
    id=test

    {DAWN}
    {MORNING}
    {AFTERNOON}
    {DUSK}
    {FIRST_WATCH}
    {SECOND_WATCH}
    [music]
        name="traveling_minstrels.ogg"
        ms_before=12000
    [/music]
    victory_music="loyalists.ogg,underground.ogg,revelation.ogg"
    defeat_music="sad.ogg"

    {campaigns/Under_the_Burning_Suns/utils/kaleh-abilities.cfg}
    [side]
        name= "Kaleh"
        type=Kaleh
        variation=Youth
        random_gender=yes
        id="test"
        side=1
        canrecruit=yes
        controller=human
        max_hitpoints=90
        experience=99
        recruit="Ghost,Troll Whelp,Assassin,Elvish Hero,Elvish Fighter,Elvish Archer,Horseman,Mage,Elvish Shaman,Red Mage,Spearman,Swordsman,Duelist,Fencer,Elvish Captain,Elvish Ranger,Elvish Shyde,Thief,Rogue,White Mage,Mage of Light,Elvish Sharpshooter,Silver Mage,Vampire Bat,Blood Bat,Dread Bat,Soulless,Walking Corpse"
        gold=2000
        team_name="1"
        shroud=yes
        [village]
            x,y=9,7
        [/village]
        [village]
            x,y=7,7
        [/village]
        [unit]
            x,y=9,7
            type="Silver Mage"
            generate_name=yes
        [/unit]
        [unit]
            x,y=4,8
            type="Elvish Avenger"
            id=statue
            generate_name=yes
            hitpoints=4
            [status]
                petrified=on
            [/status]
            overlays="wesnoth-icon.png~CROP(10,10,20,20)"
        [/unit]
        [unit]
            x,y=14,6
            type=Footpad
            generate_name=yes
            [modifications]
                [trait]
                    id=hairdo
                    [effect]
                        apply_to=image_mod
                        add="PAL(FFDC02,EA9752,C4793A,C35029,6B2C29,A34C29,D5561F,343424,353624,BF5746 > BCBCBC,7D7D7D,5E5E5E,434343,232323,3B3B3B,494949,232323,232323,484848)"
                    [/effect]
                [/trait]
            [/modifications]
        [/unit]
        [unit]
            x,y=12,8
            type="Thief"
            generate_name=yes
            hitpoints=9
            [status]
                poisoned=on
            [/status]
        [/unit]
        [unit]
            # Unhealable unit
            x,y=9,8
            type="Peasant"
            name="Unhealable"
            generate_name=yes
            [status]
                healable=no
            [/status]
        [/unit]
        [unit]
            # A unit without a portrait.
            x,y=18,9
            type="Wolf Rider"
            generate_name=yes
        [/unit]
        [unit]
            x,y=17,10
            type="Elvish Druid"
            generate_name=yes
        [/unit]
        [unit]
            # A unit with an old small portrait.
            x,y=19,10
            type="Thief"
            generate_name=yes
        [/unit]
        [unit]
            x,y=17,11
            type="Elvish Shyde"
            generate_name=yes
        [/unit]
        [unit]
            # A unit whose portrait is only shown on the right side.
            x,y=18,11
            type="White Mage"
            gender="female"
            generate_name=yes
        [/unit]
        [unit]
            # A unit with a cold attack
            x,y=19,11
            type="Dark Adept"
            generate_name=yes
        [/unit]
    [/side]

    [event]
        name=start
#ifdef DEBUG_MODE
        [message]
            speaker=narrator
            icon=wesnoth-icon.png
            message="Debug mode is on"
        [/message]
#endif
    [/event]

    [side]
        type=Orcish Warlord
        id="Urug-Telfar"
        side=2
        controller=ai
        canrecruit=yes
        recruit="Orcish Grunt,Troll Whelp,Wolf Rider,Orcish Archer,Orcish Assassin,Saurian Skirmisher,Naga Fighter"
        gold=40
        income=10
        team_name="2"
        [unit]
            x,y=12,13
            type="Orcish Archer"
            generate_name=yes
        [/unit]
        [unit]
            x,y=10,7
            type="Orcish Archer"
            generate_name=yes
        [/unit]
        [unit]
            x,y=18,12
            type="Ghost"
            name="Steadfast tester"
            [modifications]
                [object]
                    silent=yes
                    [effect]
                        apply_to=new_ability
                        [abilities]
                            {ABILITY_STEADFAST}
                        [/abilities]
                    [/effect]
                [/object]
            [/modifications]
        [/unit]
        [village]
            x,y=26,5
        [/village]
        [unit]
            x,y=24,7
            type="Silver Mage"
            name= "Hidden Teleporter"
        [/unit]
    [/side]
    [side]
        side=3
        controller=ai
        team_name="1,2"
        type="Gryphon Master"
        name="Friendly Explorer"
        canrecruit=yes
        fog=yes
        shroud=yes
        share_maps=no
        share_view=no
    [/side]
    [event]
        name=turn refresh
        first_time_only=no
        [if]
            [variable]
                name=side_number
                equals=3
            [/variable]
            [then]
                # This is to work around a broken idle_ai (it moves)
                [end_turn]
                [/end_turn]
            [/then]
        [/if]
    [/event]
    [label]
        x,y=1,1
        text="Explore the map"
    [/label]
    [event]
        name=moveto
        [filter]
            x,y=1,1
        [/filter]
        [modify_side]
            side=3
            share_maps=yes
        [/modify_side]
        [message]
            speaker=unit
            message="We should now be sharing maps with side 3!"
        [/message]
        [label]
            x,y=1,1
            text="Rename our kind friends"
        [/label]
        [event]
            name=moveto
            [filter]
                x,y=1,1
            [/filter]
            [modify_side]
                side=3
                user_team_name="Neutral"
            [/modify_side]
            [message]
                side=3
                message="That's right! We're neutral!"
            [/message]
            [label]
                x,y=1,1
                text=""
            [/label]
        [/event]
    [/event]

    [event]
        name=preload
        first_time_only=no
        [lua]
            code=<<
                local function my_lua_action(t)
                    wesnoth.fire("label", { text =
                        string.format("Lua says:\n%d units and %d gold on side %d",
                            #wesnoth.get_units { side = t.on_side },
                            wesnoth.get_side(t.on_side).gold,
                            t.on_side),
                        x = t.x, y = t.y })
                end
                wesnoth.register_wml_action("my_lua_action", my_lua_action)
                local function check_substitution(t)
                    wesnoth.set_variable("substitution_variable", 1)
                    if t.value ~= "Number 2" then
                        wesnoth.message("Substitution is not delayed! " .. tostring(t.value))
                    end
                end
                wesnoth.register_wml_action("check_substitution", check_substitution)
                local function get_child(cfg, name)
                    for i = 1, #cfg do
                        local v = cfg[i]
                        if v[1] == name then return v[2] end
                    end
                end
                function has_teleport(u)
                    local abil = get_child(u.__cfg, "abilities")
                    return abil and get_child(abil, "teleport")
                end
            >>
        [/lua]
    [/event]

    [event]
        name=prestart
        [lua]
            code=<<
                local args = ...
                local team = wesnoth.get_side(args.side);
                team.gold = team.gold + args.gold;
                local x, y = wesnoth.find_vacant_tile(14, 6)
                wesnoth.put_unit(x, y, { type = "Elvish Lady", side = 3 })
            >>
            [args]
                side=1
                gold=500
            [/args]
        [/lua]
        [set_menu_item]
            description="Calculate unit worth"
            id=test98
            [show_if]
                [have_unit]
                    x=$x1
                    y=$y1
                [/have_unit]
            [/show_if]
            [command]
                [unit_worth]
                    x=$x1
                    y=$y1
                [/unit_worth]
                [message]
                    x,y=$x1,$y1
                    message="I seem to be worth $unit_worth| gold!
This is based on the following facts:
I cost $cost gold and am at $health|% health.
My best advancement costs $next_cost gold and I'm $experience|% there."
                [/message]
            [/command]
        [/set_menu_item]
        [set_menu_item]
            description="LUA"
            id=test99
            [filter_location]
                [filter]
                    type=Kaleh
                [/filter]
            [/filter_location]
            [command]
                [message]
                    speaker=narrator
                    message="Enter lua code"
                    [text_input]
                        variable=code
                    [/text_input]
                [/message]
                [set_variables]
                    name=tag
                    mode=replace
                    [value]
                        code=$code
                    [/value]
                [/set_variables]
                [insert_tag]
                    name=lua
                    variable=tag
                [/insert_tag]
            [/command]
        [/set_menu_item]
    [/event]

    [event]
        name=prerecruit
        [message]
            speaker=narrator
            message= "testing prerecruit"
            image=wesnoth-icon.png
        [/message]
    [/event]

    [event]
        name=start
        [lua]
            code = <<
                wesnoth.set_village_owner(20, 1, 1)
                local u = wesnoth.get_units({ lua_function = "has_teleport" })[1]
                local t, c = wesnoth.find_path(u, 23, 7)
                for i,l in ipairs(t) do
                    wesnoth.fire("item",
                        { x = l[1], y = l[2], image = "items/buckler.png" })
                end
                wesnoth.fire("label",
                    { x = 23, y = 7, text = string.format("Move cost: %d", c) })
            >>
        [/lua]
    [/event]

    [event]
        name=prestart
        [time_area]
            id=cave
            {UNDERGROUND}
            terrain=U*^*,Q*,Xu,Kud,Cud
            x= 1-14
            y=13-19
        [/time_area]
    [/event]

    [event]
        name=prestart
        [sound_source]
            id=birds
            sounds=ambient/birds1.ogg,ambient/birds2.ogg,ambient/birds3.ogg
            delay=0
            chance=100
            check_fogged=true
            loop=-1
            x=21
            y=5
            full_range=3
            fade_range=5
        [/sound_source]
    [/event]

    [event]
        name="new turn"
        first_time_only=no
        [my_lua_action]
            on_side=1
            x,y=13,3
        [/my_lua_action]
    [/event]

    [event]
        name="new turn"
        [set_variable]
            name=substitution_variable
            value=0
        [/set_variable]
        [check_substitution]
            value="Number $($substitution_variable*2)"
        [/check_substitution]
    [/event]

    [label]
        x,y=4,3
        text="randomness"
    [/label]
    [event]
        name=moveto
        first_time_only=no
        [filter]
            x,y=4,3
        [/filter]
        {VARIABLE_OP minus_one random -1..-1}
        {VARIABLE_OP zero random 0..0}
        {VARIABLE_OP bool random 0..1}
        {VARIABLE_OP one random 1..1}
        {VARIABLE_OP below_ten random 0..9}
        {VARIABLE_OP ascii random one,two,three}
        {VARIABLE_OP mixed random 0..3,one,two,three,4..9,zero}
        [message]
            speaker=narrator
            image=wesnoth-icon.png
            message="Today, 0..0 = $zero, -1..-1 = $minus_one, 1..1 = $one and 0..1 = $bool.
Also, 0..9 = $below_ten, one,two,three = $ascii and the bonus answer is $mixed."
        [/message]
    [/event]
    [event]
        name=moveto
        first_time_only=no
        [filter]
            x,y,canrecruit,side=10,5,yes,1
        [/filter]
        [message]
            speaker=unit
            message="What am I supposed to be doing again?"
        [/message]
        [show_objectives]
            side=1
        [/show_objectives]
    [/event]
    [event]
        name=start
        [objectives]
            [objective]
                condition=win
                description= "Defeat the enemy leader (he's at 29,16!)"
                [show_if]
                    [have_unit]
                        x,y,canrecruit,side=29,16,yes,2
                    [/have_unit]
                [/show_if]
            [/objective]
            [objective]
                condition=win
                description= "Defeat the enemy leader (he's at 28,18!)"
                [show_if]
                    [have_unit]
                        x,y,canrecruit,side=28,18,yes,2
                    [/have_unit]
                [/show_if]
            [/objective]
            [objective]
                condition=win
                description= "Defeat the enemy leader (I have no clue where he is)"
                [show_if]
                    [not]
                        [have_unit]
                            canrecruit,side=yes,2
                            [and]
                                x,y=29,16
                                [or]
                                    x,y=28,18
                                [/or]
                            [/and]
                        [/have_unit]
                    [/not]
                [/show_if]
            [/objective]
        [/objectives]
    [/event]

    [event]
        name=moveto
        [filter]
            x=11
            y=6
            side=1
            [not]
                id=Baldras
            [/not]
        [/filter]

        [message]
            speaker=narrator
            message= "You can come if you wish, but the leader is only interested in speaking to Baldras."
            image=wesnoth-icon.png
        [/message]
    [/event]

    [event]
        name=moveto
        [filter]
            x,y,side=17,7,1
        [/filter]
        [modify_side]
            side=2
            gold=1000
            income=100
            recruit=Orcish Assassin,Orcish Warrior,Orcish Crossbowman,Wolf Rider,Orcish Archer
            [ai]
                time_of_day=morning,afternoon
                aggression=1.0
                caution=0.0
                recruitment_pattern=fighter,fighter,fighter,fighter
                {NO_SCOUTS}
            [/ai]
            [ai]
                time_of_day=dawn,dusk
                aggression=1.0
                caution=0.0
                recruitment_pattern=archer,archer,archer,archer
                {NO_SCOUTS}
            [/ai]
            [ai]
                time_of_day=first_watch,second_watch,underground
                aggression=1.0
                caution=0.0
                recruitment_pattern=scout,scout,scout,scout
                {NO_SCOUTS}
            [/ai]
        [/modify_side]
        {REMOVE_LABEL $x1 $y1}
        [message]
            speaker=narrator
            image=wesnoth-icon.png
            message="Now the orcs will fight until death; nothing shall stop their bloodthirsty warriors!"
        [/message]
        [modify_turns]
            current=5
        [/modify_turns]
    [/event]

    [label]
        x,y=14,12
        text="Health insurance"
    [/label]

    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            x,y=14,12
        [/filter]
        {LOG "$unit.name (id $unit.id|) requested health insurance!"}
        {FULL_HEAL (x,y=$x1|,$y1)}
    [/event]

    [label]
        x,y=17,7
        text="Open the hell"
    [/label]

    [label]
        x,y=19,9
        text="dialog"
    [/label]

    [label]
        x,y=18,4
        text="Gamestate Inspector"
    [/label]
    [event]
        name=moveto
        first_time_only=no
        [filter]
            x,y,side=18,4,1
        [/filter]

        [inspect]
            name="moveto(18,4)"
        [/inspect]
    [/event]

    [event]
        name=moveto
        first_time_only=no
        [filter]
            x,y,side=19,9,1
        [/filter]

        [message]
            speaker=unit
            message="Hello world"
        [/message]
    [/event]

    [label]
        x,y=20,9
        text="parrot"
    [/label]

    [event]
        name=moveto
        first_time_only=no
        [filter]
            x,y,side=20,9,1
        [/filter]

        [message]
            speaker=unit
            message="Who's the parrot"
            [text_input]
                text="test"
                variable="parrot"
            [/text_input]
        [/message]

        [message]
            speaker=unit
            message="Set the parrot settings."
            [text_input]
                label="Parrot message"
                variable="text"
            [/text_input]

            [option]
                message="Parrot is in denial"
                [command]
                    [message]
                        speaker=$parrot
                        message="Why are you looking at me, I'm no parrot!!!"
                    [/message]
                    [message]
                        speaker=narrator
                        image=wesnoth-icon.png
                        message="A short time passes..."
                    [/message]
                [/command]
            [/option]

            [option]
                message="Parrot accepted it's fate"
            [/option]
        [/message]

        [message]
            speaker=$parrot
            message=$text
        [/message]
    [/event]

    [label]
        x,y=18,8
        text="drink"
    [/label]

    [event]
        name=moveto
        first_time_only=no
        [filter]
            x,y,side=18,8,1
        [/filter]

        [message]
            speaker=unit
            message="Pick your drink"
            [option]
                message="Soda"
            [/option]
            [option]
                message="Water"
                [command]
                    [message]
                        speaker=narrator
                        image=wesnoth-icon.png
                        message="Water is nice"
                    [/message]
                [/command]
            [/option]
        [/message]
    [/event]

    [label]
        x,y=18,10
        text="poison"
    [/label]

    [event]
        name=moveto
        first_time_only=no
        [filter]
            x,y,side=18,10,1
        [/filter]

#wmlindent: start ignoring
        [lua]
            # Uses the special syntax as described at
            # http://www.wesnoth.org/wiki/DescriptionWML
            # The ; doesn't seem to work in the old gui so no need to port it.
            #
            # On 800x480 a scrollbar should appear.
            code = <<
                local ec = wesnoth.current.event_context
                wesnoth.message(string.format("Unit moved from %d,%d to %d,%d", ec.x2, ec.y2, ec.x1, ec.y1))
                local helper = wesnoth.require "lua/helper.lua"
                local result = helper.get_user_choice(
                    { speaker = "unit", message = "Pick your poison" },
                    { "&items/potion-red.png=Something red=Take a sip and enjoy",
                      "*&items/potion-blue.png=Nice blue=Surely you'll like that one",
                      "&items/potion-yellow.png=<span color='yellow'>Oh noes yellow</span>=Oh I'm sure you'll love that one",
                      "&scenery/well.png=A nice well=Grab a bucket and fetch some water",
                      "&items/holy-water.png=Oh nice bottle=Feel the divinity",
                      -- Should have an empty first column and a second column on two lines.
                      "=Well a nice and black drink.\nToo dark too see?=Take a sip and pass the bottle along" })
                wesnoth.message(string.format("User selected choice %d.", result))
            >>
        [/lua]
#wmlindent: stop ignoring
    [/event]

    [label]
        x,y=17,9
        text="Manual"
    [/label]

    [event]
        name=moveto
        first_time_only=no
        [filter]
            x,y,side=17,9,1
        [/filter]

#wmlindent: start ignoring
        [message]
            speaker=unit
            message="Battle for Wesnoth User's Manual
================================

Preface
-------

The Battle for Wesnoth is a turn-based strategy game with a fantasy theme.

Build up a great army, gradually training raw recruits into hardened veterans. In later games, recall your toughest warriors and form a deadly host against whom none can stand! Choose units from a large pool of specialists, and hand pick a force with the right strengths to fight well on different terrains against all manner of opposition.

Wesnoth has many different sagas waiting to be played out. You can battle orcs, undead, and bandits on the marches of the Kingdom of Wesnoth; fight alongside dragons in the lofty peaks, elves in the green reaches of the Aethenwood, dwarves in the great halls of Knalga, or even merfolk in the Bay of Pearls. You can fight to regain the throne of Wesnoth, or use your dread power over the Undead to dominate the land of mortals, or lead your glorious Orcish tribe to victory against the humans who dared despoil your lands.

You will be able to select from among over two hundred unit types (infantry, cavalry, archers, and mages are just the beginning) and fight actions ranging from small-unit ambushes to clashes of vast armies. You can also challenge your friends – or strangers – and fight in epic multi-player fantasy battles.

Battle for Wesnoth is open-source software, and a thriving community of volunteers cooperates to improve the game. You can create your own custom units, write your own scenarios, and even script full-blown campaigns. User-maintained content is available from an add-on server, and the very best of it is incorporated into Battle for Wesnoth's official releases.

Getting Started
---------------

The World
~~~~~~~~~

The known portion of the Great Continent, on which Wesnoth abides, is generally divided into three areas: the Northlands, which are generally lawless; the kingdom of Wesnoth and its occasional principality, Elensefar; and the domain of the Southwest Elves in the Aethenwood and beyond.

The Kingdom of Wesnoth lies in the center of this land. Its borders are the Great River to the north, the Dulatus Hills in the east and south, the edge of the Aethenwood to the southwest, and the Ocean to the west. Elensefar, a once-province of Wesnoth, is bordered by the Great River to the north, a loosely defined line with Wesnoth to the east, the Bay of Pearls to the south, and the ocean to the west.

The Northlands is the wild country north of the Great River. Various groups of orcs, dwarves, barbarians and elves populate the region.  To the north and east lies the forest of Lintanir, where the great kingdom of the North-Elves keeps to its own mysterious affairs.

Over the land are scattered villages where you can heal your troops and gather the income required to support your army. You will also have to cross mountains and rivers, push through forests, hills and tundra, and cross open grassland. In each of these areas different creatures have adapted to live there and can travel more easily and fight better when they are in familiar terrain.

The Creatures
^^^^^^^^^^^^^

In the world of Wesnoth there dwell humans, elves, dwarves, orcs, drakes, saurians, mermen, nagas, and many other races yet more obscure and wondrous. In accursed lands walk undead and ghosts and specters; monsters lurk in its ruins and dungeons.  Each has adapted to particular terrains. Humans inhabit primarily the temperate grasslands. In the hills, mountains and underground caves orcs and dwarves are most at home. In the forests the elves reign supreme. In the oceans and rivers mermen and nagas dominate.

For game purposes, the races group into factions; for example, orcs often cooperate with trolls, and elves or dwarves with humans. Some other factions reflect divisions within human society -- loyalists vs. outlaws, for example. In most campaigns, you will control units drawn a single faction. But sometimes factions make alliances with others, so you may face more than one faction in a scenario."
        [/message]
#wmlindent: stop ignoring
    [/event]

    {PLACE_IMAGE items/book1.png 2 2}
    {PLACE_IMAGE items/book2.png 3 2}
    {PLACE_IMAGE items/book3.png 4 2}
    {PLACE_IMAGE items/book4.png 5 2}
    {PLACE_IMAGE items/flower1.png 2 3}
    {PLACE_IMAGE items/flower2.png 3 3}
    {PLACE_IMAGE items/flower3.png 4 3}
    {PLACE_IMAGE items/flower4.png 5 3}
    {PLACE_IMAGE scenery/rock1.png 2 4}
    {PLACE_IMAGE scenery/rock2.png 3 4}
    {PLACE_IMAGE scenery/rock3.png 4 4}
    {PLACE_IMAGE scenery/rock4.png 5 4}
    {PLACE_IMAGE items/dragonstatue.png 2 5}
    {PLACE_IMAGE items/ornate1.png 3 5}
    {PLACE_IMAGE items/ornate2.png 4 5}
    {PLACE_IMAGE items/barrel.png 5 5}
    {PLACE_IMAGE scenery/monolith1.png 2 6}
    {PLACE_IMAGE scenery/monolith2.png 3 6}
    {PLACE_IMAGE scenery/monolith3.png 4 6}
    {PLACE_IMAGE scenery/monolith4.png 5 6}
    {PLACE_IMAGE scenery/well.png 2 7}
    {PLACE_IMAGE scenery/leanto.png 3 7}
    {PLACE_IMAGE items/ball-green.png 4 7}
    {PLACE_IMAGE items/ball-blue.png 5 7}
    {PLACE_IMAGE items/box.png 2 8}
    {PLACE_IMAGE scenery/well.png 10 5}

    {OBJ_RING_REGENERATION 10 4 OBJ1}
    {OBJ_RING_REGENERATION 10 40 OBJ1}
    {OBJ_RING_SLOW 11 4 OBJ2}
    {OBJ_POTION_HEALING 12 4 OBJ3}
    {OBJ_POTION_POISON 13 5 OBJ4}
    {OBJ_POTION_HOLY 14 4 OBJ5}
    {OBJ_POTION_STRONG 15 4 OBJ6}
    {OBJ_POTION_DECAY 11 5 OBJ7}
    {OBJ_TRIDENT_STORM 12 5 OBJ8}
    #{OBJ_SWORD_FIRE 13 5 OBJ9}
    #{OBJ_SCEPTRE_FIRE 14 5 OBJ10}

    {TELEPORT_TILE 10 3 27 15}

    [event]
        name=moveto
        [filter]
            side=1
        [/filter]

        [modify_side]
            side=1
#wmlindent: start ignoring
            shroud_data="|111111111111
|1111111111111
|1111111111111
|11111111111111
|11111111111111
|001111111111111
|111111111111111
|1111111111111111
|111111111111111
|1111111111111111
|1111111111111111
|11111111111111111
|11111111111111111
|11111111111111111
|1111111111111111
|1111111111111111
|111111111111111
|111111111111111
|11111111111111
|11111111111111
|1111111111111
|
|
|
|
|
|
|
|
|
|
|
|00000000000001111111
|000000000000011111111
|00000000000001111111
|000000000000000111111
|00000000000000011111
"
#wmlindent: stop ignoring
        [/modify_side]
    [/event]

    [item]
        x,y=9,1
        # This doesn't work, image doesn't do animation
        image="scenery/fire1.png~CS(0,0,50):150,scenery/fire2.png~CS(0,0,50):150,scenery/fire3.png~CS(0,0,50):150,scenery/fire4.png~CS(0,0,50):150,scenery/fire5.png~CS(0,0,50):150,scenery/fire6.png~CS(0,0,50):150,scenery/fire7.png~CS(0,0,50):150,scenery/fire8.png~CS(0,0,50):150"
    [/item]
    [item]
        x,y=11,1
        halo="scenery/fire1.png~CS(0,0,50):150,scenery/fire2.png~CS(0,0,50):150,scenery/fire3.png~CS(0,0,50):150,scenery/fire4.png~CS(0,0,50):150,scenery/fire5.png~CS(0,0,50):150,scenery/fire6.png~CS(0,0,50):150,scenery/fire7.png~CS(0,0,50):150,scenery/fire8.png~CS(0,0,50):150"
    [/item]

    [item]
        x,y=8,8
        image="items/orcish-flag.png"
    [/item]
    [label]
        x,y=8,8
        text="Northerners unleashed!"
    [/label]

    [item]
        x,y=10,10
        halo="scenery/fire1.png:150,scenery/fire2.png:150,scenery/fire3.png:150,scenery/fire4.png:150,scenery/fire5.png:150,scenery/fire6.png:150,scenery/fire7.png:150,scenery/fire8.png:150"
    [/item]

    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            x=8
            y=8
        [/filter]
        [terrain]
            x=28,30,29
            y=15,15,17
            terrain=Ch
        [/terrain]

        {VARIABLE_OP xx1 random 10..20}
        {VARIABLE_OP yy1 random 10..17}

        [unit]
            side=2
            x,y="$xx1","$yy1"
            type="Orcish Warlord"
            id="Bozo"
            generate_name=yes
        [/unit]

        [message]
            speaker="Bozo"
            message="Mwahahahahah! I appeared at $xx1, $yy1!"
        [/message]
    [/event]

    [item]
        x,y=4,4
        image="items/orcish-flag.png"
    [/item]
    [label]
        x,y=10,9
        text="Let's fight"
    [/label]

    [event]
        name=moveto
        first_time_only=no
        [filter]
            x=10
            y=9
            side=1
        [/filter]
        [animate_unit]
            flag=attack
            hits=hit
            [primary_attack]
            [/primary_attack]
        [/animate_unit]
    [/event]
    [label]
        x,y=4,4
        text="Open, Sesame!"
    [/label]
    [label]
        x,y=5,8
        text="Let there be fog!"
    [/label]

    [event]
        name=moveto
        first_time_only=no
        [filter]
            x=5
            y=8
            side=1
        [/filter]
        [store_side]
            side=1
            variable=side1_store
        [/store_side]
        [if]
            [variable]
                name=side1_store.fog
                equals="no"
            [/variable]
            [then]
                [modify_side]
                    side=1
                    fog=yes
                [/modify_side]
                [redraw][/redraw]
                [label]
                    x,y=5,8
                    text="Torches, attack!"
                [/label]
            [/then]
            [else]
                [modify_side]
                    side=1
                    fog=no
                [/modify_side]
                [redraw][/redraw]
                [label]
                    x,y=5,8
                    text="Let there be fog!"
                [/label]
            [/else]
        [/if]
        {CLEAR_VARIABLE side1_store}
    [/event]

    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            x=4
            y=4
        [/filter]
        [terrain]
            x=1,2
            y=2,2
            terrain=Re
        [/terrain]
        [label]
            x,y=2,2
            text="Math test"
        [/label]
        [event]
            name=moveto
            first_time_only=no
            [filter]
                side=1
                x,y=2,2
            [/filter]
            [message]
                speaker=narrator
                image=wesnoth-icon.png
                message="Enter a number."
                [text_input]
                    variable=number
                    text=0
                [/text_input]
            [/message]
            [message]
                speaker=narrator
                message="What should we do with the number $number|?"
                [option]
                    message="Round it"
                    [command]
                        [message]
                            speaker=narrator
                            image=wesnoth-icon.png
                            message="How should we round $number|?
`(any integer)
`ceil
`floor"
                            [text_input]
                                variable=round
                            [/text_input]
                        [/message]
                        {VARIABLE rounded $number}
                        [set_variable]
                            name=rounded
                            round=$round
                        [/set_variable]
                        [message]
                            speaker=narrator
                            image=wesnoth-icon.png
                            message="Rounding $number| to $round| results in $rounded|."
                        [/message]
                    [/command]
                [/option]
                [option]
                    message="Add something"
                    [command]
                        [message]
                            speaker=narrator
                            [text_input]
                                label="Amount to add"
                                variable=amount
                            [/text_input]
                        [/message]
                        {VARIABLE total $number}
                        [set_variable]
                            name=total
                            add=$amount
                        [/set_variable]
                        [message]
                            speaker=narrator
                            message="Adding $amount| to $number| results in $total|."
                        [/message]
                    [/command]
                [/option]
                [option]
                    message="Multiply"
                    [command]
                        [message]
                            speaker=narrator
                            [text_input]
                                label="Amount to multiply"
                                variable=amount
                            [/text_input]
                        [/message]
                        {VARIABLE total $number}
                        [set_variable]
                            name=total
                            multiply=$amount
                        [/set_variable]
                        [message]
                            speaker=narrator
                            message="$number| * $amount| = $total|."
                        [/message]
                    [/command]
                [/option]
                [option]
                    message="Divide by something"
                    [command]
                        [message]
                            speaker=narrator
                            [text_input]
                                label="Divisor"
                                variable=divisor
                            [/text_input]
                        [/message]
                        {VARIABLE total $number}
                        [set_variable]
                            name=total
                            divide=$divisor
                        [/set_variable]
                        [message]
                            speaker=narrator
                            message="Dividing $number| by $divisor| results in $total|."
                        [/message]
                    [/command]
                [/option]
                [option]
                    message="Modulo"
                    [command]
                        [message]
                            speaker=narrator
                            [text_input]
                                label="Modulo"
                                variable=modulo
                            [/text_input]
                        [/message]
                        {VARIABLE total $number}
                        [set_variable]
                            name=total
                            modulo=$modulo
                        [/set_variable]
                        [message]
                            speaker=narrator
                            message="$number| % $modulo| = $total|."
                        [/message]
                    [/command]
                [/option]
                [option]
                    message="ints&amp;floats"
                    [command]
                        [set_variable]
                            name=int
                            ipart=$number
                        [/set_variable]
                        {VARIABLE_OP float fpart $number}
                        [message]
                            speaker=narrator
                            message="$number| = $int| + $float|"
                        [/message]
                    [/command]
                [/option]
            [/message]
        [/event]
        [label]
            x,y=1,2
            text="Crash test"
        [/label]
        [event]
            name=moveto
            [filter]
                x,y=1,2
            [/filter]
            {VARIABLE_OP unset0 round 0}
            {VARIABLE_OP unset1 multiply 5}
            {VARIABLE_OP unset2 add 3}
            {VARIABLE_OP unset3 fpart unset4}
            {VARIABLE_OP unset5 value 3}
            {VARIABLE_OP unset6 string_length unset7}
            {VARIABLE new_var "$($unset_var1+$unset_var2)"}
            {VARIABLE new_var "$($unset_var1/$unset_var2)"}
            {VARIABLE new_var "$($unset_var1*$unset_var2)"}
        [/event]
    [/event]

    [item]
        x,y=8,5
        image="items/orcish-flag.png"
    [/item]
    [label]
        x,y=8,5
        text="Reveal the Way"
    [/label]

    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            x=8
            y=5
        [/filter]
        [remove_shroud]
            side=1
            x="0-38"
            y="0-20"
        [/remove_shroud]
    [/event]

    [item]
        x,y=12,6
        image="terrain/color-hex.png~RC(red>purple)~RC(blue>black)"
    [/item]
    [label]
        x,y=12,6
        text="change coloring"
    [/label]

    [color_range]
        id=blonde
        rgb=255,255,0,255,255,128,0,0,0
    [/color_range]
    [color_palette]
        thief=133,167,202,73,102,151,215,240,240,185,206,228,41,61,95,97,124,171
    [/color_palette]
    [event]
        name=prerecruit
        first_time_only=no
        [filter]
            type="Thief"
        [/filter]
        {RANDOM "RC(thief>red)","RC(thief>green)","RC(thief>blue)","RC(thief>blonde)","RC(thief>mauve_troll)","NOP()"}
        [object]
            silent=yes
            [effect]
                apply_to=image_mod
                replace=$random
            [/effect]
        [/object]
    [/event]

    [color_range]
        id=mauve_troll
        rgb=ED6F9B,C63567,380113
    [/color_range]
    [color_range]
        id=aqua_troll
        rgb=7AA09A,3B765F,002121
    [/color_range]
    [color_range]
        id=green_troll
        rgb=869280,466546,001715
    [/color_range]
    [color_range]
        id=grey_troll
        rgb=7E808B,3E5451,00101A
    [/color_range]

    [color_palette]
        troll_skin=A8A8A8,747F73,616153,374336,172830,9A9A9A,999999,596F60,596E5F,4E4F3F,4E5040,4D4F3F,1E3325,1F3325,001B22,001A21
    [/color_palette]

    [event]
        name=prerecruit
        first_time_only=no
        [filter]
            type="Troll Whelp"
        [/filter]

        [fire_event]
            [primary_unit]
                x,y=$x1,$y1
            [/primary_unit]
            name=apply_troll_skin
        [/fire_event]
    [/event]

    [event]
        name=apply_troll_skin
        first_time_only=no
        {RANDOM "RC(troll_skin>mauve_troll)","RC(troll_skin>aqua_troll)","RC(troll_skin>aqua_troll)","RC(troll_skin>green_troll)","RC(troll_skin>grey_troll)","NOP()"}
        [object]
            silent=yes
            [filter]
                x=$x1
                y=$y1
            [/filter]
            [effect]
                apply_to=image_mod
                replace=$random
            [/effect]
        [/object]
    [/event]

    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            x=12
            y=6
            type="Thief"
        [/filter]
        [object]
            id=bleach
            name= "Potion of bleach"
            image=items/potion-red.png
            duration=level
            description="Oooh tingly!!!"
            [effect]
                apply_to=image_mod
                add="RC(thief>blonde)"

                [color_palette]
                    thief=133,167,202,73,102,151,215,240,240,185,206,228,41,61,95,97,124,171
                [/color_palette]
            [/effect]
        [/object]
    [/event]

    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            x=12
            y=6
            [not]
                type="Thief"
            [/not]
        [/filter]
        [message]
            speaker=narrator
            image=portraits/elves/captain.png
            message="Send me a thief to spy on the blondes"
        [/message]
    [/event]

    [item]
        x,y=8,7
        image="items/chest-plain-closed.png"
    [/item]
    [label]
        x,y=8,7
        text="BOOM!"
    [/label]

    [event]
        name="moveto"
        first_time_only=no
        [filter]
            x,y=8,7
        [/filter]
        [terrain]
            x="7,9"
            y="7,7"
            terrain="Gg"
        [/terrain]
    [/event]

    [item]
        x,y=9,3
        image="items/gohere.png"
    [/item]
    [label]
        x,y=9,3
        text="Win"
    [/label]
    [label]
        x,y=7,3
        text="Timeshift"
    [/label]

    [label]
        x,y=14,9
        text="The silly dance"
    [/label]
    [event]
        name="moveto"
        first_time_only=no
        [filter]
            x,y=14,9
        [/filter]
        [animate_unit]
        [/animate_unit]
        [allow_undo]
        [/allow_undo]
    [/event]

    [event]
        name="moveto"
        first_time_only=no
        [filter]
            x,y=9,3
        [/filter]
        {VARIABLE endlevel_test.result "victory"}
        {VARIABLE endlevel_test.bonus "yes"}
        [insert_tag]
            name=endlevel
            variable=endlevel_test
        [/insert_tag]
    [/event]
    [event]
        name="moveto"
        first_time_only=no
        [filter]
            x,y=7,3
        [/filter]
        [message]
            speaker=narrator
            image=wesnoth-icon.png
            message="Message 1 of 2: prepare for timeshift"
        [/message]
        [end_turn]
        [/end_turn]
        [message]
            speaker=narrator
            image=wesnoth-icon.png
            message="Message 2 of 2: timeshift imminent"
        [/message]
    [/event]

    [event]
        name=start

        [unit]
            side=1
            x,y="recall","recall"
            type=Lich
        [/unit]

        [unit]
            side=1
            x,y="recall","recall"
            type=Arch Mage
        [/unit]

        [unit]
            side=1
            x,y="recall","recall"
            type=Ancient Wose
        [/unit]
    [/event]

    [terrain_graphics]
        x,y=13,13
        map="
, *
*,  *
, 1
*,  *
, *"

        [tile]
            pos=1
            type=*
        [/tile]
        [image]
            name="forest"
            position=vertical
            base=90,144
        [/image]
    [/terrain_graphics]

    [label]
        x,y=15,15
        text="This is not a forest"
    [/label]

    [label]
        x,y = 25,6
        text = "Let it snow"
    [/label]

    [event]
        # When moving to the specified coordinates,
        # the area will be transformed to a snow landscape,
        # but the water area should remain as is.
        name="moveto"
        first_time_only=yes
        [filter]
            x,y=25,6
        [/filter]

        [terrain_mask]
            x,y=20,1
#wmlindent: start ignoring
            mask="usage=mask

_s, _s, _s, _s, Aa, Aa, _s, _s, _s, _s 
_s, _s, _s, Aa, Aa, Aa, Aa, _s, _s, _s 
_s, _s, Aa, Aa, Aa, Aa, Aa, Aa, _s, _s 
_s, Aa, Aa, Aa, Aa, Aa, Aa, Aa, Aa, _s 
Aa, Aa, Aa, Aa, Aa, Aa, Aa, Aa, Aa, Aa 
Aa, Aa, Aa, Aa, Aa, Aa, Aa, Aa, Aa, Aa 
_s, Aa, Aa, Aa, Aa, Aa, Aa, Aa, Aa, _s 
_s, _s, Aa, Aa, Aa, Aa, Aa, Aa, _s, _s 
_s, _s, _s, Aa, Aa, Aa, Aa, _s, _s, _s 
_s, _s, _s, _s, Aa, Aa, _s, _s, _s, _s 
"
#wmlindent: stop ignoring
            [rule]
                old=Gg^Vh
                new=Aa
                terrain=Aa^Vha
            [/rule]
            [rule]
                old=Gs^Fp
                new=Aa
                terrain=Aa^Fpa
            [/rule]
            [rule]
                old=Hh
                new=Aa
                terrain=Hh
            [/rule]
            [rule]
                old=Gg, Re, Ggf
                new=Aa
                # Don't specify terrain and it just uses the new terrain
            [/rule]
            # default: Will match everything, since 'old' and 'new' aren't specified.
            # Set 'use_old=yes' to signal no change.
            [rule]
                use_old=yes
            [/rule]
        [/terrain_mask]
    [/event]

    [label]
        x,y = 9,13
        text = "Plant palms"
    [/label]

    [event]
        # Replace all trees with tropic forest but leave the base terrain intact
        name="moveto"
        first_time_only=yes
        [filter]
            x,y=9,13
        [/filter]

        [terrain_mask]
            x,y=8,11
#wmlindent: start ignoring
            mask="usage=mask

^Ft, ^Ft, ^Ft, ^Ft
^Ft, ^Ft, ^Ft, ^Ft
^Ft, ^Ft, ^Ft, ^Ft
^Ft, ^Ft, ^Ft, ^Ft
"
#wmlindent: stop ignoring
            [rule]
                old=*^F*
                layer=overlay
            [/rule]
            # default: Will match everything, since 'old' and 'new' aren't specified.
            # Set 'use_old=yes' to signal no change.
            [rule]
                use_old=yes
            [/rule]
        [/terrain_mask]
        [terrain]
            x=12
            y=12
            terrain=Aa^Ft
            layer=overlay
        [/terrain]
    [/event]

    [label]
        x,y = 10,13
        text = "Flood"
    [/label]
    [event]
        # replace the base terrain while leaving the overlay intact
        name="moveto"
        first_time_only=yes
        [filter]
            x,y=10,13
        [/filter]

        [terrain_mask]
            x,y=8,11
#wmlindent: start ignoring
            mask="usage=mask

Ww, Ww, Ww, Ww
Ww, Ww, Ww, Ww
Ww, Ww, Ww, Ww
Ww, Ww, Ww, Ww
"
#wmlindent: stop ignoring
            [rule]
                old=*^Ve*
                layer=base
            [/rule]
            [rule]
                layer=base
                replace_if_failed=true  # if just replacing the base failed, replace the whole terrain
                # this will make the human village disappear.
            [/rule]
            # default: Will match everything, since 'old' and 'new' aren't specified.
            # Set 'use_old=yes' to signal no change.
            [rule]
                use_old=yes
            [/rule]
        [/terrain_mask]
        [terrain]
            x=12
            y=12
            terrain=Ds
            layer=base
        [/terrain]

        [label]
            x,y = 11,14
            text = "Sunken"
        [/label]
        [label]
            x,y = 10,14
            text = "Still there"
        [/label]
    [/event]

    [event]
        name=start
        [set_menu_item]
            id=test0
            description="Perform Calculation"
            [filter_location]
                [filter]
                    has_weapon=missile
                [/filter]
            [/filter_location]
            [command]
                [message]
                    speaker=unit
                    message="I will prepare the incantation; what dost thou desire to know?"
                    [text_input]
                        label="Formula="
                        variable="formula"
                    [/text_input]
                [/message]
                [message]
                    speaker=narrator
#wmlindent: start ignoring
                    message="Formula:
#    $formula
Result:
@    $(debug_print( 'Result: ', ($formula) ))
"
#wmlindent: stop ignoring
                [/message]
            [/command]
        [/set_menu_item]
        [set_menu_item]
            id=test1
            description="Summon Troll"
            [show_if]
                [not]
                    [have_unit]
                        x,y=$x1,$y1
                    [/have_unit]
                [/not]
            [/show_if]
            [filter_location]
            [/filter_location]
            [command]
                {NAMED_LOYAL_UNIT $side_number (Troll) $x1 $y1 (MagicTroll) ("Magic Troll")}
                [fire_event]
                    name=apply_troll_skin
                    [primary_unit]
                        x=$x1
                        y=$y1
                    [/primary_unit]
                [/fire_event]
                [sound]
                    name=magic-holy-miss-3.ogg
                [/sound]
            [/command]
        [/set_menu_item]
        [set_menu_item]
            id=test2
            image="buttons/group_all.png"
            description="Dismiss Troll"
            [show_if]
                [have_unit]
                    x,y=$x1,$y1
                    type=Troll
                    side=$side_number
                [/have_unit]
            [/show_if]
            [command]
                [kill]
                    x,y=$x1,$y1
                    animate=yes
                [/kill]
            [/command]
        [/set_menu_item]
    [/event]

    [label]
        x,y=10,10
        text="Keep out!!!"
    [/label]

    [event]
        name=moveto
        first_time_only=no
        [filter]
            x,y=10, 10
        [/filter]
        [deprecated_message]
            message="Moving to this location is no longer supported... bye bye"
        [/deprecated_message]
        [kill]
            x,y=10,10
            animate=yes
        [/kill]
    [/event]

    [label]
        x,y=7,10
        text="Earn 100 XP!"
    [/label]

    [event]
        name=moveto
        first_time_only=no
        [filter]
            x=7
            y=10
        [/filter]
        {VARIABLE_OP unit.experience add 100}
        [unstore_unit]
            variable=unit
            text="100 XP"
            red,green,blue=200,200,50
        [/unstore_unit]
    [/event]

    [label]
        x,y=7,11
        text="test anim"
    [/label]

    [event]
        name=moveto
        first_time_only=no
        [filter]
            x=7
            y=11
        [/filter]
        [object]
            [effect]
                apply_to=new_attack
                name=ruby of fire
                description="ruby 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
                [standing_anim]
                    alpha=0.0~1.0

                    [frame]
                        begin=-2000
                        end=0
                    [/frame]
                [/standing_anim]
            [/effect]
        [/object]
    [/event]

    [label]
        x,y=5,5
        text="promotions"
    [/label]

    [event]
        name=moveto
        first_time_only=no
        [filter]
            x=5
            y=5
        [/filter]
        {ADVANCE_UNIT x,y=5,5 (Grand Marshal,Yeti,Fire Dragon) }
    [/event]

    [label]
        x,y=5,6
        text="role test"
    [/label]
    [event]
        name=moveto
        first_time_only=no
        [filter]
            x,y=5,6
        [/filter]
        [role]
            x,y=5,6
            role=talking_guy
        [/role]
        [message]
            role=talking_guy
            message="I have the role!"
        [/message]
    [/event]

    [label]
        x,y=32,3
        text="forfeit"
    [/label]
    [event]
        name=moveto
        [filter]
            x,y=32,3
        [/filter]
        [event]
            name=new turn
            first_time_only=no
            [end_turn]
            [/end_turn]
        [/event]
        [message]
            side=2
            message="No more turns for you!"
        [/message]
        [end_turn]
        [/end_turn]
    [/event]

    [label]
        x,y=10,2
        text="map change"
    [/label]

    [event]
        name=moveto
        first_time_only=no
        [filter]
            x,y=10,2
        [/filter]
        [message]
            side=2
            message="Suddenly, Elves Besieged!"
        [/message]
        [replace_map]
            map="{campaigns/Heir_To_The_Throne/maps/01_The_Elves_Besieged.map}"
            shrink=yes
            expand=yes
        [/replace_map]
    [/event]

    [label]
        x,y=10,3
        text="map change2"
    [/label]

    [event]
        name=moveto
        first_time_only=no
        [filter]
            x,y=10,3
        [/filter]
        [message]
            side=2
            message="Suddenly, Blackwater Port!"
        [/message]
        [replace_map]
            map="{campaigns/Heir_To_The_Throne/maps/02_Blackwater_Port.map}"
            shrink=yes
            expand=yes
        [/replace_map]
    [/event]

    # Capture connected villages near 13,2 for team 2
    [event]
        name=prestart

        [store_locations]
            x,y=13,2
            radius=2
            [filter_radius]
                terrain=*^V*
            [/filter_radius]
            variable=temp_villages_area
        [/store_locations]

        {FOREACH temp_villages_area i}
            [capture_village]
                side=2
                x,y=$temp_villages_area[$i].x,$temp_villages_area[$i].y
            [/capture_village]
        {NEXT i}

        # Then put goblins on the northernmost villages

        [store_locations]
            find_in=temp_villages_area
            y=1
            variable=temp_villages_area
        [/store_locations]

        [lua]
            code = <<
                local helper = wesnoth.require "lua/helper.lua"
                for i, v in ipairs(helper.get_variable_proxy_array "temp_villages_area") do
                    wesnoth.put_unit(v.x, v.y, { type = "Goblin Spearman", side = 2 })
                end
                wesnoth.set_variable "temp_villages_area"
            >>
        [/lua]
    [/event]

    [event]
        name=prestart
        [label]
            x,y=2,11
            text="Fogged oasis"
            visible_in_fog=yes
        [/label]
    [/event]

    [event]
        name=prestart
        [label]
            x,y=2,14
            text="Shrouded label"
            visible_in_shroud=yes
        [/label]
    [/event]
#define DYNAMIC_EVENT_SETUP TYPE VAR
    [set_variables]
        name={VAR}
        [literal]
            name={TYPE}
            [set_variable]
                name={VAR}
                add=1
            [/set_variable]
            [message]
                id=statue
                message="dynamic " + {TYPE} + " event ${VAR}|!"
                [option]
                    message="Continue!"
                [/option]
                [option]
                    message="Stop annoying me..."
                    [command]
                        [set_variables]
                            name={VAR}
                            mode=replace
                            [value]
                                name=moveto
                                [filter]
                                    side=1
                                    [filter_location]
                                        radius=1
                                        [filter]
                                            id=statue
                                        [/filter]
                                    [/filter_location]
                                [/filter]
                                [message]
                                    id=statue
                                    message="No more dynamic events! Sorry..."
                                [/message]
                            [/value]
                        [/set_variables]
                        {MODIFY_UNIT id=statue status.petrified true}
                    [/command]
                [/option]
            [/message]
            [insert_tag]
                name=event
                variable={VAR}
            [/insert_tag]
        [/literal]
    [/set_variables]
#enddef

    [event]
        name=prestart
        [set_menu_item]
            id=dynamic_ev
            description="Start Dynamic Events!"
            [filter_location]
                [filter]
                    id=statue
                [/filter]
            [/filter_location]
            [command]
                {DYNAMIC_EVENT_SETUP "new turn" ev}
                [insert_tag]
                    name=event
                    variable=ev
                [/insert_tag]
                [set_menu_item]
                    id=dynamic_ev
                    [show_if]
                        [not]
                        [/not]
                    [/show_if]
                [/set_menu_item]
                [unpetrify]
                    id=statue
                [/unpetrify]
            [/command]
        [/set_menu_item]

#define SHOW_IMAGE_PATH_TEST FUNCTOR_AND_PARAMS
    [set_variable]
        name=functor
        value={FUNCTOR_AND_PARAMS}
    [/set_variable]
    [scroll_to_unit]
        check_fogged=yes
        id=Urug-Telfar
    [/scroll_to_unit]
    [message]
        speaker=narrator
        image="units/orcs/warlord.png~RC(magenta>blue)~$functor"
        message="I have been affected by the power of $functor|! To the Dark Gods with that wose-born creature!"
        caption=Urug-Telfar
    [/message]
    [scroll_to_unit]
        x,y=$x1,$y1
    [/scroll_to_unit]
    [clear_variable]
        name=functor
    [/clear_variable]
#enddef
        [set_menu_item]
            id=imagepath_tests
            description="Image tricks"
            [filter_location]
                [filter]
                    type=Elvish Shyde,Elvish Druid,Elvish Sorceress,Elvish Enchantress,Elvish Sylph,Elvish Shaman
                [/filter]
            [/filter_location]
            [command]
                [message]
                    speaker=unit
                    message="What glamour should I cast upon our foe?"
                    [option]
                        message="Flip around!"
                        [command]
                            {SHOW_IMAGE_PATH_TEST "FL(horiz,vert)"}
                        [/command]
                    [/option]
                    [option]
                        message="Scale up"
                        [command]
                            {SHOW_IMAGE_PATH_TEST "SCALE(200,200)"}
                        [/command]
                    [/option]
                    [option]
                        message="Scale down"
                        [command]
                            {SHOW_IMAGE_PATH_TEST "SCALE(40,40)"}
                        [/command]
                    [/option]
                    [option]
                        message="Blur 3"
                        [command]
                            {SHOW_IMAGE_PATH_TEST "BL(3)"}
                        [/command]
                    [/option]
                    [option]
                        message="More red!"
                        [command]
                            {SHOW_IMAGE_PATH_TEST "R(255)"}
                        [/command]
                    [/option]
                    [option]
                        message="More green!"
                        [command]
                            {SHOW_IMAGE_PATH_TEST "G(255)"}
                        [/command]
                    [/option]
                    [option]
                        message="More blue!"
                        [command]
                            {SHOW_IMAGE_PATH_TEST "B(255)"}
                        [/command]
                    [/option]
                    [option]
                        message="Black and white!"
                        [command]
                            {SHOW_IMAGE_PATH_TEST "GS()"}
                        [/command]
                    [/option]
                    [option]
                        message="Other team"
                        [command]
                            {VARIABLE_OP team rand 1..9}
                            {SHOW_IMAGE_PATH_TEST "TC($team,magenta)"}
                            {CLEAR_VARIABLE team}
                        [/command]
                    [/option]
                    [option]
                        message="And other team again"
                        [command]
                            {VARIABLE_OP rc rand 1..9}
                            {SHOW_IMAGE_PATH_TEST "RC(magenta>$rc)"}
                            {CLEAR_VARIABLE rc}
                        [/command]
                    [/option]
                    [option]
                        message="Psychedellic!"
                        [command]
                            {SHOW_IMAGE_PATH_TEST "CROP(10,10,50,50)~CS(255,-40,100)~O(50%)~BL(2)~SCALE(125,125)"}
                        [/command]
                    [/option]
                    [option]
                        message="Shrooms!"
                        [command]
                            # Shutz, this sounds like some obscure CPU architecture's data registers
                            {VARIABLE_OP rc   rand 1..9}
                            {VARIABLE_OP cs.r rand 0..255}
                            {VARIABLE_OP cs.g rand 0..255}
                            {VARIABLE_OP cs.b rand 0..255}
                            {VARIABLE_OP op   rand 25%,50%,75%,100%,125%,150%,175%,200%,225%,250%,275%,300%,500%}
                            {VARIABLE_OP bl   rand 1..10}
                            {VARIABLE_OP sc.w rand 50..200}
                            {VARIABLE_OP sc.h rand 50..200}

                            {SHOW_IMAGE_PATH_TEST "RC(magenta>$rc|)~CS($cs.r|,$cs.g|,$cs.b|)~O($op)~BL($bl)~SCALE($sc.w|,$sc.h|)"}

                            {CLEAR_VARIABLE rc,cs,op,bl,sc}
                        [/command]
                    [/option]
                [/message]
            [/command]
        [/set_menu_item]
#undef SHOW_IMAGE_PATH_TEST
    [/event]
    [event]
        #at an attack end, remove the attack: bugs #12428 and #12990
        name=attack end
        first_time_only=no
        [filter_attack]
            range=ranged
        [/filter_attack]
        [filter_second]
            side=2
            canrecruit=yes
        [/filter_second]
        [object]
            [filter]
                x,y=$x1,$y1
            [/filter]
            description="You just lost the attack you used."
            silent=yes
            [effect]
                apply_to=remove_attacks
                range=ranged
            [/effect]
            [then]
                [message]
                    canrecruit,side=yes,2
                    message="Cowards! Fight me in real combat!"
                [/message]
            [/then]
        [/object]
    [/event]
    [event]
        name=prestart
        [unit]
            type=Saurian Soothsayer
            side,x,y=3,30,15
            id=assert
            name="Neutral healer guy"
        [/unit]
    [/event]
[/test]

# vim: tabstop=4: shiftwidth=4: expandtab: softtabstop=4: autoindent:
# kate: indent-mode normal; space-indent on;
