Fix bad allow_undo in UtbS

The event changed the gamestate by adding an event
that changes the gamestate. We now use variables to instead of
nested events events since that is easier to handle in
[on_undo], which allows us to use [allow_undo] here.
This commit is contained in:
gfgtdf 2023-03-30 04:59:06 +02:00
parent 9804935cad
commit a71892e509

View file

@ -632,19 +632,22 @@
[/message]
[/event]
# The following three events are nested, because they are supposed to
# occur in that particular sequence with none of them bypassed.
# Thanks to this only one of them is loaded in memory at any given
# time before resolution.
# Approaching bridge dialog
[event]
name=moveto
first_time_only=no
[filter]
x=24-26
y=29-35
side=1
[/filter]
[filter_condition]
[variable]
name=bridge_event
equals=""
[/variable]
[/filter_condition]
# Allow to undo the move before the event is triggered
[allow_undo][/allow_undo]
@ -663,135 +666,153 @@
speaker=Kaleh
message= _ "Be careful. The bridge is broken, so well have to wade through the shallow water."
[/message]
[set_variable]
name=bridge_event
value=warned
[/set_variable]
[on_undo]
[clear_variable]
name=bridge_event
[/clear_variable]
[/on_undo]
[/event]
# Finding druids
# The following two events are nested, because they are supposed to
# occur in that particular sequence with none of them bypassed.
# Finding druids
[event]
name=moveto
[filter_condition]
[variable]
name=bridge_event
equals=warned
[/variable]
[/filter_condition]
[filter]
x=24-26
y=27-29
side=1
[/filter]
[set_variable]
name=rescued_elves
add=1
[/set_variable]
[message]
speaker=Kaleh
message= _ "The great tree! It has been buried under the rocks. Our most holy sanctuary, defiled. Oh, Eloh, what shall we do?"
[/message]
[message]
speaker=Nym
message= _ "Is anyone still alive?"
[/message]
[unit]
# wmllint: who ZHUL is Zhul
{ZHUL}
side=1
x,y=25,27
[/unit]
#ifndef HARD
{NAMED_GENERIC_UNIT 1 "Quenoth Mystic" 26 27 "Ryoko" ( _ "Ryoko")}
#endif
{NAMED_GENERIC_UNIT 1 "Quenoth Mystic" 24 27 "Yuni" ( _ "Yuni")}
[message]
speaker=Zhul
message= _ "Finally! We were worried that no one else had survived."
[/message]
[message]
speaker=Nym
message= _ "Mother priestess, are you all right?"
[/message]
[message]
speaker=Zhul
message= _ "Theres no time to stand on ceremony. Im fine. Im afraid only a few of us survived, but we will lend you what skills we have. Show me to those who need healing."
[/message]
[message]
speaker=Kaleh
message= _ "But the great tree, it has been destroyed!"
[/message]
[message]
speaker=Zhul
message= _ "All things of this world come to an end, but the power of Eloh endures. A new one shall grow in its place. Come now, let us see to the needs of our people."
[/message]
{VARIABLE found_zhul yes}
[show_objectives][/show_objectives]
# Lake monster event
[event]
name=moveto
[filter]
x=24-26
y=27-29
y=29-32
side=1
[/filter]
[set_variable]
name=rescued_elves
add=1
[/set_variable]
[message]
speaker=Kaleh
message= _ "The great tree! It has been buried under the rocks. Our most holy sanctuary, defiled. Oh, Eloh, what shall we do?"
[/message]
[message]
speaker=Nym
message= _ "Is anyone still alive?"
[/message]
[unit]
# wmllint: who ZHUL is Zhul
{ZHUL}
side=1
x,y=25,27
[/unit]
x,y=26,30
side=2
type=Cuttle Fish
name= _ "Deep One"
description= _ "The Deep Ones are gigantic aquatic monsters that lurk in the dark places of the world. Rarely do they come to the surface, and when they do the best way to survive an encounter with these monsters is to remain ashore. They can grab their opponents with strong tentacles, or spit a poisonous black ink from a distance."
# Deep one is basically a weakened Cuttlefish, it
# would be pretty much unbeatable if left without change
[modifications]
[trait]
id=Deep_one
[effect]
apply_to=attack
range=melee
increase_attacks={ON_DIFFICULTY -4 -3 -2}
[/effect]
[effect]
apply_to=hitpoints
increase_total={ON_DIFFICULTY -30 -24 -18}
[/effect]
#ifndef HARD
{NAMED_GENERIC_UNIT 1 "Quenoth Mystic" 26 27 "Ryoko" ( _ "Ryoko")}
[effect]
apply_to=defense
replace=yes
[defense]
shallow_water=50
[/defense]
[/effect]
#endif
{NAMED_GENERIC_UNIT 1 "Quenoth Mystic" 24 27 "Yuni" ( _ "Yuni")}
[/trait]
[/modifications]
[/unit]
[message]
speaker=Zhul
message= _ "Finally! We were worried that no one else had survived."
speaker=narrator
message= _ "The water of the lake suddenly goes dark and unsettled, only to erupt in a swarm of tentacles the moment the first elf set foot off the island."
image=wesnoth-icon.png
[/message]
[message]
speaker=Nym
message= _ "Mother priestess, are you all right?"
message= _ "What in Urias name is that?"
image=portraits/nym_moody.webp
[/message]
[message]
speaker=Zhul
message= _ "Theres no time to stand on ceremony. Im fine. Im afraid only a few of us survived, but we will lend you what skills we have. Show me to those who need healing."
message= _ "I felt a great darkness in this lake, but I knew not what it was. The falling rocks must have woken it from its sleep."
[/message]
[message]
speaker=Kaleh
message= _ "But the great tree, it has been destroyed!"
message= _ "Protect the priestesses, we shall send this monstrosity back to the depths it came from!"
[/message]
[message]
speaker=Zhul
message= _ "All things of this world come to an end, but the power of Eloh endures. A new one shall grow in its place. Come now, let us see to the needs of our people."
[/message]
{VARIABLE found_zhul yes}
[show_objectives][/show_objectives]
# Lake monster event
[event]
name=moveto
[filter]
x=24-26
y=29-32
side=1
[/filter]
[unit]
x,y=26,30
side=2
type=Cuttle Fish
name= _ "Deep One"
description= _ "The Deep Ones are gigantic aquatic monsters that lurk in the dark places of the world. Rarely do they come to the surface, and when they do the best way to survive an encounter with these monsters is to remain ashore. They can grab their opponents with strong tentacles, or spit a poisonous black ink from a distance."
# Deep one is basically a weakened Cuttlefish, it
# would be pretty much unbeatable if left without change
[modifications]
[trait]
id=Deep_one
[effect]
apply_to=attack
range=melee
increase_attacks={ON_DIFFICULTY -4 -3 -2}
[/effect]
[effect]
apply_to=hitpoints
increase_total={ON_DIFFICULTY -30 -24 -18}
[/effect]
#ifndef HARD
[effect]
apply_to=defense
replace=yes
[defense]
shallow_water=50
[/defense]
[/effect]
#endif
[/trait]
[/modifications]
[/unit]
[message]
speaker=narrator
message= _ "The water of the lake suddenly goes dark and unsettled, only to erupt in a swarm of tentacles the moment the first elf set foot off the island."
image=wesnoth-icon.png
[/message]
[message]
speaker=Nym
message= _ "What in Urias name is that?"
image=portraits/nym_moody.webp
[/message]
[message]
speaker=Zhul
message= _ "I felt a great darkness in this lake, but I knew not what it was. The falling rocks must have woken it from its sleep."
[/message]
[message]
speaker=Kaleh
message= _ "Protect the priestesses, we shall send this monstrosity back to the depths it came from!"
[/message]
[/event]
[/event]
[/event]
@ -1413,6 +1434,7 @@
{CLEAR_VARIABLE rescued_elves}
{CLEAR_VARIABLE found_garak}
{CLEAR_VARIABLE found_zhul}
{CLEAR_VARIABLE bridge_event}
# This clears all those village-specific containers that were holding
# information about who had visited the village