Made QUICK_4MP_LEADERS append the quick trait correctly...

...if the unit has other traits, and also provided an override so
individual leaders can be excluded from getting the quick trait by
giving them unit.variables.dont_make_me_quick=yes.
This commit is contained in:
Lari Nieminen 2010-02-08 22:17:14 +00:00
parent 2661212b85
commit 810ad660d9

View file

@ -10,7 +10,8 @@
#enddef
#define QUICK_4MP_LEADERS
# This makes all leaders with 4 MP receive the quick trait.
# This makes all leaders with 4 MP receive the quick trait, except ones with
# unit.variables.dont_make_me_quick=yes (boolean)
[event]
name=prestart
@ -29,23 +30,49 @@
[/store_unit]
{FOREACH leaders_to_make_quick i}
[set_variables]
name=leaders_to_make_quick[$i].modifications
mode=merge
[if]
# The variable check is done here instead of in the [store_unit]
# so that all boolean values work
[variable]
name=leaders_to_make_quick[$i].variables.dont_make_me_quick
boolean_equals=yes
[/variable]
[literal]
{TRAIT_QUICK}
[/literal]
[/set_variables]
[then]
[unstore_unit]
variable=leaders_to_make_quick[$i]
[/unstore_unit]
[/then]
{CLEAR_VARIABLE leaders_to_make_quick[$i].max_moves,leaders_to_make_quick[$i].moves,leaders_to_make_quick[$i].max_hitpoints,leaders_to_make_quick[$i].hitpoints}
[else]
[set_variables]
name=temp
[unstore_unit]
variable=leaders_to_make_quick[$i]
[/unstore_unit]
[literal]
{TRAIT_QUICK}
[/literal]
[/set_variables]
[set_variables]
name=leaders_to_make_quick[$i].modifications.trait
mode=append
[insert_tag]
name=literal
variable=temp.trait
[/insert_tag]
[/set_variables]
{CLEAR_VARIABLE leaders_to_make_quick[$i].max_moves,leaders_to_make_quick[$i].moves,leaders_to_make_quick[$i].max_hitpoints,leaders_to_make_quick[$i].hitpoints}
[unstore_unit]
variable=leaders_to_make_quick[$i]
[/unstore_unit]
[/else]
[/if]
{NEXT i}
{CLEAR_VARIABLE leaders_to_make_quick}
{CLEAR_VARIABLE leaders_to_make_quick,temp}
[/event]
#enddef