Fix several bugs introduced with the FOREACH replacement.
This commit is contained in:
parent
b8b72750f9
commit
8a9feb10ac
8 changed files with 69 additions and 66 deletions
|
@ -527,7 +527,6 @@ Soooo... It is you who sent your subordinates to attack us. Now when we’ve des
|
|||
[/if]
|
||||
[/do]
|
||||
[/for]
|
||||
{CLEAR_VARIABLE i}
|
||||
[/event]
|
||||
|
||||
[event]
|
||||
|
|
|
@ -282,7 +282,7 @@ Chapter Three"
|
|||
[else]
|
||||
{VARIABLE l3_length $l3_store_{NAME}.length}
|
||||
{VARIABLE_OP l3_length sub 1}
|
||||
[foreach]
|
||||
[for]
|
||||
array=l3_store_{NAME}
|
||||
# for-case, what a great anti-pattern
|
||||
[do]
|
||||
|
@ -292,25 +292,25 @@ Chapter Three"
|
|||
value=0
|
||||
[set_variable]
|
||||
name=left_behind_{NAME}
|
||||
value=$this_item.name
|
||||
value=$l3_store_{NAME}[$i].name
|
||||
[/set_variable]
|
||||
[/case]
|
||||
[case]
|
||||
value=$l3_length
|
||||
[set_variable]
|
||||
name=left_behind_{NAME}
|
||||
value= _ "$left_behind_{NAME} and $this_item.name" # wmllint: ignore
|
||||
value= _ "$left_behind_{NAME} and $l3_store_{NAME}[$i].name" # wmllint: ignore
|
||||
[/set_variable]
|
||||
[/case]
|
||||
[else]
|
||||
[set_variable]
|
||||
name=left_behind_{NAME}
|
||||
value= _ "$left_behind_{NAME}|, $this_item.name" # wmllint: ignore
|
||||
value= _ "$left_behind_{NAME}|, $l3_store_{NAME}[$i].name" # wmllint: ignore
|
||||
[/set_variable]
|
||||
[/else]
|
||||
[/switch]
|
||||
[/do]
|
||||
[/foreach]
|
||||
[/for]
|
||||
{CLEAR_VARIABLE l3_length}
|
||||
[/else]
|
||||
[/switch]
|
||||
|
|
|
@ -381,58 +381,62 @@
|
|||
[for]
|
||||
array=stored_changers
|
||||
variable=i
|
||||
[for]
|
||||
array=undead_transformation
|
||||
variable=j
|
||||
[do]
|
||||
[for]
|
||||
array=undead_transformation
|
||||
variable=j
|
||||
[do]
|
||||
[if]
|
||||
[variable]
|
||||
name=stored_changers[$i].type
|
||||
equals=$undead_transformation[$j].human_type
|
||||
[/variable]
|
||||
|
||||
[then]
|
||||
{VARIABLE type_to_turn_into $undead_transformation[$j].undead_type}
|
||||
{VARIABLE j 999}
|
||||
[/then]
|
||||
[/if]
|
||||
[/do]
|
||||
[/for]
|
||||
|
||||
{FALLBACK}
|
||||
[unit]
|
||||
type=$type_to_turn_into
|
||||
side=3
|
||||
x,y=$stored_changers[$i].x,$stored_changers[$i].y
|
||||
id=$stored_changers[$i].id
|
||||
name=$stored_changers[$i].name
|
||||
experience=$stored_changers[$i].experience
|
||||
hitpoints=$stored_changers[$i].hitpoints
|
||||
canrecruit=$stored_changers[$i].canrecruit
|
||||
[variables]
|
||||
[insert_tag]
|
||||
name=stored_trait
|
||||
variable=stored_changers[$i].modifications.trait
|
||||
[/insert_tag]
|
||||
|
||||
turned_to_undead_at_least_once=yes
|
||||
[/variables]
|
||||
to_variable=changer
|
||||
[/unit]
|
||||
{CLEAR_VARIABLE type_to_turn_into}
|
||||
|
||||
[if]
|
||||
[variable]
|
||||
name=stored_changers[$i].type
|
||||
equals=$undead_transformation[$j].human_type
|
||||
name=changer.hitpoints
|
||||
greater_than=$changer.max_hitpoints
|
||||
[/variable]
|
||||
|
||||
[then]
|
||||
{VARIABLE type_to_turn_into $undead_transformation[$j].undead_type}
|
||||
{VARIABLE j 999}
|
||||
{VARIABLE changer.hitpoints $changer.max_hitpoints}
|
||||
[/then]
|
||||
[/if]
|
||||
[/for]
|
||||
|
||||
{FALLBACK}
|
||||
[unit]
|
||||
type=$type_to_turn_into
|
||||
side=3
|
||||
x,y=$stored_changers[$i].x,$stored_changers[$i].y
|
||||
id=$stored_changers[$i].id
|
||||
name=$stored_changers[$i].name
|
||||
experience=$stored_changers[$i].experience
|
||||
hitpoints=$stored_changers[$i].hitpoints
|
||||
canrecruit=$stored_changers[$i].canrecruit
|
||||
[variables]
|
||||
[insert_tag]
|
||||
name=stored_trait
|
||||
variable=stored_changers[$i].modifications.trait
|
||||
[/insert_tag]
|
||||
|
||||
turned_to_undead_at_least_once=yes
|
||||
[/variables]
|
||||
to_variable=changer
|
||||
[/unit]
|
||||
{CLEAR_VARIABLE type_to_turn_into}
|
||||
|
||||
[if]
|
||||
[variable]
|
||||
name=changer.hitpoints
|
||||
greater_than=$changer.max_hitpoints
|
||||
[/variable]
|
||||
|
||||
[then]
|
||||
{VARIABLE changer.hitpoints $changer.max_hitpoints}
|
||||
[/then]
|
||||
[/if]
|
||||
|
||||
[unstore_unit]
|
||||
variable=changer
|
||||
[/unstore_unit]
|
||||
[unstore_unit]
|
||||
variable=changer
|
||||
[/unstore_unit]
|
||||
[/do]
|
||||
[/for]
|
||||
|
||||
{CLEAR_VARIABLE stored_changers,changer}
|
||||
|
@ -512,7 +516,7 @@
|
|||
|
||||
[then]
|
||||
{VARIABLE type_to_turn_into $undead_transformation[$j].human_type}
|
||||
{VARIABLE j 999}
|
||||
[break][/break]
|
||||
[/then]
|
||||
[/if]
|
||||
[/do]
|
||||
|
|
|
@ -958,13 +958,13 @@
|
|||
[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}
|
||||
{VARIABLE this_item.goto_x $this_item.variables.dock_x}
|
||||
{VARIABLE this_item.goto_y $this_item.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 $this_item.variables.transport_num to return to $this_item.variables.dock_x|,$this_item.variables.dock_y"}
|
||||
|
||||
[unstore_unit]
|
||||
variable=returning_transports[$i]
|
||||
variable=this_item
|
||||
[/unstore_unit]
|
||||
[/do]
|
||||
[/foreach]
|
||||
|
|
|
@ -261,7 +261,7 @@
|
|||
terrain=*^F*
|
||||
|
||||
[and]
|
||||
x,y=$this_unit.x,$this_unit.y
|
||||
x,y=$this_item.x,$this_item.y
|
||||
radius=1
|
||||
[/and]
|
||||
|
||||
|
@ -272,7 +272,7 @@
|
|||
{VARIABLE_OP random sub 1}
|
||||
|
||||
[terrain]
|
||||
x,y=$this_unit.x,$this_unit.y
|
||||
x,y=$this_item.x,$this_item.y
|
||||
terrain=$adjacent_forests[$random].terrain
|
||||
[/terrain]
|
||||
[/do]
|
||||
|
|
|
@ -421,7 +421,7 @@
|
|||
array=side_4_villages
|
||||
[do]
|
||||
[capture_village]
|
||||
x,y=$this_unit.x,$this_unit.y
|
||||
x,y=$this_item.x,$this_item.y
|
||||
side=5
|
||||
[/capture_village]
|
||||
[/do]
|
||||
|
|
|
@ -500,8 +500,8 @@
|
|||
first_time_only=yes
|
||||
[filter]
|
||||
side=2,3,4
|
||||
x=$this_unit.x
|
||||
y=$this_unit.y
|
||||
x=$this_item.x
|
||||
y=$this_item.y
|
||||
[/filter]
|
||||
|
||||
[if]
|
||||
|
|
|
@ -616,27 +616,27 @@
|
|||
[do]
|
||||
[if]
|
||||
[variable]
|
||||
name=second_this_item.specials.length
|
||||
name=this_item.specials.length
|
||||
greater_than=0
|
||||
[/variable]
|
||||
|
||||
[variable]
|
||||
name=second_this_item.specials.chance_to_hit.length
|
||||
name=this_item.specials.chance_to_hit.length
|
||||
greater_than=0
|
||||
[/variable]
|
||||
|
||||
[then]
|
||||
[set_variables]
|
||||
name=second_this_item.specials.original_chance_to_hit
|
||||
to_variable=second_this_item.specials.chance_to_hit
|
||||
name=this_item.specials.original_chance_to_hit
|
||||
to_variable=this_item.specials.chance_to_hit
|
||||
[/set_variables]
|
||||
|
||||
{CLEAR_VARIABLE second_this_item.specials.chance_to_hit}
|
||||
{CLEAR_VARIABLE this_item.specials.chance_to_hit}
|
||||
[/then]
|
||||
[/if]
|
||||
|
||||
[set_variables]
|
||||
name=second_this_item.specials.chance_to_hit
|
||||
name=this_item.specials.chance_to_hit
|
||||
|
||||
[value]
|
||||
id=forced_cth
|
||||
|
|
Loading…
Add table
Reference in a new issue