SotBE S6: simplify the transport galleon code
It was much more complicated than it needed to be.
This commit is contained in:
parent
beac96055d
commit
18c9fd858a
1 changed files with 47 additions and 111 deletions
|
@ -201,22 +201,6 @@
|
|||
[/store_unit]
|
||||
[/event]
|
||||
|
||||
[event]
|
||||
name=new turn
|
||||
first_time_only=no
|
||||
|
||||
[if]
|
||||
[variable]
|
||||
name=turn_number
|
||||
less_than=5
|
||||
[/variable]
|
||||
|
||||
[then]
|
||||
{NOTRAIT_UNIT 3 "Transport Galleon" 1 30}
|
||||
[/then]
|
||||
[/if]
|
||||
[/event]
|
||||
|
||||
[event]
|
||||
name=turn 2
|
||||
|
||||
|
@ -267,107 +251,67 @@
|
|||
[/event]
|
||||
|
||||
[event]
|
||||
name=turn refresh
|
||||
name=new turn
|
||||
first_time_only=no
|
||||
|
||||
[if]
|
||||
[variable]
|
||||
name=side_number
|
||||
equals=3
|
||||
name=turn_number
|
||||
less_than=5
|
||||
[/variable]
|
||||
|
||||
[then]
|
||||
[store_unit]
|
||||
[filter]
|
||||
type=Transport Galleon
|
||||
side=3
|
||||
{NOTRAIT_UNIT 3 "Transport Galleon" 1 30}
|
||||
|
||||
[not]
|
||||
[filter_wml]
|
||||
[variables]
|
||||
destination_set=yes
|
||||
[/variables]
|
||||
[/filter_wml]
|
||||
[/not]
|
||||
[store_locations]
|
||||
x=14-28
|
||||
y=14-29
|
||||
terrain=Ww
|
||||
|
||||
[filter_adjacent_location]
|
||||
terrain=Ds,*^Bw*
|
||||
[/filter_adjacent_location]
|
||||
|
||||
[not]
|
||||
find_in=already_picked_transport_destination_surroundings
|
||||
[/not]
|
||||
|
||||
variable=possible_transport_destinations
|
||||
[/store_locations]
|
||||
|
||||
{VARIABLE_OP transport_destination_index rand "1..$possible_transport_destinations.length"}
|
||||
{VARIABLE_OP transport_destination_index sub 1}
|
||||
|
||||
[modify_unit]
|
||||
[filter]
|
||||
x,y=1,30
|
||||
[/filter]
|
||||
|
||||
kill=yes
|
||||
variable=stored_transports
|
||||
[/store_unit]
|
||||
goto_x=$possible_transport_destinations[$transport_destination_index].x
|
||||
goto_y=$possible_transport_destinations[$transport_destination_index].y
|
||||
[variables]
|
||||
destination_x=$possible_transport_destinations[$transport_destination_index].x
|
||||
destination_y=$possible_transport_destinations[$transport_destination_index].y
|
||||
[/variables]
|
||||
[/modify_unit]
|
||||
|
||||
{FOREACH stored_transports i}
|
||||
[store_locations]
|
||||
x=14-28
|
||||
y=14-29
|
||||
[store_locations]
|
||||
x=$possible_transport_destinations[$transport_destination_index].x
|
||||
y=$possible_transport_destinations[$transport_destination_index].y
|
||||
radius=2
|
||||
|
||||
[filter_radius]
|
||||
terrain=Ww
|
||||
[/filter_radius]
|
||||
|
||||
[filter_adjacent_location]
|
||||
terrain=Ds,*^Bw*
|
||||
[/filter_adjacent_location]
|
||||
[or]
|
||||
find_in=already_picked_transport_destination_surroundings
|
||||
[/or]
|
||||
|
||||
[not]
|
||||
find_in=already_picked_transport_destination_surroundings
|
||||
[/not]
|
||||
variable=already_picked_transport_destination_surroundings
|
||||
[/store_locations]
|
||||
|
||||
variable=possible_transport_destinations
|
||||
[/store_locations]
|
||||
|
||||
{VARIABLE_OP transport_destination_index rand "1..$possible_transport_destinations.length"}
|
||||
{VARIABLE_OP transport_destination_index sub 1}
|
||||
|
||||
{VARIABLE stored_transports[$i].variables.destination_x $possible_transport_destinations[$transport_destination_index].x}
|
||||
{VARIABLE stored_transports[$i].variables.destination_y $possible_transport_destinations[$transport_destination_index].y}
|
||||
{VARIABLE stored_transports[$i].variables.destination_set yes}
|
||||
|
||||
[store_locations]
|
||||
x=$stored_transports[$i].variables.destination_x
|
||||
y=$stored_transports[$i].variables.destination_y
|
||||
radius=2
|
||||
|
||||
[filter_radius]
|
||||
terrain=Ww,Ds,*^Bw*
|
||||
[/filter_radius]
|
||||
|
||||
[or]
|
||||
find_in=already_picked_transport_destination_surroundings
|
||||
[/or]
|
||||
|
||||
variable=already_picked_transport_destination_surroundings
|
||||
[/store_locations]
|
||||
|
||||
[unstore_unit]
|
||||
variable=stored_transports[$i]
|
||||
[/unstore_unit]
|
||||
{NEXT i}
|
||||
|
||||
[store_unit]
|
||||
[filter]
|
||||
type=Transport Galleon
|
||||
side=3
|
||||
|
||||
[not]
|
||||
[filter_wml]
|
||||
[variables]
|
||||
landed=yes
|
||||
[/variables]
|
||||
[/filter_wml]
|
||||
[/not]
|
||||
[/filter]
|
||||
|
||||
kill=yes
|
||||
variable=stored_transports
|
||||
[/store_unit]
|
||||
|
||||
{FOREACH stored_transports i}
|
||||
{VARIABLE stored_transports[$i].goto_x $stored_transports[$i].variables.destination_x}
|
||||
{VARIABLE stored_transports[$i].goto_y $stored_transports[$i].variables.destination_y}
|
||||
|
||||
[unstore_unit]
|
||||
variable=stored_transports[$i]
|
||||
[/unstore_unit]
|
||||
{NEXT i}
|
||||
|
||||
{CLEAR_VARIABLE stored_transports}
|
||||
{CLEAR_VARIABLE transport_destination_index,possible_transport_destinations}
|
||||
[/then]
|
||||
[/if]
|
||||
[/event]
|
||||
|
@ -379,14 +323,6 @@
|
|||
[filter]
|
||||
type=Transport Galleon
|
||||
|
||||
[not]
|
||||
[filter_wml]
|
||||
[variables]
|
||||
landed=yes
|
||||
[/variables]
|
||||
[/filter_wml]
|
||||
[/not]
|
||||
|
||||
[filter_wml]
|
||||
[variables]
|
||||
destination_x=$x1
|
||||
|
@ -510,7 +446,7 @@
|
|||
message= _ "Well, we have no choice... I’ve never tasted scorpions but I am sure they are good. This journey will be fun."
|
||||
[/message]
|
||||
|
||||
{CLEAR_VARIABLE possible_transport_destinations,already_picked_transport_destination_surroundings}
|
||||
{CLEAR_VARIABLE already_picked_transport_destination_surroundings}
|
||||
|
||||
[endlevel]
|
||||
result=victory
|
||||
|
|
Loading…
Add table
Reference in a new issue