Skip to content

Commit

Permalink
SotA S18: move DA transformation to lua
Browse files Browse the repository at this point in the history
[ci skip]
  • Loading branch information
sevu committed May 26, 2018
1 parent acf9a98 commit 627c39a
Showing 1 changed file with 13 additions and 43 deletions.
Expand Up @@ -148,49 +148,19 @@ Now the process is complete for both of us. I posted a guard so nothing could ha
[/allow_recruit]

# This section changes all *existing* units so that they have liches in their
# advancement trees. As of 1.12 at least, [modify_unit] doesn't apply to
# the recall list, so we have to do it the long way.
[store_unit]
[filter]
type=Dark Adept SotA, Dark Sorcerer SotA
[/filter]
variable=DA # Even though it might actually be a DS.
[/store_unit]

[for]
array=DA
variable=i
[do]
[if]
[variable]
name=DA[$i].type
equals=Dark Adept SotA
[/variable]
[then]
[set_variable]
# Custom DA's will advance to normal dark sorcerers
# which will fix them.
name=DA[$i].advances_to
value=Dark Sorcerer
[/set_variable]
[/then]
[else]
[set_variable]
# Custom DS's just get the other advancement added.
name=DA[$i].advances_to
value=Necromancer,Lich
[/set_variable]
[/else]
[/if]
[unstore_unit]
variable=DA[$i]
[/unstore_unit]
[/do]
[/for]

[clear_variable]
name=DA
[/clear_variable]
# advancement trees. As of 1.14 at least, [modify_unit] doesn't apply to
# the recall list, same for [transform_unit].
[lua]
code = <<
for i, u in ipairs(wesnoth.get_recall_units { type = 'Dark Adept SotA, Dark Sorcerer SotA' }) do
if u.type == 'Dark Adept SotA' then
u:transform('Dark Adept')
elseif u.type == 'Dark Sorcerer SotA' then
u:transform('Dark Sorcerer')
end
end
>>
[/lua]

# We need to change all existing bats to normal types instead of SotA types
# so they are drawn above terrains. SotA bats were necessary for the ship
Expand Down

0 comments on commit 627c39a

Please sign in to comment.