DiD S11 & S12: transform all Mages instead of changing their advancements

This has the advantage that they use the same help page as newwly
recruited ons, and their advancement options are correctly shown there.

The transformation code is taken from SotA S18

[ci_skip]
This commit is contained in:
Severin Glöckner 2018-05-24 20:26:32 +02:00
parent 0f511e8e55
commit a24068ad02

View file

@ -520,8 +520,65 @@
[/remove_item]
# Previously recruited and new adepts can now also become liches
{MODIFY_UNIT (type=Dark Adept DiD) advances_to (Dark Sorcerer)}
{MODIFY_UNIT (type=Dark Sorcerer DiD) advances_to (Lich,Necromancer)}
# To tranform them, all units from the recall list get copied
# and replaced by a new one with the changed type
[store_unit]
[filter]
type=Dark Adept DiD, Dark Sorcerer DiD
[/filter]
variable=mages
kill=yes
[/store_unit]
[for]
array=mages
variable=i
[do]
# Get the new type:
[switch]
variable=mages[$i].type
[case]
value=Dark Adept DiD
[set_variable]
name=new_type
value=Dark Adept
[/set_variable]
[/case]
[case]
value=Dark Sorcerer DiD
[set_variable]
name=new_type
value=Dark Sorcerer
[/set_variable]
[/case]
[/switch]
# Create a new mage with the same attributes as the old one:
[unit]
type=$new_type
max_experience=$mages[$i].max_experience
max_hitpoints=$mages[$i].max_hitpoints
experience=$mages[$i].experience
name=$mages[$i].name
id=$mages[$i].id
gender=$mages[$i].gender
side=1
placement=recall # The only place they can be at the moment.
[modifications]
[insert_tag]
name=trait
variable=mages[$i].modifications.trait[0]
[/insert_tag]
[insert_tag]
name=trait
variable=mages[$i].modifications.trait[1]
[/insert_tag]
[/modifications]
[/unit]
[/do]
[/for]
{CLEAR_VARIABLE mages,new_type}
[disallow_recruit]
side=1