NR S7-8: avoid recreating the new companions from scratch

This commit is contained in:
joeylmaalouf 2018-07-26 22:11:41 -04:00 committed by Severin Glöckner
parent 7c70c1d985
commit 4befb3580d
2 changed files with 76 additions and 40 deletions

View file

@ -899,6 +899,70 @@
[/endlevel]
[/event]
[event]
name=victory
[store_unit]
# Get references to the new companions joining us next scenario.
[filter]
id="Stalrag,Ro'Arthian,Ro'Sothian"
[/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]
[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]
{CLEAR_VARIABLE new_companions}
[/event]
# And if the allied AI dies player loses
[event]
name=last breath

View file

@ -100,46 +100,6 @@
# wmllint: recognize Tallin
{CHARACTER_STATS_TALLIN}
[unit]
type=Dwarvish Lord
id=Stalrag
name= _ "Stalrag"
profile=portraits/Stalrag.png
x,y=15,2
side=1
[modifications]
{TRAIT_LOYAL}
{TRAIT_HEALTHY}
[/modifications]
{IS_LOYAL}
[/unit]
[unit]
type=Ancient Lich
id="Ro'Arthian"
name= _ "RoArthian"
profile=portraits/Arthian.png
side=1
x,y=15,2
[modifications]
{TRAIT_LOYAL}
[/modifications]
{IS_HERO}
[/unit]
[unit]
type=Lich
id="Ro'Sothian"
name= _ "RoSothian"
profile=portraits/Ro_Sothian.png
side=1
x,y=15,2
[modifications]
{TRAIT_LOYAL}
[/modifications]
{IS_HERO}
[/unit]
[/side]
# wmllint: validate-on
@ -252,6 +212,18 @@
id=Elenia
[/recall]
[recall]
id=Stalrag
[/recall]
[recall]
id="Ro'Arthian"
[/recall]
[recall]
id="Ro'Sothian"
[/recall]
[objectives]
side=1
[objective]