Rewrote the ADVANCE_UNIT macro.

This commit is contained in:
Fabian Müller 2010-11-25 22:12:30 +00:00
parent 049c769f44
commit 47ed3148f6

View file

@ -215,43 +215,13 @@
#! {ADVANCE_UNIT type=Spearman Cavalryman}
# Example to advance your leader normally:
#! {ADVANCE_UNIT canrecruit,side=yes,1 ""}
[store_unit]
[modify_unit]
[filter]
{FILTER}
[/filter]
variable=ADVANCE_UNIT_store
kill=no
[/store_unit]
[set_variable]
name=advanceto_len
string_length={ID_STRING}
[/set_variable]
{FOREACH ADVANCE_UNIT_store i}
[if]
[variable]
name=advanceto_len
greater_than=0
[/variable]
[then]
[set_variable]
name=ADVANCE_UNIT_store[$i].advances_to
value={ID_STRING}
[/set_variable]
[/then]
[/if]
[set_variable]
name=ADVANCE_UNIT_store[$i].experience
value=$ADVANCE_UNIT_store[$i].max_experience
[/set_variable]
[unstore_unit]
variable=ADVANCE_UNIT_store[$i]
find_vacant=no
advance=true
[/unstore_unit]
{NEXT i}
{CLEAR_VARIABLE ADVANCE_UNIT_store}
{CLEAR_VARIABLE advanceto_len}
type={ID_STRING}
[/modify_unit]
#enddef
#define TRANSFORM_UNIT FILTER TYPE