Remove the limitation of needing at least 1 MP to perform any action.

Test please.
This commit is contained in:
Lari Nieminen 2008-04-26 13:02:52 +00:00
parent 8e0e159142
commit aeffaa05de
6 changed files with 130 additions and 166 deletions

View file

@ -237,7 +237,7 @@
{ALLOW_RECRUIT 2 "Peasant,Mage"}
{ALLOW_RECRUIT 3 "Peasant,Mage"}
{ALLOW_RECRUIT 4 "Peasant,Mage"}
[/event]
[/event]
# Auto-studying
@ -246,16 +246,48 @@
# Research complete messages
[event]
name=side turn
first_time_only=no
[if]
{CONDITION side_number less_than_equal_to 4}
[then]
{FARMING_RESEARCH_COMPLETE}
{MINING_RESEARCH_COMPLETE}
{WARFARE_RESEARCH_COMPLETE}
[/then]
[/if]
name=side turn
first_time_only=no
[if]
{CONDITION side_number less_than_equal_to 4}
[then]
{FARMING_RESEARCH_COMPLETE}
{MINING_RESEARCH_COMPLETE}
{WARFARE_RESEARCH_COMPLETE}
[/then]
[/if]
[/event]
# Remove working status from any working units when starting a turn
[event]
name=side turn
first_time_only=no
[store_unit]
[filter]
side=$side_number
[wml_filter]
[status]
worked_this_turn=yes
[/status]
[/wml_filter]
[/filter]
kill=yes
variable=this_side_workers
[/store_unit]
{FOREACH this_side_workers i}
{CLEAR_VARIABLE this_side_workers[$i].status.worked_this_turn}
[unstore_unit]
variable=this_side_workers[$i]
[/unstore_unit]
{NEXT i}
{CLEAR_VARIABLE this_side_workers}
[/event]
# Auto-working

View file

@ -24,37 +24,23 @@
{VARIABLE sound no}
{FOREACH researchers i}
{VARIABLE_OP idle to_variable "researchers[$i].variables.idle"}
{VARIABLE_OP temp_x format "$researchers[$i].x"}
{VARIABLE_OP temp_y format "$researchers[$i].y"}
[if]
{CONDITION idle equals yes}
[then]
{CLEAR_VARIABLE "researchers[$i].variables.idle"}
{VARIABLE_OP credited_side format $researchers[$i].side}
{VARIABLE_OP amount format $researchers.level}
{ADDING_TO_CURRENT_RESEARCH_FIELD $credited_side| $amount}
[unstore_unit]
variable=researchers[$i]
[/unstore_unit]
[/then]
[else]
{VARIABLE_OP temp_x format "$researchers[$i].x"}
{VARIABLE_OP temp_y format "$researchers[$i].y"}
{VARIABLE sound yes}
{SCROLL_TO $temp_x $temp_y}
{VARIABLE_OP credited_side format $researchers[$i].side}
{VARIABLE_OP amount format $researchers.level}
{ADDING_TO_CURRENT_RESEARCH_FIELD $credited_side| $amount}
{VARIABLE sound yes}
{SCROLL_TO $temp_x $temp_y}
[unstore_unit]
variable=researchers[$i]
text="$amount"
{COLOR_WHITE}
[/unstore_unit]
[/else]
[/if]
[unstore_unit]
variable=researchers[$i]
text="$amount"
{COLOR_WHITE}
[/unstore_unit]
{NEXT i}
[if]
{CONDITION sound equals yes}
[then]
@ -65,7 +51,6 @@
{CLEAR_VARIABLE sound}
{CLEAR_VARIABLE researchers}
{CLEAR_VARIABLE idle}
{CLEAR_VARIABLE amount}
{CLEAR_VARIABLE credited_side}
{REDRAW}
@ -107,39 +92,26 @@
{VARIABLE sound no}
{FOREACH harvesters i}
{VARIABLE_OP idle to_variable "harvesters[$i].variables.idle"}
{VARIABLE_OP temp_x format "$harvesters[$i].x"}
{VARIABLE_OP temp_y format "$harvesters[$i].y"}
[if]
{CONDITION idle equals yes}
[then]
{CLEAR_VARIABLE "harvesters[$i].variables.idle"}
{VARIABLE_OP credited_side format $harvesters[$i].side}
{VARIABLE_OP amount format $player_$credited_side|.farming.gold}
[unstore_unit]
variable=harvesters[$i]
[/unstore_unit]
[/then]
[else]
{VARIABLE_OP temp_x format "$harvesters[$i].x"}
{VARIABLE_OP temp_y format "$harvesters[$i].y"}
# auto-harvest
{ADD_GOLD $credited_side $amount}
{MODIFY_TERRAIN "Re" $temp_x $temp_y}
{REMOVE_ITEM $temp_x $temp_y}
{VARIABLE sound yes}
{SCROLL_TO $temp_x $temp_y}
{VARIABLE_OP credited_side format $harvesters[$i].side}
{VARIABLE_OP amount format $player_$credited_side|.farming.gold}
# auto-harvest
{ADD_GOLD $credited_side $amount}
{MODIFY_TERRAIN "Re" $temp_x $temp_y}
{REMOVE_ITEM $temp_x $temp_y}
{VARIABLE sound yes}
{SCROLL_TO $temp_x $temp_y}
[unstore_unit]
variable=harvesters[$i]
text="$amount"
red,green,blue=204,204,51
[/unstore_unit]
[/else]
[/if]
[unstore_unit]
variable=harvesters[$i]
text="$amount"
red,green,blue=204,204,51
[/unstore_unit]
{NEXT i}
[if]
{CONDITION sound equals yes}
[then]
@ -150,28 +122,20 @@
{VARIABLE sound no}
{FOREACH planters i}
{VARIABLE_OP idle to_variable "planters[$i].variables.idle"}
{VARIABLE_OP temp_x format "$planters[$i].x"}
{VARIABLE_OP temp_y format "$planters[$i].y"}
[if]
{CONDITION idle equals yes}
[then]
{CLEAR_VARIABLE "planters[$i].variables.idle"}
[/then]
[else]
{VARIABLE_OP temp_x format "$planters[$i].x"}
{VARIABLE_OP temp_y format "$planters[$i].y"}
# auto-plant
{MODIFY_TERRAIN "Re^Gvs" $temp_x $temp_y }
{REMOVE_ITEM $temp_x $temp_y}
{SET_IMAGE $temp_x $temp_y ("items/flower4.png")}
{VARIABLE sound yes}
# auto-plant
{MODIFY_TERRAIN "Re^Gvs" $temp_x $temp_y }
{REMOVE_ITEM $temp_x $temp_y}
{SET_IMAGE $temp_x $temp_y ("items/flower4.png")}
{VARIABLE sound yes}
[/else]
[/if]
[unstore_unit]
variable=planters[$i]
[/unstore_unit]
{NEXT i}
[if]
{CONDITION sound equals yes}
[then]
@ -183,7 +147,6 @@
{CLEAR_VARIABLE sound}
{CLEAR_VARIABLE harvesters}
{CLEAR_VARIABLE planters}
{CLEAR_VARIABLE idle}
{CLEAR_VARIABLE amount}
{CLEAR_VARIABLE credited_side}
@ -214,37 +177,24 @@
{VARIABLE sound no}
{FOREACH miners i}
{VARIABLE_OP idle to_variable "miners[$i].variables.idle"}
{VARIABLE_OP temp_x format "$miners[$i].x"}
{VARIABLE_OP temp_y format "$miners[$i].y"}
[if]
{CONDITION idle equals yes}
[then]
{CLEAR_VARIABLE "miners[$i].variables.idle"}
{VARIABLE_OP credited_side format $miners[$i].side}
{VARIABLE_OP amount format $player_$credited_side|.mining.gold}
[unstore_unit]
variable=miners[$i]
[/unstore_unit]
[/then]
[else]
{VARIABLE_OP temp_x format "$miners[$i].x"}
{VARIABLE_OP temp_y format "$miners[$i].y"}
# auto-mine
{ADD_GOLD $credited_side $amount}
{SCROLL_TO $temp_x $temp_y}
{VARIABLE sound yes}
{VARIABLE_OP credited_side format $miners[$i].side}
{VARIABLE_OP amount format $player_$credited_side|.mining.gold}
# auto-mine
{ADD_GOLD $credited_side $amount}
{SCROLL_TO $temp_x $temp_y}
{VARIABLE sound yes}
[unstore_unit]
variable=miners[$i]
text="$amount"
red,green,blue=204,204,51
[/unstore_unit]
[/else]
[/if]
[unstore_unit]
variable=miners[$i]
text="$amount"
red,green,blue=204,204,51
[/unstore_unit]
{NEXT i}
[if]
{CONDITION sound equals yes}
[then]
@ -255,47 +205,9 @@
{CLEAR_VARIABLE sound}
{CLEAR_VARIABLE miners}
{CLEAR_VARIABLE idle}
{CLEAR_VARIABLE amount}
{CLEAR_VARIABLE credited_side}
{REDRAW}
[/event]
#enddef
#define AUTO_MOVE_INIT TYPES
# This macro enables a peasant to move onto an existing farm or
# mine and auto-harvest or auto-mine at the start of next turn.
[event]
name=moveto
first_time_only=no
[filter]
type={TYPES}
[filter_location]
terrain="Re,Re^Gvs,Hh^Vhh,Ha^Vhha,Mm^Vhh,Re^Uf,Uu^Uf"
[/filter_location]
[/filter]
[store_unit]
[filter]
x=$x1
y=$y1
[/filter]
variable=unit
[/store_unit]
[if]
{CONDITION unit.moves greater_than_equal_to 1}
[then]
{CLEAR_VARIABLE unit.variables.idle}
[/then]
[else]
{VARIABLE unit.variables.idle yes}
[/else]
[/if]
[unstore_unit]
variable=unit
[/unstore_unit]
[/event]
#enddef

View file

@ -19,7 +19,8 @@
{VARIABLE_OP leader.gold add -20}
{VARIABLE finished_options yes}
{VARIABLE finished_suboptions yes}
{VARIABLE_OP unit.moves format 0}
{VARIABLE unit.status.worked_this_turn yes}
{VARIABLE unit.moves 0}
{REDRAW}
[/command]
[/option]
@ -40,7 +41,8 @@ Share knowledge of agriculture"}
{VARIABLE_OP player_{TARGET_SIDE}.farming.progress add 1}
{VARIABLE finished_options yes}
{VARIABLE finished_suboptions yes}
{VARIABLE_OP unit.moves format 0}
{VARIABLE unit.status.worked_this_turn yes}
{VARIABLE unit.moves 0}
{REDRAW}
[message]
speaker=unit
@ -65,7 +67,8 @@ Share knowledge of mining"}
{VARIABLE_OP player_{TARGET_SIDE}.mining.progress add 1}
{VARIABLE finished_options yes}
{VARIABLE finished_suboptions yes}
{VARIABLE_OP unit.moves format 0}
{VARIABLE unit.status.worked_this_turn yes}
{VARIABLE unit.moves 0}
{REDRAW}
[message]
speaker=unit
@ -90,7 +93,8 @@ Share knowledge of warfare"}
{VARIABLE_OP player_{TARGET_SIDE}.warfare.progress add 1}
{VARIABLE finished_options yes}
{VARIABLE finished_suboptions yes}
{VARIABLE_OP unit.moves format 0}
{VARIABLE unit.status.worked_this_turn yes}
{VARIABLE unit.moves 0}
{REDRAW}
[message]
speaker=unit
@ -112,7 +116,9 @@ Share knowledge of warfare"}
canrecruit=yes
[not]
[filter_wml]
moves=0
[status]
worked_this_turn=yes
[/status]
[/filter_wml]
[/not]
[/have_unit]
@ -259,7 +265,8 @@ Negotiation Progress: $player_$side_number|.leader_option_1.progress|/$player_$s
[/show_if]
[command]
{VARIABLE finished_options yes}
{VARIABLE_OP unit.moves format 0}
{VARIABLE unit.status.worked_this_turn yes}
{VARIABLE unit.moves 0}
{VARIABLE_OP player_$side_number|.leader_option_1.progress add 1}
[/command]
[/option]
@ -284,7 +291,8 @@ Negotiation Progress: $player_$side_number|.leader_option_2.progress|/$player_$s
[/show_if]
[command]
{VARIABLE finished_options yes}
{VARIABLE_OP unit.moves format 0}
{VARIABLE unit.status.worked_this_turn yes}
{VARIABLE unit.moves 0}
{VARIABLE_OP player_$side_number|.leader_option_2.progress add 1}
[/command]
[/option]

View file

@ -16,7 +16,9 @@
canrecruit=no
[not]
[filter_wml]
moves=0
[status]
worked_this_turn=yes
[/status]
[/filter_wml]
[/not]
[/have_unit]
@ -59,7 +61,9 @@
canrecruit=no
[not]
[filter_wml]
moves=0
[status]
worked_this_turn=yes
[/status]
[/filter_wml]
[/not]
[/have_unit]
@ -113,7 +117,8 @@ Study Progress: $player_$side_number|.farming.progress|/$player_$side_number|.fa
[command]
{VARIABLE player_$side_number|.research.current_target "agriculture"}
{VARIABLE finished_options yes}
{VARIABLE_OP unit.moves format 0}
{VARIABLE unit.status.worked_this_turn yes}
{VARIABLE unit.moves 0}
[/command]
[/option]
@ -126,7 +131,8 @@ Study Progress: $player_$side_number|.mining.progress|/$player_$side_number|.min
[command]
{VARIABLE player_$side_number|.research.current_target "mining"}
{VARIABLE finished_options yes}
{VARIABLE_OP unit.moves format 0}
{VARIABLE unit.status.worked_this_turn yes}
{VARIABLE unit.moves 0}
[/command]
[/option]
@ -161,7 +167,8 @@ Study Progress: $player_$side_number|.warfare.progress|/$player_$side_number|.wa
[command]
{VARIABLE player_$side_number|.research.current_target "warfare"}
{VARIABLE finished_options yes}
{VARIABLE_OP unit.moves format 0}
{VARIABLE unit.status.worked_this_turn yes}
{VARIABLE unit.moves 0}
[/command]
[/option]
[/message]

View file

@ -2,7 +2,8 @@
#define COMPLETE_ACTION GOLD
{VARIABLE finished yes}
{VARIABLE_OP unit.moves format 0}
{VARIABLE unit.status.worked_this_turn yes}
{VARIABLE unit.moves 0}
[unstore_unit]
variable=unit
[/unstore_unit]

View file

@ -11,7 +11,9 @@
type={TYPES}
[not]
[filter_wml]
moves=0
[status]
worked_this_turn=yes
[/status]
[/filter_wml]
[/not]
[/have_unit]
@ -161,7 +163,8 @@ message= {MENU_IMG_TXT2 "terrain/flat/grass-r8.png" _"@Chop Down Forest" _"`Earn
{ANL_SHOW_IF ("Peasant") "Gs^Fp,Gs^Ft,Aa^Fpa,Gg^Fet"}
[command]
{VARIABLE finished yes}
{VARIABLE_OP unit.moves format 0}
{VARIABLE unit.status.worked_this_turn yes}
{VARIABLE unit.moves 0}
{ADD_GOLD $side_number 1}
{PLAY_SOUND ("dagger-swish.wav")}
{DELAY 250}
@ -338,7 +341,8 @@ message= {MENU_IMG_TXT2 "terrain/cave/floor1.png" _"@Harvest Mushrooms" _"`Earns
{ANL_SHOW_IF ("Peasant") "Uu^Uf"}
[command]
{VARIABLE finished yes}
{VARIABLE_OP unit.moves format 0}
{VARIABLE unit.status.worked_this_turn yes}
{VARIABLE unit.moves 0}
{ADD_GOLD $side_number 3}
{PLAY_SOUND ("dagger-swish.wav")}
{DELAY 250}