Skip to content

Commit

Permalink
DiD S11 & S12: transform all Mages instead of changing their advancem…
Browse files Browse the repository at this point in the history
…ents

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]
  • Loading branch information
sevu committed May 24, 2018
1 parent 0f511e8 commit a24068a
Showing 1 changed file with 59 additions and 2 deletions.
Expand Up @@ -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
Expand Down

0 comments on commit a24068a

Please sign in to comment.