now the lava stuff should work as originally envisioned.

This commit is contained in:
Patrick Parker 2007-08-10 04:48:32 +00:00
parent 0d8b1daba8
commit d1ffc2cafb
2 changed files with 151 additions and 55 deletions

View File

@ -77,18 +77,6 @@
[/objectives]
{SOF_TERRAIN_MASK}
#
# Initialize the lava growing effect
#
{VARIABLE lava_count 0}
{VARIABLE lava_x 25}
{VARIABLE lava_y 35}
[terrain]
x=$lava_x
y=$lava_y
letter=Ql
[/terrain]
#
# Except on hard, you only have to face 3 enemies
# instead of 4. This part randomly kills one of the
@ -110,6 +98,14 @@
{CLEAR_VARIABLE side_kill}
[/event]
[event]
name=start
#
# Initialize the lava growing effect
#
{NEXT_LAVA}
[/event]
[event]
name=start
[recall]
@ -212,44 +208,16 @@
[then]
{TREMOR}
{VARIABLE_OP lava_count add 1}
[store_locations]
variable=lava_flow_hexes
x=$lava_x
y=$lava_y
radius=$lava_count
[/store_locations]
{FOREACH lava_flow_hexes i}
[if]
[variable]
name=lava_flow_hexes[$i].terrain
equals=Xu
[/variable]
[then]
[terrain]
x=$lava_flow_hexes[$i].x
y=$lava_flow_hexes[$i].y
letter=Ql
[/terrain]
[/then]
[/if]
{NEXT i}
# Reset the counter if it gets too large (it slows things down)
{EXPAND_LAVA}
# Reset the counter if it gets too large (it slows things down)
[if]
[variable]
name=lava_count
numerical_equals=3
[/variable]
[then]
{VARIABLE lava_count 0}
{VARIABLE_OP lava_x random (10..40)}
{VARIABLE_OP lava_y random (15..45)}
[terrain]
x=$lava_x
y=$lava_y
letter=Ql
[/terrain]
{NEXT_LAVA}
[/then]
[/if]
[/then]

View File

@ -389,6 +389,7 @@ _f, _f, _f, _f, _f, _f, Re, _f, _f, _f, _f, _f,
[event]
same_location_as_previous=yes
store_location_as=scepter
name=moveto
first_time_only=no
[filter]
@ -542,6 +543,144 @@ _f, _f, _f, _f, _f, _f, Re, _f, _f, _f, _f, _f,
[/time]
#enddef
#define NEXT_LAVA
[store_locations]
variable=potential_locs
terrain=Xu
[and]
terrain=U*
radius=1
[/and]
[and]
terrain=Re
radius=1
[/and]
[not]
# don't start near the cave floor around the scepter
x=$scepter_x
y=$scepter_y
radius=5
[/not]
[not]
# don't start near the existing lava
terrain=Ql
radius=5
[/not]
[/store_locations]
[if]
[variable]
name=potential_locs.length
greater_than=0
[/variable]
[then]
{VARIABLE lava_count 0}
{VARIABLE randrange $potential_locs.length}
{VARIABLE_OP randrange add -1}
{VARIABLE randrange "0..$randrange"}
{VARIABLE_OP random random $randrange}
{CLEAR_VARIABLE lava_body}
{VARIABLE lava_body.x $potential_locs[$random].x}
{VARIABLE lava_body.y $potential_locs[$random].y}
[terrain]
x=$lava_body.x
y=$lava_body.y
letter=Ql
[/terrain]
{CLEAR_VARIABLE potential_locs}
{CLEAR_VARIABLE randrange}
[/then]
[/if]
#enddef
#define EXPAND_LAVA
# the lava should expand to any cave floor that is not next to a cavewall,
# or cave floor that is next to cavewall that is already next to lava
# also if it comes near another lavabody, it should not expand in that direction
# first we store cavewall that is not already next to this lava
[store_locations]
variable=far_walls
terrain=Xu
[not]
find_in=lava_body
radius=1
[/not]
[/store_locations]
# next we store lava that is not part of this body
[store_locations]
variable=far_lava
terrain=Ql
[not]
find_in=lava_body
[/not]
[/store_locations]
# now we store cave floor nearby that doesn't approach the bad stuff
[store_locations]
variable=good_floor
terrain=U*,Re
[and]
find_in=lava_body
radius=1
[/and]
[not]
find_in=far_walls
radius=1
[/not]
[not]
find_in=far_lava
radius=1
[/not]
[not]
# don't go anywhere near the cave floor around the scepter
x,y=$scepter_x,$scepter_y
radius=4
[filter_radius]
terrain=U*,Re
[/filter_radius]
[/not]
[/store_locations]
[if]
[variable]
name=good_floor.length
greater_than=0
[/variable]
[then]
{FOREACH good_floor i}
[terrain]
x=$good_floor[$i].x
y=$good_floor[$i].y
letter=Ql
[/terrain]
{NEXT i}
[store_locations]
variable=lava_body
find_in=lava_body
[or]
find_in=good_floor
[/or]
[/store_locations]
[/then]
[else]
# this lava can't expand so force a new eruption
{NEXT_LAVA}
[/else]
[/if]
{CLEAR_VARIABLE far_walls}
{CLEAR_VARIABLE far_lava}
{CLEAR_VARIABLE good_floor}
# everyone on lava dies
[kill]
[filter_location]
terrain=Ql
[/filter_location]
animate=yes
[/kill]
#enddef
#define WATERFALL_MASK X Y
[item]
image=projectiles/icemissile-n-6.png
@ -888,14 +1027,3 @@ _f, _f, _f, _f, _f, _f, Re, _f, _f, _f, _f, _f,