NR S7: Fix some loyal heroes costing support

Loyal trait seems not to work with previous implementation.
This should be also more readable
This commit is contained in:
DisherProject 2018-10-21 00:19:45 +02:00 committed by Severin Glöckner
parent 6f385d6c93
commit 182efc0dcc

View file

@ -733,6 +733,7 @@
amount=1
[/heal_unit]
{CLEAR_VARIABLE heal_amount}
[message]
speaker=Tallin
@ -902,65 +903,28 @@
[event]
name=victory
[store_unit]
# Get references to the new companions joining us next scenario.
[modify_unit]
[filter]
id="Stalrag,Ro'Arthian,Ro'Sothian"
id=Stalrag
[/filter]
variable=new_companions
kill=no # Leave them visible on the field during linger mode.
[/store_unit]
[foreach]
array=new_companions
[do]
{VARIABLE this_item.side 1}
{VARIABLE this_item.canrecruit no}
# We'll be unstoring these units onto the recall list, which won't heal them automatically, so we do it here.
{CLEAR_VARIABLE this_item.attacks_left}
{CLEAR_VARIABLE this_item.moves}
{CLEAR_VARIABLE this_item.hitpoints}
{CLEAR_VARIABLE this_item.status}
# Stalrag gains the loyal and healthy traits, while Ro'Arthian and Ro'Sothian get loyal and undead.
[if]
[variable]
name=this_item.id
equals=Stalrag
[/variable]
[then]
{VARIABLE this_item.overlays misc/loyal-icon.png}
[set_variables]
name=this_item.modifications
mode=replace
[literal]
{TRAIT_LOYAL}
{TRAIT_HEALTHY}
[/literal]
[/set_variables]
[/then]
[else]
{VARIABLE this_item.overlays misc/hero-icon.png}
{VARIABLE this_item.ellipse misc/ellipse-hero}
[set_variables]
name=this_item.modifications
mode=replace
[literal]
{TRAIT_LOYAL}
{TRAIT_UNDEAD}
[/literal]
[/set_variables]
[/else]
[/if]
side=1
canrecruit=no
overlays="misc/loyal-icon.png"
{TRAIT_LOYAL}
[/modify_unit]
[unstore_unit]
# Put our referenced units onto the recall list so we have them in the next scenario.
variable=this_item
x,y=recall,recall
[/unstore_unit]
[/do]
[/foreach]
[modify_unit]
[filter]
id=Ro'Arthian,Ro'Sothian
[/filter]
{CLEAR_VARIABLE new_companions}
side=1
canrecruit=no
overlays="misc/hero-icon.png"
ellipse="misc/ellipse-hero"
{TRAIT_LOYAL}
[/modify_unit]
[/event]
# And if the allied AI dies player loses