NR Path B:

* to enable playing the path in debug mode
  * set the betrayed friend variable in S5
  * overwrite redruits and gold
* use lua for unit transformations
* clean up code in S5
* fix ellipse change having no effect (probably since 1.12)
  * work around bug 3172

[ci skip]
This commit is contained in:
Severin Glöckner 2018-05-25 19:50:18 +02:00
parent 8b467104bf
commit cca5b6f776
7 changed files with 70 additions and 142 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 742 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -445,21 +445,14 @@
# [disallow_recruit]
# side=1
# type=Dwarvish Fighter,Dwarvish Thunderer,Peasant,Thug,Poacher,Woodsman,Dwarvish Scout,Footpad
# [/disallow_recruit]
# [store_unit]
# [filter]
# role=Supporter
# [/filter]
# variable=betrayed_friend
# [/store_unit]
# {VARIABLE turned_evil yes}
# [endlevel]
# result=victory
# bonus=no
# carryover_percentage=0
# next_scenario=05b_Compelled
# [/endlevel]
# [/command]
@ -602,6 +595,7 @@
# boolean_equals=yes
# [/variable]
# [then]
# {CLEAR_VARIABLE turned_evil}
[message]
speaker=Tallin
message= _ "We have finally secured the mines. But what should we do about that foul lich? He is a menace to all that lives, and must be ended."

View file

@ -38,7 +38,7 @@
canrecruit=yes
side=1
controller=human
gold=100
gold=200
recruit=Walking Corpse
team_name=mob
user_team_name=_"Minions"
@ -55,9 +55,7 @@
recruit=Troll Whelp
team_name=trolls
user_team_name=_"Trolls"
[ai]
recruitment_pattern=fighter
[/ai]
{NOTRAIT_UNIT 2 "Giant Spider" 19 9} {GUARDIAN}
[/side]
[side]
@ -70,9 +68,7 @@
recruit=Troll Whelp
team_name=trolls
user_team_name=_"Trolls"
[ai]
recruitment_pattern=fighter
[/ai]
{NOTRAIT_UNIT 3 "Giant Spider" 20 3} {GUARDIAN}
[/side]
[event]
@ -96,63 +92,68 @@
[/gold_carryover]
[/objectives]
{STORE_UNIT_VAR id=Tallin level old_tallin_level}
[switch]
variable=old_tallin_level
[case]
value=0,1
{VARIABLE new_tallin_type "Dark Adept"}
{VARIABLE new_tallin_moves 5}
[/case]
[case]
value=2
{VARIABLE new_tallin_type "Dark Sorcerer"}
{VARIABLE new_tallin_moves 5}
[/case]
[else]
{VARIABLE new_tallin_type Lich}
{VARIABLE new_tallin_moves 6}
[/else]
[/switch]
[lua]
code = <<
local u = wesnoth.get_units({ id = 'Tallin' })[1]
if u.level <= 1 then
u:transform('Dark Adept')
elseif u.level == 2 then
u:transform('Dark Sorcerer')
else
u:transform('Necromancer')
-- his portrait does not fit for a lich
-- however, he can advance one it if he has a lower level
-- u:transform('Lich')
-- u.moves = u.max_moves
end
u.hitpoints = u.max_hitpoints
u.experience = 0
>>
[/lua]
# It's questionable whether we should do this here...
[modify_unit]
[filter]
id=Tallin
[/filter]
type=$new_tallin_type
moves=$new_tallin_moves
[object]
duration=scenario
[effect]
apply_to=ellipse
# The engine detects that this is a leader unit, and automatically
# changes the ellipse. To override it, a custom image is used
ellipse=ellipse/unprivileged
[/effect]
[/object]
[/modify_unit]
# Sadly, due to some limitation, we cannot change the ellipse in the [modify_unit] block above
[modify_unit]
# Workaround (as of 1.14.1), manually reset the ellipse as the engine does do it for expiring objects
[event]
name=victory
[modify_unit]
[filter]
id=Tallin
[/filter]
[effect]
apply_to=ellipse
ellipse=
[/effect]
[/modify_unit]
[/event]
# Debug mode help: ensure there is not more gold available, and clear the recruits
[modify_side]
side=1
gold=200
recruit=Walking Corpse
[/modify_side]
[store_unit]
[filter]
id=Tallin
role=Supporter
[/filter]
ellipse="misc/ellipse"
[/modify_unit]
{CLEAR_VARIABLE old_tallin_level,new_tallin_type,new_tallin_moves}
[store_gold]
side=1
variable=reset_gold
[/store_gold]
{VARIABLE_OP reset_gold multiply -1}
[gold]
side=1
amount=$reset_gold
[/gold]
[gold]
side=1
amount=200
[/gold]
{CLEAR_VARIABLE reset_gold}
variable=betrayed_friend
[/store_unit]
[kill]
side=1
@ -162,28 +163,6 @@
[/kill]
[/event]
[event]
name=start
{MODIFY_UNIT id=Tallin alignment chaotic}
[unit]
type=Giant Spider
x=19
y=9
side=2
ai_special=guardian
[/unit]
[unit]
type=Giant Spider
x=3
y=20
side=3
ai_special=guardian
[/unit]
[/event]
[event]
name=last breath
[filter]

View file

@ -59,63 +59,18 @@
hitpoints=$betrayed_friend.hitpoints
[/unit]
[store_unit]
[filter]
id=Tallin
[/filter]
variable=typechange
kill=yes
[/store_unit]
[if]
[variable]
name=typechange.type
equals=Dark Adept
[/variable]
[then]
[set_variable]
name=typechange.type
value=Sergeant
[/set_variable]
[/then]
[/if]
[if]
[variable]
name=typechange.type
equals=Dark Sorcerer
[/variable]
[then]
[set_variable]
name=typechange.type
value=Lieutenant
[/set_variable]
[/then]
[/if]
[if]
[variable]
name=typechange.type
equals=Lich
[/variable]
[or]
[variable]
name=typechange.type
equals=Necromancer
[/variable]
[/or]
[then]
[set_variable]
name=typechange.type
value=General
[/set_variable]
[/then]
[/if]
[unstore_unit]
variable=typechange
[/unstore_unit]
{CLEAR_VARIABLE typechange}
[lua]
code = <<
local u = wesnoth.get_units({ id = 'Tallin' })[1]
if u.type == 'Dark Adept' then
u:transform('Sergeant')
elseif u.type == 'Dark Sorcerer' then
u:transform('Lieutenant')
else
u:transform('General')
end
>>
[/lua]
[/event]
[event]