pull request #1238 - pit interaction when pool

underneath gets boiled away

Pull request by disperse:  when a water walking hero zaps a wand of
fire downward and it boils away the water, hero should fall into the
resulting pit.

The PR commit didn't handle monsters (who don't zap wands downward
but could be on/in water that's boiled out from under them).  And
while testing it I noticed that the existing code had message
sequencing issues (being enveloped in a cloud of steam before seeing
the water evaporate).  This ended up redoing the fix rather than
using the commit.

Fixes #1238
This commit is contained in:
PatR
2024-04-27 18:37:42 -07:00
parent f652fdd686
commit 1f8db3a0f3
4 changed files with 24 additions and 6 deletions

View File

@@ -1405,6 +1405,7 @@ when engraving with a stack of eligible weapons, split one off the stack and
when engraving with a stack of cursed weapons, treat it differently if that
stack is welded to hero's hand: write in dust and leave whole stack
welded rather than split one off stack to engrave on floor
hero or monster didn't fall into pit if water at the location was boiled away
Fixes to 3.7.0-x General Problems Exposed Via git Repository

View File

@@ -496,6 +496,7 @@ enum plnmsg_types {
PLNMSG_ONE_ITEM_HERE, /* "you see <single item> here" */
PLNMSG_TOWER_OF_FLAME, /* scroll of fire */
PLNMSG_CAUGHT_IN_EXPLOSION, /* explode() feedback */
PLNMSG_ENVELOPED_IN_GAS, /* create_gas_cloud() feedback */
PLNMSG_OBJ_GLOWS, /* "the <obj> glows <color>" */
PLNMSG_OBJNAM_ONLY, /* xname/doname only, for #tip */
PLNMSG_OK_DONT_DIE, /* overriding death in explore/wizard mode */

View File

@@ -1232,9 +1232,11 @@ create_gas_cloud(coordxy x, coordxy y, int cloudsize, int damage)
cloud->glyph = cmap_to_glyph(damage ? S_poisoncloud : S_cloud);
add_region(cloud);
if (!gi.in_mklev && !inside_cloud && is_hero_inside_gas_cloud())
if (!gi.in_mklev && !inside_cloud && is_hero_inside_gas_cloud()) {
You("are enveloped in a cloud of %s!",
damage ? "noxious gas" : "steam");
iflags.last_msg = PLNMSG_ENVELOPED_IN_GAS;
}
return cloud;
}

View File

@@ -5036,14 +5036,14 @@ zap_over_floor(
/* a burning web is too flimsy to notice if you can't see it */
if (see_it)
Norep("A web bursts into flames!");
(void) delfloortrap(t);
(void) delfloortrap(t), t = (struct trap *) 0;
if (see_it)
newsym(x, y);
}
if (is_ice(x, y)) {
melt_ice(x, y, (char *) 0);
} else if (is_pool(x, y)) {
boolean on_water_level = Is_waterlevel(&u.uz);
boolean on_water_level = Is_waterlevel(&u.uz), msggiven = FALSE;
const char *msgtxt = (!Deaf)
? "You hear hissing gas." /* Deaf-aware */
: (type >= 0)
@@ -5052,10 +5052,14 @@ zap_over_floor(
/* don't create steam clouds on Plane of Water; air bubble
movement and gas regions don't understand each other */
if (!on_water_level)
if (!on_water_level) {
create_gas_cloud(x, y, rnd(5), 0); /* 1..5, no damg */
if (iflags.last_msg == PLNMSG_ENVELOPED_IN_GAS)
msggiven = TRUE;
}
if (lev->typ != POOL) { /* MOAT or DRAWBRIDGE_UP or WATER */
t = (struct trap *) 0;
if (on_water_level)
msgtxt = (see_it || !Deaf) ? "Some water boils." : 0;
else if (see_it)
@@ -5069,9 +5073,10 @@ zap_over_floor(
if (see_it)
msgtxt = "The water evaporates.";
}
if (msgtxt)
if (msgtxt && !msggiven)
Norep("%s", msgtxt);
if (lev->typ == ROOM) {
if (lev->typ == ROOM) { /* POOL changed to ROOM above */
if ((mon = m_at(x, y)) != 0) {
/* probably ought to do some hefty damage to any
creature caught in boiling water;
@@ -5081,6 +5086,15 @@ zap_over_floor(
}
}
newsym(x, y);
if (t) {
/* if water walking/swimming/magical breathing, maybe fall
into the new pit (after the water evaporation message);
if flying or levitating, nothing will happen */
if (u_at(x, y))
dotrap(t, NO_TRAP_FLAGS);
else if (mon)
mintrap(mon, NO_TRAP_FLAGS);
}
}
} else if (IS_FOUNTAIN(lev->typ)) {
create_gas_cloud(x, y, rnd(3), 0); /* 1..3, no damage */