#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]

            {VARIABLE finished no}
            [while]
                {CONDITION finished equals no}
                [do]
# wmlindent: start ignoring
            [message]
                speaker=unit
#wmllint: display on
                message= _ "What shall I do my liege?"
#wmllint: display off

[option]
message= _ "Nothing"
    [command]
        {VARIABLE finished yes}
    [/command]
[/option]

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

# Convert to grassland

[option]
message= {MENU_IMG_TXT2 "terrain/flat/grass-r8.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}
        {PLAY_SOUND ("dagger-swish.wav")}
    [/command]
[/option]

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

# Plant Farm

[option]
message= {MENU_IMG_TXT2 "terrain/flat/farm-veg-spring-icon.png" ("<span color='green'>" + _"Plant Farm" + "</span>") ("<span size='small'>" +_"Cost: 0g" + "</span>")}
    {ANL_SHOW_IF ("Peasant") "Gg,Gs,Ggf"}
    [command]
        {COMPLETE_ACTION 0}
        {MODIFY_TERRAIN Re $x1 $y1}
        {PLAY_SOUND ("entangle.wav")}
    [/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,Ggf"}
    [command]
        [if]
        {CONDITION worker.gold greater_than_equal_to 15}
        [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,Ggf"}
    [command]
        [if]
        {CONDITION worker.gold greater_than_equal_to 6}
        [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.png" ("<span color='green'>" + _"Flood the Field" + "</span>") ("<span size='small'>" +_"Cost: 4g" + "</span>")}
    {ANL_SHOW_IF ("Peasant") "Gg,Gs,Ggf"}
    [command]
        [if]
        {CONDITION worker.gold greater_than_equal_to 4}
        [then]
            {COMPLETE_ACTION -4}
            {MODIFY_TERRAIN "Ww" $x1 $y1}
            {PLAY_SOUND ("water-blast.wav")}
        [/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,Ggf"}
    [command]
        [if]
        {CONDITION worker.gold greater_than_equal_to 1}
        [then]
            {COMPLETE_ACTION -1}
            {MODIFY_TERRAIN "Gs^Fp" $x1 $y1}
            {PLAY_SOUND ("entangle.wav")}
        [/then]
        [/if]
    [/command]
[/option]

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

# Chop Down Forest

[option]
message= {MENU_IMG_TXT2 "terrain/flat/grass-r8.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]
            {VARIABLE finished yes}
            {VARIABLE unit.status.worked_this_turn yes}
            {VARIABLE unit.moves 0}
            {ADD_GOLD $side_number 1}
            {PLAY_SOUND ("dagger-swish.wav")}
            {DELAY 250}
            {PLAY_SOUND ("axe.ogg")}
            {DELAY 150}
            {PLAY_SOUND ("wose-die.ogg")}
            {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]
        {CONDITION worker.gold greater_than_equal_to 25}
        [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]
        {CONDITION worker.gold greater_than_equal_to 25}
        [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]
        {CONDITION worker.gold greater_than_equal_to 3}
        [then]
            {COMPLETE_ACTION (-3)}
            {DELAY 200}
            {PLAY_SOUND ("dagger-swish.wav")}
            {MODIFY_TERRAIN "Wwf" $x1 $y1}
        [/then]
        [/if]
    [/command]
[/option]

# Landfill

[option]
message= {MENU_IMG_TXT2 "terrain/flat/grass-r8.png" ("<span color='green'>" + _"Landfill" + "</span>") ("<span size='small'>" +_"Cost: 5g" + "</span>")}
    {ANL_SHOW_IF ("Peasant") "Ww"}
    [command]
        [if]
        {CONDITION worker.gold greater_than_equal_to 5}
        [then]
            {COMPLETE_ACTION (-5)}
            {DELAY 200}
            {PLAY_SOUND ("claws.ogg")}
            {MODIFY_TERRAIN "Gg" $x1 $y1}
        [/then]
        [/if]
    [/command]
[/option]

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

# Destroy the Ford

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

# Landfill

[option]
message= {MENU_IMG_TXT2 "terrain/flat/grass-r8.png" ("<span color='green'>" + _"Landfill" + "</span>") ("<span size='small'>" +_"Cost: 1g" + "</span>")}
    {ANL_SHOW_IF ("Peasant") "Wwf"}
    [command]
        [if]
        {CONDITION worker.gold greater_than_equal_to 1}
        [then]
            {COMPLETE_ACTION (-1)}
            {DELAY 200}
            {PLAY_SOUND ("claws.ogg")}
            {MODIFY_TERRAIN "Gg" $x1 $y1}
        [/then]
        [/if]
    [/command]
[/option]

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

# Break Up Cave

[option]
message= {MENU_IMG_TXT2 "terrain/flat/grass-r8.png" ("<span color='green'>" + _"Smash Cave Floor" + "</span>") ("<span size='small'>" +_"Cost: 2g" + "</span>")}
    {ANL_SHOW_IF ("Peasant") "Uu,Uu^Ii"}
    [command]
        [if]
        {CONDITION worker.gold greater_than_equal_to 2}
        [then]
            {COMPLETE_ACTION (-2)}
            {PLAY_SOUND ("claws.ogg")}
            {MODIFY_TERRAIN "Gg" $x1 $y1}
        [/then]
        [/if]
    [/command]
[/option]

# Convert Cave To Hills

[option]
message= {MENU_IMG_TXT2 "terrain/hills-variation2.png" ("<span color='green'>" + _"Smash Cave Floor" + "</span>") ("<span size='small'>" +_"Cost: 3g" + "</span>")}
    {ANL_SHOW_IF ("Peasant") "Uh,Uh^Ii"}
    [command]
        [if]
        {CONDITION worker.gold greater_than_equal_to 3}
        [then]
            {COMPLETE_ACTION (-3)}
            {PLAY_SOUND ("claws.ogg")}
            {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]
            {VARIABLE finished yes}
            {VARIABLE unit.status.worked_this_turn yes}
            {VARIABLE unit.moves 0}
            {ADD_GOLD $side_number 3}
            {PLAY_SOUND ("dagger-swish.wav")}
            {DELAY 250}
            {PLAY_SOUND ("axe.ogg")}
            {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]
        {CONDITION worker.gold greater_than_equal_to 6}
        [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]
        {CONDITION worker.gold greater_than_equal_to 7}
        [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/flat/grass-r8.png" ("<span color='green'>" + _"Clear the Ground" + "</span>") ("<span size='small'>" +_"Cost: 0g" + "</span>")}
    {ANL_SHOW_IF ("Peasant") "Rd"}
    [command]
            {COMPLETE_ACTION (-0)}
            {DELAY 200}
            {PLAY_SOUND ("claws.ogg")}
            {MODIFY_TERRAIN "Gg" $x1 $y1}
            {REMOVE_ITEM $x1 $y1}
    [/command]
[/option]

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

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