#textdomain wesnoth-anl

#define WORKER_OPTIONS TYPES
    [set_menu_item]
        id=anl_get_to_work
        description= _ "Get to Work!"
        [show_if]
            [have_unit]
                side=$side_number
                x,y=$x1,$y1
                type={TYPES}
                [not]
                    [filter_wml]
                        [status]
                            worked_this_turn=yes
                        [/status]
                    [/filter_wml]
                [/not]
            [/have_unit]
        [/show_if]
        [command]
            [store_side]
                side=$side_number
                variable=worker
            [/store_side]

            [store_unit]
                [filter]
                    x=$x1
                    y=$y1
                [/filter]
                variable=unit
            [/store_unit]

            [set_variable]
                name=finished
                value=no
            [/set_variable]
            [while]
                [variable]
                    name=finished
                    equals=no
                [/variable]

                [do]
# wmlindent: start ignoring
            [message]
                speaker=unit
# wmllint: display on
                message= _ "What shall I do my liege?"
# wmllint: display off

[option]
message= _ "Nothing"
    [command]
        [set_variable]
            name=finished
            value=yes
        [/set_variable]
    [/command]
[/option]

# ----------------------------------------------
# FARMLAND

# Convert to grassland

[option]
message= {MENU_IMG_TXT2 "terrain/grass/green6.png" ("<span color='green'>" + _ "Convert to Grassland" + "</span>") ("<span size='small'>" + _ "Cost: 0g" + "</span>")}
    {ANL_SHOW_IF ("Peasant") "Re"}
    [command]
        {COMPLETE_ACTION 0}
        {MODIFY_TERRAIN Gg $x1 $y1}
            [sound]
                name=dagger-swish.wav
            [/sound]
    [/command]
[/option]

# ----------------------------------------------
# GRASSLAND

# Plant Farm

[option]
message= {MENU_IMG_TXT2 "terrain/embellishments/farm-veg-spring-icon.png" ("<span color='green'>" + _ "Plant Farm" + "</span>") ("<span size='small'>" + _ "Cost: 0g" + "</span>")}
    {ANL_SHOW_IF ("Peasant") "Gg,Gs"}
    [command]
        {COMPLETE_ACTION 0}
        {MODIFY_TERRAIN Re $x1 $y1}
            [sound]
                name=entangle.wav
            [/sound]
    [/command]
[/option]

# Build Village

[option]
message= {MENU_IMG_TXT2 "terrain/village/human-tile.png" ("<span color='green'>" + _ "Build Village" + "</span>") ("<span size='small'>" + _ "Cost: 15g" + "</span>")}
    {ANL_SHOW_IF ("Peasant") "Gg,Gs"}
    [command]
        [if]
        [variable]
            name=worker.gold
            greater_than_equal_to=15
        [/variable]

        [then]
            {COMPLETE_ACTION (-15)}
            {MODIFY_TERRAIN "Gg^Vh" $x1 $y1}
            {ANL_CAPTURE_VILLAGE}
            {BUILD_SOUND_1}
        [/then]
        [/if]
    [/command]
[/option]

# Build Castle

[option]
message= {MENU_IMG_TXT2 "terrain/castle/castle-tile.png" ("<span color='green'>" + _ "Build Castle" + "</span>") ("<span size='small'>" + _ "Cost: 6g" + "</span>")}
    {ANL_SHOW_IF ("Peasant") "Gg,Gs"}
    [command]
        [if]
        [variable]
            name=worker.gold
            greater_than_equal_to=6
        [/variable]

        [then]
            {COMPLETE_ACTION (-6)}
            {MODIFY_TERRAIN "Ch" $x1 $y1}
            {BUILD_SOUND_2}
        [/then]
        [/if]
    [/command]
[/option]

# Flood

[option]
message= {MENU_IMG_TXT2 "terrain/water/coast-tile.png" ("<span color='green'>" + _ "Flood the Field" + "</span>") ("<span size='small'>" + _ "Cost: 4g" + "</span>")}
    {ANL_SHOW_IF ("Peasant") "Gg,Gs"}
    [command]
        [if]
        [variable]
            name=worker.gold
            greater_than_equal_to=4
        [/variable]

        [then]
            {COMPLETE_ACTION -4}
            {MODIFY_TERRAIN "Ww" $x1 $y1}
            [sound]
                name=water-blast.wav
            [/sound]
        [/then]
        [/if]
    [/command]
[/option]

# Plant Saplings

[option]
message= {MENU_IMG_TXT2 "terrain/forest/pine-tile.png" ("<span color='green'>" + _ "Plant Saplings" + "</span>") ("<span size='small'>" + _ "Cost: 1g" + "</span>")}
    {ANL_SHOW_IF ("Peasant") "Gg,Gs"}
    [command]
        [if]
        [variable]
            name=worker.gold
            greater_than_equal_to=1
        [/variable]

        [then]
            {COMPLETE_ACTION -1}
            {MODIFY_TERRAIN "Gs^Fp" $x1 $y1}
            [sound]
                name=entangle.wav
            [/sound]
        [/then]
        [/if]
    [/command]
[/option]

# ----------------------------------------------
# FOREST

# Chop Down Forest

[option]
message= {MENU_IMG_TXT2 "terrain/grass/green6.png" ("<span color='green'>" + _ "Chop Down Forest" + "</span>") ("<span size='small'>" + _ "Earns: 1g" + "</span>")}
    {ANL_SHOW_IF ("Peasant") "Gs^Fp,Gs^Ft,Aa^Fpa,Gg^Fet"}
    [command]
            [set_variable]
                name=finished
                value=yes
            [/set_variable]

            [set_variable]
                name=unit.status.worked_this_turn
                value=yes
            [/set_variable]
            [set_variable]
                name=unit.moves
                value=0
            [/set_variable]


            [gold]
                side=$side_number
                amount=1
            [/gold]

            [sound]
                name=dagger-swish.wav
            [/sound]
            [delay]
                time=250
            [/delay]
            [sound]
                name=axe.ogg
            [/sound]
            [delay]
                time=150
            [/delay]
            [sound]
                name=wose-die.ogg
            [/sound]

            {MODIFY_TERRAIN "Gg" $x1 $y1}

            [unstore_unit]
                variable=unit
                text=1 # wmllint: ignore
                red,green,blue=204,204,51
            [/unstore_unit]
    [/command]
[/option]

# ----------------------------------------------
# HILLS

# Build Gold Mine

[option]
message= {MENU_IMG_TXT2 "terrain/village/human-hills-tile.png" ("<span color='green'>" + _ "Build Mine" + "</span>") ("<span size='small'>" + _ "Cost: 25g" + "</span>")}
    {ANL_SHOW_IF ("Peasant") "Hh"}
    [command]
        [if]
        [variable]
            name=worker.gold
            greater_than_equal_to=25
        [/variable]

        [then]
            {COMPLETE_ACTION (-25)}
            {MODIFY_TERRAIN "Hh^Vhh" $x1 $y1}
            {ANL_CAPTURE_VILLAGE}
            {BUILD_SOUND_1}
        [/then]
        [/if]
    [/command]
[/option]

# ----------------------------------------------
# MOUNTAINS

# Build Gold Mine

[option]
message= {MENU_IMG_TXT2 "terrain/village/human-mountain-tile.png" ("<span color='green'>" + _ "Build Mine" + "</span>") ("<span size='small'>" + _ "Cost: 25g" + "</span>")}
    {ANL_SHOW_IF ("Peasant") "Mm"}
    [command]
        [if]
        [variable]
            name=worker.gold
            greater_than_equal_to=25
        [/variable]

        [then]
            {COMPLETE_ACTION (-25)}
            {MODIFY_TERRAIN "Mm^Vhh" $x1 $y1}
            {ANL_CAPTURE_VILLAGE}
            {BUILD_SOUND_1}
        [/then]
        [/if]
    [/command]
[/option]

# ----------------------------------------------
# WATER

# Make a Ford

[option]
message= {MENU_IMG_TXT2 "terrain/water/ford.png" ("<span color='green'>" + _ "Make a Ford" + "</span>") ("<span size='small'>" + _ "Cost: 3g" + "</span>")}
    {ANL_SHOW_IF ("Peasant") "Ww"}
    [command]
        [if]
        [variable]
            name=worker.gold
            greater_than_equal_to=3
        [/variable]

        [then]
            {COMPLETE_ACTION (-3)}
            [delay]
                time=200
            [/delay]
            [sound]
                name=dagger-swish.wav
            [/sound]
            {MODIFY_TERRAIN "Wwf" $x1 $y1}
        [/then]
        [/if]
    [/command]
[/option]

# Landfill

[option]
message= {MENU_IMG_TXT2 "terrain/grass/green6.png" ("<span color='green'>" + _ "Landfill" + "</span>") ("<span size='small'>" + _ "Cost: 5g" + "</span>")}
    {ANL_SHOW_IF ("Peasant") "Ww"}
    [command]
        [if]
        [variable]
            name=worker.gold
            greater_than_equal_to=5
        [/variable]

        [then]
            {COMPLETE_ACTION (-5)}
            [delay]
                time=200
            [/delay]
            [sound]
                name=claws.ogg
            [/sound]
            {MODIFY_TERRAIN "Gg" $x1 $y1}
        [/then]
        [/if]
    [/command]
[/option]

# ----------------------------------------------
# FORD

# Destroy the Ford

[option]
message= {MENU_IMG_TXT2 "terrain/water/coast-tile.png" ("<span color='green'>" + _ "Destroy the Ford" + "</span>") ("<span size='small'>" + _ "Cost: 0g" + "</span>")}
    {ANL_SHOW_IF ("Peasant") "Wwf"}
    [command]
            {COMPLETE_ACTION 0}
            [delay]
                time=200
            [/delay]
            {MODIFY_TERRAIN "Ww" $x1 $y1}
            [sound]
                name=pincers.ogg
            [/sound]
            [delay]
                time=200
            [/delay]
            [sound]
                name=water-blast.wav
            [/sound]
    [/command]
[/option]

# Landfill

[option]
message= {MENU_IMG_TXT2 "terrain/grass/green6.png" ("<span color='green'>" + _ "Landfill" + "</span>") ("<span size='small'>" + _ "Cost: 1g" + "</span>")}
    {ANL_SHOW_IF ("Peasant") "Wwf"}
    [command]
        [if]
        [variable]
            name=worker.gold
            greater_than_equal_to=1
        [/variable]

        [then]
            {COMPLETE_ACTION (-1)}
            [delay]
                time=200
            [/delay]
            [sound]
                name=claws.ogg
            [/sound]
            {MODIFY_TERRAIN "Gg" $x1 $y1}
        [/then]
        [/if]
    [/command]
[/option]

# ----------------------------------------------
# CAVE

# Break Up Cave

[option]
message= {MENU_IMG_TXT2 "terrain/grass/green6.png" ("<span color='green'>" + _ "Smash Cave Floor" + "</span>") ("<span size='small'>" + _ "Cost: 2g" + "</span>")}
    {ANL_SHOW_IF ("Peasant") "Uu,Uu^Ii"}
    [command]
        [if]
        [variable]
            name=worker.gold
            greater_than_equal_to=2
        [/variable]

        [then]
            {COMPLETE_ACTION (-2)}
            [sound]
                name=claws.ogg
            [/sound]
            {MODIFY_TERRAIN "Gg" $x1 $y1}
        [/then]
        [/if]
    [/command]
[/option]

# Convert Cave To Hills

[option]
message= {MENU_IMG_TXT2 "terrain/hills/regular2.png" ("<span color='green'>" + _ "Smash Cave Floor" + "</span>") ("<span size='small'>" + _ "Cost: 3g" + "</span>")}
    {ANL_SHOW_IF ("Peasant") "Uh,Uh^Ii"}
    [command]
        [if]
        [variable]
            name=worker.gold
            greater_than_equal_to=3
        [/variable]

        [then]
            {COMPLETE_ACTION (-3)}
            [sound]
                name=claws.ogg
            [/sound]
            {MODIFY_TERRAIN "Hh" $x1 $y1}
        [/then]
        [/if]
    [/command]
[/option]

# Harvest Cave Mushrooms

[option]
message= {MENU_IMG_TXT2 "terrain/cave/floor.png" ("<span color='green'>" + _ "Harvest Mushrooms" + "</span>") ("<span size='small'>" + _ "Earns: 3g" + "</span>")}
    {ANL_SHOW_IF ("Peasant") "Uu^Uf"}
    [command]
            [set_variable]
                name=finished
                value=yes
            [/set_variable]

            [set_variable]
                name=unit.status.worked_this_turn
                value=yes
            [/set_variable]
            [set_variable]
                name=unit.moves
                value=0
            [/set_variable]

            [gold]
                side=$side_number
                amount=3
            [/gold]

            [sound]
                name=dagger-swish.wav
            [/sound]
            [delay]
                time=250
            [/delay]
            [sound]
                name=axe.ogg
            [/sound]

            {MODIFY_TERRAIN "Uu" $x1 $y1}

            [unstore_unit]
                variable=unit
                text=3 # wmllint: ignore
                red,green,blue=204,204,51
            [/unstore_unit]
    [/command]
[/option]

# ----------------------------------------------
# CASTLE

# Build Keep

[option]
message= {MENU_IMG_TXT2 "terrain/castle/keep-tile.png" ("<span color='green'>" + _ "Build a Keep" + "</span>") ("<span size='small'>" + _ "Cost: 6g" + "</span>")}
    {ANL_SHOW_IF ("Peasant") "Ch,Ce,Cv,Cud,Chr,Chw,Chs"}
    [command]
        [if]
        [variable]
            name=worker.gold
            greater_than_equal_to=6
        [/variable]

        [then]
            {COMPLETE_ACTION (-6)}
            {MODIFY_TERRAIN "Kh" $x1 $y1}
            {BUILD_SOUND_2}
        [/then]
        [/if]
    [/command]
[/option]

# ----------------------------------------------
# VILLAGE

# Establish University

[option]
message= {MENU_IMG_TXT2 "terrain/village/elven-tile.png" ("<span color='green'>" + _ "Establish University" + "</span>") ("<span size='small'>" + _ "Cost: 7g" + "</span>")}
    {ANL_SHOW_IF ("Peasant") "Gg^Vh,Aa^Vha"}
    [command]
        [if]
        [variable]
            name=worker.gold
            greater_than_equal_to=7
        [/variable]

        [then]
            {COMPLETE_ACTION (-7)}
            {MODIFY_TERRAIN "Gg^Ve" $x1 $y1}
            {ANL_CAPTURE_VILLAGE}
            {BUILD_SOUND_2}
        [/then]
        [/if]
    [/command]
[/option]

# ----------------------------------------------
# RUBBLE

# Clear Rubble

[option]
message= {MENU_IMG_TXT2 "terrain/grass/green6.png" ("<span color='green'>" + _ "Clear the Ground" + "</span>") ("<span size='small'>" + _ "Cost: 0g" + "</span>")}
    {ANL_SHOW_IF ("Peasant") "Rd"}
    [command]
            {COMPLETE_ACTION (-0)}
            [delay]
                time=200
            [/delay]
            [sound]
                name=claws.ogg
            [/sound]
            {MODIFY_TERRAIN "Gg" $x1 $y1}
            [remove_item]
                x,y=$x1,$y1
            [/remove_item]
    [/command]
[/option]

[/message]
[/do]
[/while]

[/command]
[/set_menu_item]
#enddef
# wmlindent: stop ignoring
