Revert 2011-08-14T15:46:08Z!thonsew@yahoo.com

Bugs are in C++ bugs related to recruitment and $this_unit not the WML
This commit is contained in:
Thonsew 2011-08-15 15:01:17 +00:00
parent ebbe106e49
commit 4bb5e2f825

View File

@ -96,7 +96,7 @@
side=3 side=3
canrecruit=yes canrecruit=yes
[ai] [ai]
recruitment_pattern=mixed fighter, mixed fighter, mixed fighter, fighter, fighter, mixed fighter, mixed fighter, scout recruitment_pattern=scout, scout, scout, fighter, fighter, mixed fighter, mixed fighter
aggression=1.0 aggression=1.0
caution=0.0 caution=0.0
villages_per_scout=0 villages_per_scout=0
@ -171,7 +171,6 @@
facing={FACING_VALUE} facing={FACING_VALUE}
upkeep=free upkeep=free
role="docked transport" role="docked transport"
goto_x,goto_y={X},{Y}
[variables] [variables]
transport_num={ID_VALUE} transport_num={ID_VALUE}
@ -320,15 +319,15 @@
[/filter] [/filter]
{MODIFY_UNIT ( {MODIFY_UNIT (
[filter_wml] [filter_wml]
[variables] [variables]
boarding_transport=yes boarding_transport=yes
[/variables] [/variables]
[/filter_wml] [/filter_wml]
[filter_adjacent] [filter_adjacent]
x,y=$x1,$y1 x,y=$x1,$y1
[/filter_adjacent] [/filter_adjacent]
) variables.boarding_transport no} ) variables.boarding_transport no}
[fire_event] [fire_event]
@ -361,7 +360,7 @@
[/variables] [/variables]
[/filter_wml] [/filter_wml]
count=3-100 count=3
[/filter_adjacent] [/filter_adjacent]
[/have_unit] [/have_unit]
[/filter_condition] [/filter_condition]
@ -426,7 +425,7 @@
{VARIABLE transport.variables.landing_party[$i].moves 0} {VARIABLE transport.variables.landing_party[$i].moves 0}
{VARIABLE transport.variables.landing_party[$i].attacks_left 0} {VARIABLE transport.variables.landing_party[$i].attacks_left 0}
{CLEAR_VARIABLE transport.variables.landing_party[$i].variables.boarding_transport} {CLEAR_VARIABLE transport.variables.landing_party[$i].variables.boarding_transport}
{NEXT i} {NEXT i}
[unstore_unit] [unstore_unit]
variable=transport variable=transport
@ -436,7 +435,6 @@
[fire_event] [fire_event]
name=start_boarding_next_transport name=start_boarding_next_transport
[/fire_event] [/fire_event]
#{DEBUG_MSG "Boarding "}
{CLEAR_VARIABLE transport} {CLEAR_VARIABLE transport}
[/event] [/event]
@ -524,7 +522,7 @@
[/unstore_unit] [/unstore_unit]
[/then] [/then]
[/if] [/if]
{NEXT i} {NEXT i}
{CLEAR_VARIABLE moving_transports,landing_sites,x,goto_x,goto_y} {CLEAR_VARIABLE moving_transports,landing_sites,x,goto_x,goto_y}
[/event] [/event]
@ -613,51 +611,6 @@
[/do] [/do]
[/while] [/while]
# {FOREACH possible_boarders j}
# {DEBUG_MSG "Possible boarder $possible_boarders[$j].name"}
# {NEXT j}
#Pick 3 different random units
#Better way would be to randomize the vector.
{RANDOM "0..$($possible_boarders.length - 1)"}
{VARIABLE unit1 $random}
{RANDOM "0..$($possible_boarders.length - 2)"}
{VARIABLE unit2 $random}
[if]
[variable]
name=unit2
equals=$unit1
[/variable]
[then]
{CLEAR_VARIABLE unit2}
{VARIABLE unit2 "$($possible_boarders.length - 1)" }
[/then]
[/if]
{RANDOM "0..$($possible_boarders.length - 3)"}
{VARIABLE unit3 $random}
[if]
[variable]
name=unit3
equals=$unit1
[/variable]
[or]
[variable]
name=unit3
equals=$unit2
[/variable]
[/or]
[then]
{CLEAR_VARIABLE unit3}
{VARIABLE unit3 "$($possible_boarders.length - 1)" }
[/then]
[/if]
#{DEBUG_MSG "unit1 = $unit1, unit2 = $unit2, unit3 = $unit3"}
[if] [if]
[variable] [variable]
name=possible_boarders.length name=possible_boarders.length
@ -665,33 +618,14 @@
[/variable] [/variable]
[then] [then]
{VARIABLE possible_boarders[$unit1].variables.boarding_transport yes} {RANDOM "0..$($possible_boarders.length - 1)"}
#{DEBUG_MSG "Setting $possible_boarders[$unit1].name the $possible_boarders[$unit1].language_name to board transport $transport_to_board"} {VARIABLE possible_boarders[$random].variables.boarding_transport yes}
#{DEBUG_MSG "Setting $possible_boarders[$random].name the $possible_boarders[$random].language_name to board transport $transport_to_board"}
[unstore_unit] [unstore_unit]
variable=possible_boarders[$unit1] variable=possible_boarders[$random]
find_vacant=no
[/unstore_unit]
[/then]
#[else]
# {DEBUG_MSG "Found no one to go to board transport $transport_to_board|..."}
#[/else]
[/if]
[if]
[variable]
name=possible_boarders.length
greater_than_equal_to=2
[/variable]
[then]
{VARIABLE possible_boarders[$unit2].variables.boarding_transport yes}
#{DEBUG_MSG "Setting $possible_boarders[$unit2].name the $possible_boarders[$unit2].language_name to board transport $transport_to_board"}
[unstore_unit]
variable=possible_boarders[$unit2]
find_vacant=no find_vacant=no
[/unstore_unit] [/unstore_unit]
[/then] [/then]
@ -701,28 +635,7 @@
#[/else] #[/else]
[/if] [/if]
[if] {CLEAR_VARIABLE possible_boarders}
[variable]
name=possible_boarders.length
greater_than_equal_to=3
[/variable]
[then]
{VARIABLE possible_boarders[$unit3].variables.boarding_transport yes}
#{DEBUG_MSG "Setting $possible_boarders[$unit3].name the $possible_boarders[$unit3].language_name to board transport $transport_to_board"}
[unstore_unit]
variable=possible_boarders[$unit3]
find_vacant=no
[/unstore_unit]
[/then]
#[else]
# {DEBUG_MSG "Found no one to go to board transport $transport_to_board|..."}
#[/else]
[/if]
{CLEAR_VARIABLE possible_boarders,unit1,unit2,unit3}
[/event] [/event]
# This makes units which have been designated to board a transport to move # This makes units which have been designated to board a transport to move
@ -773,23 +686,9 @@
[/filter_adjacent_location] [/filter_adjacent_location]
[not] [not]
[variable]
name=i
greater_than=0
[/variable]
[filter] [filter]
x,y=$moving_to_transport[0].goto_x,$moving_to_transport[0].goto_y
[/filter] [/filter]
[/not] [/not]
# [not]
# [variable]
# name=i
# greater_than=1
# [/variable]
# [filter]
# x,y=$moving_to_transport[1].goto_x,$moving_to_transport[1].goto_y
# [/filter]
# [/not]
[and] [and]
[filter] [filter]
@ -840,72 +739,46 @@
variable=moving_to_transport[$i] variable=moving_to_transport[$i]
find_vacant=no find_vacant=no
[/unstore_unit] [/unstore_unit]
{NEXT i}
{NEXT i}
{CLEAR_VARIABLE moving_to_transport,boarding_locs} {CLEAR_VARIABLE moving_to_transport,boarding_locs}
[/event] [/event]
# Zero the movement of docked transports
[event] [event]
name=side 4 turn refresh name=side 4 turn refresh
first_time_only=no first_time_only=no
[store_unit] # Zero the movement of docked transports
[filter] {MODIFY_UNIT (
type=Transport Galleon type=Transport Galleon
[and] x,y=$this_unit.variables.dock_x,$this_unit.variables.dock_y
x,y=$this_unit.variables.dock_x,$this_unit.variables.dock_y
[/and]
[not] [not]
[filter_wml] [filter_wml]
[variables] [variables]
[landing_party] [landing_party]
[/landing_party] [/landing_party]
[/variables] [/variables]
[/filter_wml] [/filter_wml]
[/not] [/not]
[/filter] ) moves 0}
kill=yes
variable=locked_down_transports
[/store_unit]
{FOREACH locked_down_transports i}
{VARIABLE locked_down_transports[$i].moves 0}
#{DEBUG_MSG "Setting transport $locked_down_transports[$i].variables.transport_num to stay at $locked_down_transports[$i].variables.dock_x|,$locked_down_transports[$i].variables.dock_y"}
[unstore_unit]
variable=locked_down_transports[$i]
[/unstore_unit]
{NEXT i}
{CLEAR_VARIABLE locked_down_transports}
[/event]
[event]
name=side 4 turn refresh
first_time_only=no
# Zero the movement of units waiting to board a transport # Zero the movement of units waiting to board a transport
{MODIFY_UNIT ( {MODIFY_UNIT (
side=4 side=4
[filter_wml]
[variables]
boarding_transport=yes
[/variables]
[/filter_wml]
[filter_adjacent]
[filter_wml] [filter_wml]
[variables] [variables]
transport_num=$transport_to_board boarding_transport=yes
[/variables] [/variables]
[/filter_wml] [/filter_wml]
[/filter_adjacent] [filter_adjacent]
[filter_wml]
[variables]
transport_num=$transport_to_board
[/variables]
[/filter_wml]
[/filter_adjacent]
) moves 0} ) moves 0}
[/event] [/event]
@ -987,72 +860,51 @@
[/then] [/then]
[/if] [/if]
#It is possible to strand units on the ship by completely blocking the shoreline [move_unit_fake]
[if] x=$unit.x,$disembark_loc.x
[variable] y=$unit.y,$disembark_loc.y
name=disembark_loc.length type=$unit.variables.landing_party[$i].type
greater_than=0 gender=$unit.variables.landing_party[$i].gender
[/variable] side=4
[then] [/move_unit_fake]
{RANDOM "0..$($disembark_loc.length - 1)"} [unstore_unit]
variable=unit.variables.landing_party[$i]
x,y=$disembark_loc.x,$disembark_loc.y
[/unstore_unit]
{NEXT i}
[move_unit_fake] {VARIABLE_OP landing_parties_landed add 1}
x=$unit.x,$disembark_loc[$random].x [switch]
y=$unit.y,$disembark_loc[$random].y variable=landing_parties_landed
type=$unit.variables.landing_party[$i].type
gender=$unit.variables.landing_party[$i].gender
side=4
[/move_unit_fake]
[unstore_unit] [case]
variable=unit.variables.landing_party[$i] value=1
x,y=$disembark_loc[$random].x,$disembark_loc[$random].y
[/unstore_unit]
[/then]
[/if]
{NEXT i}
#It is possible to strand units on the ship by completely blocking the shoreline [message]
[if] x,y=$disembark_loc.x,$disembark_loc.y
[variable] message= _ "Charge!"
name=disembark_loc.length [/message]
greater_than=0 [/case]
[/variable]
[then]
{VARIABLE_OP landing_parties_landed add 1}
[switch]
variable=landing_parties_landed
[case] [case]
value=1 value=2
[message] [message]
x,y=$disembark_loc[$random].x,$disembark_loc[$random].y x,y=$disembark_loc.x,$disembark_loc.y
message= _ "Charge!" message= _ "Get them!"
[/message] [/message]
[/case] [/case]
[/switch]
[case] {CLEAR_VARIABLE unit.variables.landing_party}
value=2
[message] {VARIABLE unit.moves 0}
x,y=$disembark_loc[$random].x,$disembark_loc[$random].y
message= _ "Get them!"
[/message]
[/case]
[/switch]
{CLEAR_VARIABLE unit.variables.landing_party} [unstore_unit]
variable=unit
{VARIABLE unit.moves 0} find_vacant=no
[/unstore_unit]
[unstore_unit]
variable=unit
find_vacant=no
[/unstore_unit]
[/then]
[/if]
[/event] [/event]
# This makes transports which have no landing party and aren't at their dock # This makes transports which have no landing party and aren't at their dock
@ -1065,6 +917,7 @@
[store_unit] [store_unit]
[filter] [filter]
type=Transport Galleon type=Transport Galleon
[not] [not]
x,y=$this_unit.variables.dock_x,$this_unit.variables.dock_y x,y=$this_unit.variables.dock_x,$this_unit.variables.dock_y
[/not] [/not]
@ -1092,7 +945,7 @@
[unstore_unit] [unstore_unit]
variable=returning_transports[$i] variable=returning_transports[$i]
[/unstore_unit] [/unstore_unit]
{NEXT i} {NEXT i}
{CLEAR_VARIABLE returning_transports} {CLEAR_VARIABLE returning_transports}
[/event] [/event]