SotbE: Replaced FOREACH
This commit is contained in:
parent
418c9656a5
commit
4213c04dfb
5 changed files with 245 additions and 218 deletions
|
@ -370,12 +370,15 @@
|
|||
message= _ "We are victorious at last. Someone go tell the shamans that they can come out now."
|
||||
[/message]
|
||||
|
||||
{FOREACH stored_shamans i}
|
||||
[unstore_unit]
|
||||
variable=stored_shamans[$i]
|
||||
find_vacant=yes
|
||||
[/unstore_unit]
|
||||
{NEXT i}
|
||||
[foreach]
|
||||
array=stored_shamans
|
||||
[do]
|
||||
[unstore_unit]
|
||||
variable=this_item
|
||||
find_vacant=yes
|
||||
[/unstore_unit]
|
||||
[/do]
|
||||
[/foreach]
|
||||
{CLEAR_VARIABLE stored_shamans}
|
||||
|
||||
[message]
|
||||
|
|
|
@ -282,34 +282,37 @@
|
|||
fire_event=yes
|
||||
[/kill]
|
||||
|
||||
{FOREACH exploding_hexes i}
|
||||
[sound]
|
||||
name=explosion.ogg
|
||||
[/sound]
|
||||
[foreach]
|
||||
array=exploding_hexes
|
||||
[do]
|
||||
[sound]
|
||||
name=explosion.ogg
|
||||
[/sound]
|
||||
|
||||
[item]
|
||||
x,y=$exploding_hexes[$i].x,$exploding_hexes[$i].y
|
||||
halo=projectiles/fire-burst-small-[1~8].png:50,misc/blank-hex.png:1000000
|
||||
[/item]
|
||||
[item]
|
||||
x,y=$this_item.x,$this_item.y
|
||||
halo=projectiles/fire-burst-small-[1~8].png:50,misc/blank-hex.png:1000000
|
||||
[/item]
|
||||
|
||||
[kill]
|
||||
x,y=$exploding_hexes[$i].x,$exploding_hexes[$i].y
|
||||
animate=yes
|
||||
fire_event=yes
|
||||
[/kill]
|
||||
[kill]
|
||||
x,y=$this_item.x,$this_item.y
|
||||
animate=yes
|
||||
fire_event=yes
|
||||
[/kill]
|
||||
|
||||
[terrain]
|
||||
x,y=$exploding_hexes[$i].x,$exploding_hexes[$i].y
|
||||
terrain=Ww^Es
|
||||
[/terrain]
|
||||
[terrain]
|
||||
x,y=$this_item.x,$this_item.y
|
||||
terrain=Ww^Es
|
||||
[/terrain]
|
||||
|
||||
[sound]
|
||||
name=water-blast.wav
|
||||
[/sound]
|
||||
[sound]
|
||||
name=water-blast.wav
|
||||
[/sound]
|
||||
|
||||
[redraw]
|
||||
[/redraw]
|
||||
{NEXT i}
|
||||
[redraw]
|
||||
[/redraw]
|
||||
[/do]
|
||||
[/foreach]
|
||||
|
||||
[kill]
|
||||
side=1
|
||||
|
|
|
@ -414,25 +414,28 @@
|
|||
variable=transport.variables.landing_party
|
||||
[/store_unit]
|
||||
|
||||
{FOREACH transport.variables.landing_party i}
|
||||
[kill]
|
||||
x=$transport.variables.landing_party[$i].x
|
||||
y=$transport.variables.landing_party[$i].y
|
||||
fire_event=no
|
||||
[/kill]
|
||||
[foreach]
|
||||
array=transport.variables.landing_party
|
||||
[do]
|
||||
[kill]
|
||||
x=$this_item.x
|
||||
y=$this_item.y
|
||||
fire_event=no
|
||||
[/kill]
|
||||
|
||||
[move_unit_fake]
|
||||
x=$transport.variables.landing_party[$i].x,$transport.x
|
||||
y=$transport.variables.landing_party[$i].y,$transport.y
|
||||
type=$transport.variables.landing_party[$i].type
|
||||
gender=$transport.variables.landing_party[$i].gender
|
||||
side=4
|
||||
[/move_unit_fake]
|
||||
[move_unit_fake]
|
||||
x=$this_item.x,$transport.x
|
||||
y=$this_item.y,$transport.y
|
||||
type=$this_item.type
|
||||
gender=$this_item.gender
|
||||
side=4
|
||||
[/move_unit_fake]
|
||||
|
||||
{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}
|
||||
{VARIABLE this_item.moves 0}
|
||||
{VARIABLE this_item.attacks_left 0}
|
||||
{CLEAR_VARIABLE this_item.variables.boarding_transport}
|
||||
[/do]
|
||||
[/foreach]
|
||||
|
||||
[unstore_unit]
|
||||
variable=transport
|
||||
|
@ -468,68 +471,71 @@
|
|||
variable=moving_transports
|
||||
[/store_unit]
|
||||
|
||||
{FOREACH moving_transports i}
|
||||
[if]
|
||||
[variable]
|
||||
name=moving_transports[$i].x
|
||||
less_than=19
|
||||
[/variable]
|
||||
[foreach]
|
||||
array=moving_transports
|
||||
[do]
|
||||
[if]
|
||||
[variable]
|
||||
name=this_item.x
|
||||
less_than=19
|
||||
[/variable]
|
||||
|
||||
[then]
|
||||
{VARIABLE x "1-17"}
|
||||
[/then]
|
||||
[then]
|
||||
{VARIABLE x "1-17"}
|
||||
[/then]
|
||||
|
||||
[else]
|
||||
{VARIABLE x "21-38"}
|
||||
[/else]
|
||||
[/if]
|
||||
[else]
|
||||
{VARIABLE x "21-38"}
|
||||
[/else]
|
||||
[/if]
|
||||
|
||||
[store_locations]
|
||||
x=$x
|
||||
y=7-11
|
||||
terrain=W*
|
||||
[store_locations]
|
||||
x=$x
|
||||
y=7-11
|
||||
terrain=W*
|
||||
|
||||
[filter_adjacent_location]
|
||||
terrain=!,W*
|
||||
count=2-6
|
||||
[/filter_adjacent_location]
|
||||
[filter_adjacent_location]
|
||||
terrain=!,W*
|
||||
count=2-6
|
||||
[/filter_adjacent_location]
|
||||
|
||||
[not]
|
||||
[filter]
|
||||
[/filter]
|
||||
[not]
|
||||
[filter]
|
||||
[/filter]
|
||||
|
||||
radius=1
|
||||
[/not]
|
||||
radius=1
|
||||
[/not]
|
||||
|
||||
variable=landing_sites
|
||||
[/store_locations]
|
||||
variable=landing_sites
|
||||
[/store_locations]
|
||||
|
||||
#{DEBUG_MSG "Found $landing_sites.length possible landing sites for transport $moving_transports[$i].variables.transport_num"}
|
||||
#{DEBUG_MSG "Found $landing_sites.length possible landing sites for transport $this_item.variables.transport_num"}
|
||||
|
||||
[if]
|
||||
[variable]
|
||||
name=landing_sites.length
|
||||
greater_than_equal_to=1
|
||||
[/variable]
|
||||
[if]
|
||||
[variable]
|
||||
name=landing_sites.length
|
||||
greater_than_equal_to=1
|
||||
[/variable]
|
||||
|
||||
[then]
|
||||
{RANDOM "0..$($landing_sites.length - 1)"}
|
||||
[then]
|
||||
{RANDOM "0..$($landing_sites.length - 1)"}
|
||||
|
||||
{VARIABLE goto_x $landing_sites[$random].x}
|
||||
{VARIABLE goto_y $landing_sites[$random].y}
|
||||
{VARIABLE goto_x $landing_sites[$random].x}
|
||||
{VARIABLE goto_y $landing_sites[$random].y}
|
||||
|
||||
{VARIABLE moving_transports[$i].goto_x $goto_x}
|
||||
{VARIABLE moving_transports[$i].goto_y $goto_y}
|
||||
{VARIABLE this_item.goto_x $goto_x}
|
||||
{VARIABLE this_item.goto_y $goto_y}
|
||||
|
||||
#{DEBUG_MSG "Setting transport $moving_transports[$i].variables.transport_num to goto $goto_x|,$goto_y"}
|
||||
#{DEBUG_MSG "Setting transport $this_item.variables.transport_num to goto $goto_x|,$goto_y"}
|
||||
|
||||
[unstore_unit]
|
||||
variable=moving_transports[$i]
|
||||
find_vacant=no
|
||||
[/unstore_unit]
|
||||
[/then]
|
||||
[/if]
|
||||
{NEXT i}
|
||||
[unstore_unit]
|
||||
variable=this_item
|
||||
find_vacant=no
|
||||
[/unstore_unit]
|
||||
[/then]
|
||||
[/if]
|
||||
[/do]
|
||||
[/foreach]
|
||||
|
||||
{CLEAR_VARIABLE moving_transports,landing_sites,x,goto_x,goto_y,random}
|
||||
[/event]
|
||||
|
@ -676,52 +682,15 @@
|
|||
variable=moving_to_transport
|
||||
[/store_unit]
|
||||
|
||||
{FOREACH moving_to_transport i}
|
||||
# First we try to find a proper boarding location which the unit can
|
||||
# reach in one turn...
|
||||
[store_locations]
|
||||
terrain=!,W*
|
||||
[foreach]
|
||||
array=moving_to_transport
|
||||
[do]
|
||||
# First we try to find a proper boarding location which the unit can
|
||||
# reach in one turn...
|
||||
[store_locations]
|
||||
terrain=!,W*
|
||||
|
||||
[filter_adjacent_location]
|
||||
[filter]
|
||||
[filter_wml]
|
||||
[variables]
|
||||
transport_num=$transport_to_board
|
||||
[/variables]
|
||||
[/filter_wml]
|
||||
[/filter]
|
||||
[/filter_adjacent_location]
|
||||
|
||||
[not]
|
||||
[filter]
|
||||
[/filter]
|
||||
[/not]
|
||||
|
||||
[and]
|
||||
[filter]
|
||||
x,y=$moving_to_transport[$i].x,$moving_to_transport[$i].y
|
||||
[/filter]
|
||||
|
||||
radius=$moving_to_transport[$i].moves
|
||||
|
||||
[filter_radius]
|
||||
terrain=G*,R*,C*,K*,*^V*,Wwf
|
||||
[/filter_radius]
|
||||
[/and]
|
||||
|
||||
variable=boarding_locs
|
||||
[/store_locations]
|
||||
|
||||
# ...but if no such location was found, then we just make the unit
|
||||
# head for the transport itself for now.
|
||||
[if]
|
||||
[variable]
|
||||
name=boarding_locs.length
|
||||
less_than=1
|
||||
[/variable]
|
||||
|
||||
[then]
|
||||
[store_locations]
|
||||
[filter_adjacent_location]
|
||||
[filter]
|
||||
[filter_wml]
|
||||
[variables]
|
||||
|
@ -729,24 +698,64 @@
|
|||
[/variables]
|
||||
[/filter_wml]
|
||||
[/filter]
|
||||
[/filter_adjacent_location]
|
||||
|
||||
variable=boarding_locs
|
||||
[/store_locations]
|
||||
[/then]
|
||||
[/if]
|
||||
[not]
|
||||
[filter]
|
||||
[/filter]
|
||||
[/not]
|
||||
|
||||
{RANDOM "0..$($boarding_locs.length - 1)"}
|
||||
[and]
|
||||
[filter]
|
||||
x,y=$this_item.x,$this_item.y
|
||||
[/filter]
|
||||
|
||||
{VARIABLE moving_to_transport[$i].goto_x $boarding_locs[$random].x}
|
||||
{VARIABLE moving_to_transport[$i].goto_y $boarding_locs[$random].y}
|
||||
radius=$this_item.moves
|
||||
|
||||
#{DEBUG_MSG "Setting $moving_to_transport[$i].name the $moving_to_transport[$i].language_name to go to $boarding_locs[$random].x|,$boarding_locs[$random].y"}
|
||||
[filter_radius]
|
||||
terrain=G*,R*,C*,K*,*^V*,Wwf
|
||||
[/filter_radius]
|
||||
[/and]
|
||||
|
||||
[unstore_unit]
|
||||
variable=moving_to_transport[$i]
|
||||
find_vacant=no
|
||||
[/unstore_unit]
|
||||
{NEXT i}
|
||||
variable=boarding_locs
|
||||
[/store_locations]
|
||||
|
||||
# ...but if no such location was found, then we just make the unit
|
||||
# head for the transport itself for now.
|
||||
[if]
|
||||
[variable]
|
||||
name=boarding_locs.length
|
||||
less_than=1
|
||||
[/variable]
|
||||
|
||||
[then]
|
||||
[store_locations]
|
||||
[filter]
|
||||
[filter_wml]
|
||||
[variables]
|
||||
transport_num=$transport_to_board
|
||||
[/variables]
|
||||
[/filter_wml]
|
||||
[/filter]
|
||||
|
||||
variable=boarding_locs
|
||||
[/store_locations]
|
||||
[/then]
|
||||
[/if]
|
||||
|
||||
{RANDOM "0..$($boarding_locs.length - 1)"}
|
||||
|
||||
{VARIABLE this_item.goto_x $boarding_locs[$random].x}
|
||||
{VARIABLE this_item.goto_y $boarding_locs[$random].y}
|
||||
|
||||
#{DEBUG_MSG "Setting $this_item.name the $this_item.language_name to go to $boarding_locs[$random].x|,$boarding_locs[$random].y"}
|
||||
|
||||
[unstore_unit]
|
||||
variable=this_item
|
||||
find_vacant=no
|
||||
[/unstore_unit]
|
||||
[/do]
|
||||
[/foreach]
|
||||
|
||||
{CLEAR_VARIABLE moving_to_transport,boarding_locs,random}
|
||||
[/event]
|
||||
|
@ -827,59 +836,62 @@
|
|||
[/filter_location]
|
||||
[/filter]
|
||||
|
||||
{FOREACH unit.variables.landing_party i}
|
||||
[store_locations]
|
||||
terrain=!,W*
|
||||
[foreach]
|
||||
array=unit.variables.landing_party
|
||||
[do]
|
||||
[store_locations]
|
||||
terrain=!,W*
|
||||
|
||||
[filter_adjacent_location]
|
||||
x,y=$x1,$y1
|
||||
[/filter_adjacent_location]
|
||||
[filter_adjacent_location]
|
||||
x,y=$x1,$y1
|
||||
[/filter_adjacent_location]
|
||||
|
||||
[not]
|
||||
[filter]
|
||||
[/filter]
|
||||
[/not]
|
||||
[not]
|
||||
[filter]
|
||||
[/filter]
|
||||
[/not]
|
||||
|
||||
variable=disembark_loc
|
||||
[/store_locations]
|
||||
variable=disembark_loc
|
||||
[/store_locations]
|
||||
|
||||
[if]
|
||||
[variable]
|
||||
name=disembark_loc.length
|
||||
less_than=1
|
||||
[/variable]
|
||||
[if]
|
||||
[variable]
|
||||
name=disembark_loc.length
|
||||
less_than=1
|
||||
[/variable]
|
||||
|
||||
[then]
|
||||
[store_locations]
|
||||
terrain=!,Wo
|
||||
[then]
|
||||
[store_locations]
|
||||
terrain=!,Wo
|
||||
|
||||
[filter_adjacent_location]
|
||||
x,y=$x1,$y1
|
||||
[/filter_adjacent_location]
|
||||
[filter_adjacent_location]
|
||||
x,y=$x1,$y1
|
||||
[/filter_adjacent_location]
|
||||
|
||||
[not]
|
||||
[filter]
|
||||
[/filter]
|
||||
[/not]
|
||||
[not]
|
||||
[filter]
|
||||
[/filter]
|
||||
[/not]
|
||||
|
||||
variable=disembark_loc
|
||||
[/store_locations]
|
||||
[/then]
|
||||
[/if]
|
||||
variable=disembark_loc
|
||||
[/store_locations]
|
||||
[/then]
|
||||
[/if]
|
||||
|
||||
[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]
|
||||
[move_unit_fake]
|
||||
x=$unit.x,$disembark_loc.x
|
||||
y=$unit.y,$disembark_loc.y
|
||||
type=$this_item.type
|
||||
gender=$this_item.gender
|
||||
side=4
|
||||
[/move_unit_fake]
|
||||
|
||||
[unstore_unit]
|
||||
variable=unit.variables.landing_party[$i]
|
||||
x,y=$disembark_loc.x,$disembark_loc.y
|
||||
[/unstore_unit]
|
||||
{NEXT i}
|
||||
[unstore_unit]
|
||||
variable=this_item
|
||||
x,y=$disembark_loc.x,$disembark_loc.y
|
||||
[/unstore_unit]
|
||||
[/do]
|
||||
[/foreach]
|
||||
|
||||
{VARIABLE_OP landing_parties_landed add 1}
|
||||
[switch]
|
||||
|
@ -943,16 +955,19 @@
|
|||
variable=returning_transports
|
||||
[/store_unit]
|
||||
|
||||
{FOREACH returning_transports i}
|
||||
{VARIABLE returning_transports[$i].goto_x $returning_transports[$i].variables.dock_x}
|
||||
{VARIABLE returning_transports[$i].goto_y $returning_transports[$i].variables.dock_y}
|
||||
[foreach]
|
||||
array=returning_transports
|
||||
[do]
|
||||
{VARIABLE returning_transports[$i].goto_x $returning_transports[$i].variables.dock_x}
|
||||
{VARIABLE returning_transports[$i].goto_y $returning_transports[$i].variables.dock_y}
|
||||
|
||||
#{DEBUG_MSG "Setting transport $returning_transports[$i].variables.transport_num to return to $returning_transports[$i].variables.dock_x|,$returning_transports[$i].variables.dock_y"}
|
||||
#{DEBUG_MSG "Setting transport $returning_transports[$i].variables.transport_num to return to $returning_transports[$i].variables.dock_x|,$returning_transports[$i].variables.dock_y"}
|
||||
|
||||
[unstore_unit]
|
||||
variable=returning_transports[$i]
|
||||
[/unstore_unit]
|
||||
{NEXT i}
|
||||
[unstore_unit]
|
||||
variable=returning_transports[$i]
|
||||
[/unstore_unit]
|
||||
[/do]
|
||||
[/foreach]
|
||||
|
||||
{CLEAR_VARIABLE returning_transports}
|
||||
[/event]
|
||||
|
|
|
@ -535,13 +535,16 @@
|
|||
find_vacant=yes
|
||||
[/unstore_unit]
|
||||
|
||||
{FOREACH stored_trolls i}
|
||||
{VARIABLE stored_trolls[$i].side 4}
|
||||
[foreach]
|
||||
array=stored_trolls
|
||||
[do]
|
||||
{VARIABLE this_item.side 4}
|
||||
|
||||
[unstore_unit]
|
||||
variable=stored_trolls[$i]
|
||||
[/unstore_unit]
|
||||
{NEXT i}
|
||||
[unstore_unit]
|
||||
variable=this_item
|
||||
[/unstore_unit]
|
||||
[/do]
|
||||
[/foreach]
|
||||
|
||||
{CLEAR_VARIABLE stored_Gruu,stored_trolls}
|
||||
|
||||
|
|
|
@ -154,16 +154,19 @@
|
|||
variable=horde_units
|
||||
[/store_unit]
|
||||
|
||||
{FOREACH horde_units i}
|
||||
{VARIABLE horde_units[$i].upkeep $horde_units[$i].level}
|
||||
{VARIABLE_OP horde_units[$i].upkeep sub 1}
|
||||
{VARIABLE horde_units[$i].variables.great_horde_upkeep_mod_applied yes}
|
||||
[foreach]
|
||||
array=horde_units
|
||||
[do]
|
||||
{VARIABLE this_item.upkeep $this_item.level}
|
||||
{VARIABLE_OP this_item.upkeep sub 1}
|
||||
{VARIABLE this_item.variables.great_horde_upkeep_mod_applied yes}
|
||||
|
||||
[unstore_unit]
|
||||
variable=horde_units[$i]
|
||||
find_vacant=no
|
||||
[/unstore_unit]
|
||||
{NEXT i}
|
||||
[unstore_unit]
|
||||
variable=this_item
|
||||
find_vacant=no
|
||||
[/unstore_unit]
|
||||
[/do]
|
||||
[/foreach]
|
||||
|
||||
{CLEAR_VARIABLE horde_units}
|
||||
[/event]
|
||||
|
|
Loading…
Add table
Reference in a new issue