UtBS S6: Rewrite fire guardians' evocation events

Renames two variables, substitutes [if] tags with
[filter_condition] in order to reduce nested tags
and defines a custom event for the evocation of
the immortal fire guardian
This commit is contained in:
DisherProject 2019-03-04 14:55:07 +01:00
parent a656bfae71
commit 4412a4b256

View file

@ -250,16 +250,6 @@ _ "These undead trolls fight again in death as they did in life, except this tim
value={ON_DIFFICULTY 2 3 4}
[/set_variable]
[set_variable]
name=summon_flame
value=0
[/set_variable]
[set_variable]
name=flame_counter
value=0
[/set_variable]
# create AI=guardian units. They can't move unless an enemy
# moves nearby. I create them at the beginning because when the
# player sees them, events will fire.
@ -973,15 +963,27 @@ _ "These undead trolls fight again in death as they did in life, except this tim
image=wesnoth-icon.png
[/message]
[set_variable]
name=summon_flame
value=2
[/set_variable]
[event]
name=new turn
[set_variable]
name=flame_counter
value=5
[/set_variable]
[message]
role=Troll High Shaman
message= _ "Arise! Arise and engulf the intruders in your holy fire!"
[/message]
[fire_event]
name=evoke_flame_guardian
[/fire_event]
[message]
side=1
x,y=16-29,11-23
message= _ "What the heck is that? It sure doesnt look good. The last thing we need in here is even more fire."
[/message]
{VARIABLE summon_flame_guardian yes}
{VARIABLE flame_guardian_turn_counter 0}
[/event]
[/event]
# pool of water lets player heal halfway
@ -1023,199 +1025,61 @@ _ "These undead trolls fight again in death as they did in life, except this tim
[/heal_unit]
[/event]
# This function fires each turn and checks to see if it should summon
# a "Fire Pheonix" fire guardian, based on the value of the summon_flame
# variable and on the value of the flame_counter
[event]
name=evoke_flame_guardian
first_time_only=no
# when the fire guardian unit dies, the flame_counter is reset to 0
{FLASH_RED (
[unit]
side=5
type={ON_DIFFICULTY (Fire Guardian) (Fire Guardian2) (Fire Guardian3)}
x,y=26,21
name= _ "Guardian Phoenix"
role="Guardian Phoenix"
random_traits=no
[/unit]
)}
# each turn flame_counter is incremented until it reached 4 (on hard
# difficulty) or 5, then a new fire guardian is summoned and
# summon_flame is turned back to 0.
[scroll_to_unit]
x,y=26,21
[/scroll_to_unit]
# summon_flame=0: fire guardian has been created, is alive, don't create another
# summon_flame=1: fire guardian has been killed, create another
# summon_flame=2: create fire guardian for first time, elves are amazed
# summon_flame=3: player has reached troll shamans, stop summoning fire guardians
[delay]
time=250
[/delay]
[/event]
[event]
name=new turn
first_time_only=no
[filter_condition]
[variable]
name=summon_flame_guardian
boolean_equals=yes
[/variable]
[/filter_condition]
[set_variable]
name=flame_counter
add=1
[/set_variable]
{VARIABLE_OP flame_guardian_turn_counter sub 1}
[if]
[variable]
name=summon_flame
numerical_equals=2
name=flame_guardian_turn_counter
numerical_equals=0
[/variable]
#ifdef HARD
[variable]
name=flame_counter
greater_than=3
[/variable]
#else
[variable]
name=flame_counter
greater_than=4
[/variable]
#endif
[then]
[message]
role=Troll High Shaman
message= _ "Arise! Arise and engulf the intruders in your holy fire!"
[/message]
[color_adjust]
red,green,blue=255,0,0
[/color_adjust]
[redraw]
[/redraw]
[delay]
time=100
[/delay]
[color_adjust]
red,green,blue=0,0,0
[/color_adjust]
[redraw]
[/redraw]
#ifdef EASY
{NAMED_NOTRAIT_UNIT 5 (Fire Guardian) 26 21 () ( _ "Guardian Phoenix")}
[+unit]
role=Guardian Phoenix
[/unit]
#endif
#ifdef NORMAL
{NAMED_NOTRAIT_UNIT 5 (Fire Guardian2) 26 21 () ( _ "Guardian Phoenix")}
[+unit]
role=Guardian Phoenix
[/unit]
#endif
#ifdef HARD
{NAMED_NOTRAIT_UNIT 5 (Fire Guardian3) 26 21 () ( _ "Guardian Phoenix")}
[+unit]
role=Guardian Phoenix
[/unit]
#endif
[scroll_to_unit]
x,y=26,21
[/scroll_to_unit]
[delay]
time=250
[/delay]
[fire_event]
name=evoke_flame_guardian
[/fire_event]
[message]
side=1
x,y=16-29,11-23
message= _ "What the heck is that? It sure doesnt look good. The last thing we need in here is even more fire."
message= _ "That thing just wont stay dead!"
[/message]
[set_variable]
name=summon_flame
value=0
[/set_variable]
[/then]
[else]
[if]
[variable]
name=summon_flame
numerical_equals=1
[/variable]
#ifdef HARD
[variable]
name=flame_counter
greater_than=3
[/variable]
#else
[variable]
name=flame_counter
greater_than=4
[/variable]
#endif
[then]
[color_adjust]
red,green,blue=255,0,0
[/color_adjust]
[redraw]
[/redraw]
[delay]
time=100
[/delay]
[color_adjust]
red,green,blue=0,0,0
[/color_adjust]
[redraw]
[/redraw]
#ifdef EASY
{NAMED_NOTRAIT_UNIT 5 (Fire Guardian) 26 21 () ( _ "Guardian Phoenix")}
[+unit]
role=Guardian Phoenix
[/unit]
#endif
#ifdef NORMAL
{NAMED_NOTRAIT_UNIT 5 (Fire Guardian2) 26 21 () ( _ "Guardian Phoenix")}
[+unit]
role=Guardian Phoenix
[/unit]
#endif
#ifdef HARD
{NAMED_NOTRAIT_UNIT 5 (Fire Guardian3) 26 21 () ( _ "Guardian Phoenix")}
[+unit]
role=Guardian Phoenix
[/unit]
#endif
[scroll_to_unit]
x,y=42,90
[/scroll_to_unit]
[delay]
time=250
[/delay]
[set_variable]
name=summon_flame
value=0
[/set_variable]
[message]
side=1
x,y=16-29,11-23
message= _ "That thing just wont stay dead!"
[/message]
[/then]
[/if]
[/else]
[/if]
[/event]
# when fire guardian dies, switch summon_flame back to 1
# and reset flame_counter back to 0
[event]
name=die
first_time_only=no
@ -1223,25 +1087,14 @@ _ "These undead trolls fight again in death as they did in life, except this tim
[filter]
role=Guardian Phoenix
[/filter]
[if]
[filter_condition]
[variable]
name=summon_flame
less_than=3
name=summon_flame_guardian
boolean_equals=yes
[/variable]
[/filter_condition]
[then]
[set_variable]
name=summon_flame
value=1
[/set_variable]
[set_variable]
name=flame_counter
value=0
[/set_variable]
[/then]
[/if]
{VARIABLE flame_guardian_turn_counter {ON_DIFFICULTY 5 5 4}}
[/event]
# Troll shamans raise more Fire Guardians out of the lava
@ -1258,38 +1111,35 @@ _ "These undead trolls fight again in death as they did in life, except this tim
y=18-25
side=1
[/filter]
[if]
[filter_condition]
[variable]
name=summon_flame
numerical_not_equals=3
name=summon_flame_guardian
boolean_equals=yes
[/variable]
[/filter_condition]
[then]
[message]
role=Troll High Shaman
message= _ "Arise, hallowed guardians, and destroy them!"
[/message]
[message]
role=Troll High Shaman
message= _ "Arise, hallowed guardians, and destroy them!"
[/message]
[scroll_to]
x,y=26,17
[/scroll_to]
[scroll_to]
x,y=26,17
[/scroll_to]
{NAMED_NOTRAIT_UNIT 5 (Fire Guardian2) 26 17 () ( _ "Fire Guardian")}
{NAMED_NOTRAIT_UNIT 5 (Fire Guardian2) 26 18 () ( _ "Fire Guardian")}
{NAMED_NOTRAIT_UNIT 5 (Fire Guardian2) 26 17 () ( _ "Fire Guardian")}
{NAMED_NOTRAIT_UNIT 5 (Fire Guardian2) 26 18 () ( _ "Fire Guardian")}
#ifdef HARD
{NAMED_NOTRAIT_UNIT 5 (Fire Guardian3) 25 18 () ( _ "Fire Guardian")}
{NAMED_NOTRAIT_UNIT 5 (Fire Guardian3) 25 18 () ( _ "Fire Guardian")}
#endif
{CHECK_EXPLORER}
[message]
speaker=$explorer.id
message= _ "Look, more fire guardians!"
[/message]
{CLEAR_VARIABLE explorer}
[/then]
[/if]
{CHECK_EXPLORER}
[message]
speaker=$explorer.id
message= _ "Look, more fire guardians!"
[/message]
{CLEAR_VARIABLE explorer}
[/event]
[event]
@ -1300,37 +1150,34 @@ _ "These undead trolls fight again in death as they did in life, except this tim
y=25-26
side=1
[/filter]
[if]
[filter_condition]
[variable]
name=summon_flame
numerical_not_equals=3
name=summon_flame_guardian
boolean_equals=yes
[/variable]
[/filter_condition]
[then]
[message]
role=Troll High Shaman
message= _ "Arise and attack them now, while they are vulnerable!"
[/message]
[message]
role=Troll High Shaman
message= _ "Arise and attack them now, while they are vulnerable!"
[/message]
[scroll_to]
x,y=42,91
[/scroll_to]
[scroll_to]
x,y=42,91
[/scroll_to]
{NAMED_NOTRAIT_UNIT 5 (Fire Guardian3) 26 22 () ( _ "Fire Guardian")}
{NAMED_NOTRAIT_UNIT 5 (Fire Guardian3) 27 22 () ( _ "Fire Guardian")}
{NAMED_NOTRAIT_UNIT 5 (Fire Guardian3) 26 22 () ( _ "Fire Guardian")}
{NAMED_NOTRAIT_UNIT 5 (Fire Guardian3) 27 22 () ( _ "Fire Guardian")}
#ifdef HARD
{NAMED_NOTRAIT_UNIT 5 (Fire Guardian3) 26 21 () ( _ "Fire Guardian")}
{NAMED_NOTRAIT_UNIT 5 (Fire Guardian3) 26 21 () ( _ "Fire Guardian")}
#endif
{CHECK_EXPLORER}
[message]
speaker=$explorer.id
message= _ "Oh great, even more fire guardians. When I get through this inferno Im going to kill those trolls."
[/message]
{CLEAR_VARIABLE explorer}
[/then]
[/if]
{CHECK_EXPLORER}
[message]
speaker=$explorer.id
message= _ "Oh great, even more fire guardians. When I get through this inferno Im going to kill those trolls."
[/message]
{CLEAR_VARIABLE explorer}
[/event]
[event]
@ -1341,36 +1188,33 @@ _ "These undead trolls fight again in death as they did in life, except this tim
y=17-24
side=1
[/filter]
[if]
[filter_condition]
[variable]
name=summon_flame
numerical_not_equals=3
name=summon_flame_guardian
boolean_equals=yes
[/variable]
[/filter_condition]
[then]
[message]
role=Troll High Shaman
message= _ "They must not be allowed to cross to the other side! Kill them!"
[/message]
[message]
role=Troll High Shaman
message= _ "They must not be allowed to cross to the other side! Kill them!"
[/message]
[scroll_to]
x,y=22,16
[/scroll_to]
[scroll_to]
x,y=22,16
[/scroll_to]
{NAMED_NOTRAIT_UNIT 5 (Fire Guardian3) 23 17 () ( _ "Fire Guardian")}
{NAMED_NOTRAIT_UNIT 5 (Fire Guardian3) 22 16 () ( _ "Fire Guardian")}
{NAMED_NOTRAIT_UNIT 5 (Fire Guardian3) 23 17 () ( _ "Fire Guardian")}
{NAMED_NOTRAIT_UNIT 5 (Fire Guardian3) 22 16 () ( _ "Fire Guardian")}
#ifdef HARD
{NAMED_NOTRAIT_UNIT 5 (Fire Guardian3) 22 17 () ( _ "Fire Guardian")}
{NAMED_NOTRAIT_UNIT 5 (Fire Guardian3) 22 17 () ( _ "Fire Guardian")}
#endif
{CHECK_EXPLORER}
[message]
speaker=$explorer.id
message= _ "How surprising, more fire guardians. Im going to be really glad to get out of this cavern."
[/message]
{CLEAR_VARIABLE explorer}
[/then]
[/if]
{CHECK_EXPLORER}
[message]
speaker=$explorer.id
message= _ "How surprising, more fire guardians. Im going to be really glad to get out of this cavern."
[/message]
{CLEAR_VARIABLE explorer}
[/event]
#at end of lava cavern, trolls come alive
@ -1383,10 +1227,7 @@ _ "These undead trolls fight again in death as they did in life, except this tim
side=1
[/filter]
[set_variable]
name=summon_flame
value=3
[/set_variable]
{VARIABLE summon_flame_guardian no}
[message]
x,y=18,23
@ -1948,8 +1789,8 @@ _ "These undead trolls fight again in death as they did in life, except this tim
{CLEAR_VARIABLE i}
{CLEAR_VARIABLE heat_damage}
{CLEAR_VARIABLE summon_flame}
{CLEAR_VARIABLE flame_counter}
{CLEAR_VARIABLE summon_flame_guardian}
{CLEAR_VARIABLE flame_guardian_turn_counter}
[/event]
[event]