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