fix issue #1061 - dipping container into water

Issue reported by loggersviii:  dipping a container into an uncursed
potion of water mentions water getting into the container.  That
happens even when that type of potion hasn't been discovered yet.

Make POT_WATER become discovered if this occurs.  Doesn't apply when
hallucinating where a random liquid is mentioned instead of water.

Fixes #1061
This commit is contained in:
PatR
2023-06-15 02:29:51 -07:00
parent 7d052bafb0
commit 1bd966f826
5 changed files with 20 additions and 4 deletions

View File

@@ -1208,6 +1208,8 @@ wizard mode wish for terrain while on a fountain|sink spot made the counter
sound messages if all fountains|sinks were eventually destroyed
add a level arrival region to the Gnone King's Wine Cellar variation of the
Mines' End level so that hero can't end up in the treature chamber
make potion of water become discovered if dipping a carried container into an
uncursed one reports that water gets inside or slides right off
Fixes to 3.7.0-x General Problems Exposed Via git Repository

View File

@@ -613,6 +613,11 @@ struct instance_globals_m {
/* region.c */
int max_regions;
/* trap.c */
boolean mentioned_water; /* set to True by water_damage() if it issues
* a message about water; dodip() should make
* POT_WATER should become discovered */
boolean havestate;
unsigned long magic; /* validate that structure layout is preserved */
};

View File

@@ -551,6 +551,8 @@ const struct instance_globals_m g_init_m = {
UNDEFINED_VALUES, /* mapped_menu_op */
/* region.c */
0, /* max_regions */
/* trap.c */
FALSE, /* mentioned_water */
TRUE, /* havestate*/
IVMAGIC /* m_magic to validate that structure layout has been preserved */
};

View File

@@ -1512,8 +1512,12 @@ H2Opotion_dip(
} else {
/* dipping into uncursed water; carried() check skips steed saddle */
if (carried(targobj)) {
gm.mentioned_water = FALSE; /* water_damage() might set this */
if (water_damage(targobj, 0, TRUE) != ER_NOTHING)
res = TRUE;
if (gm.mentioned_water)
makeknown(POT_WATER);
gm.mentioned_water = FALSE;
}
}
if (func) {

View File

@@ -4208,8 +4208,7 @@ acid_damage(struct obj* obj)
/* Get an object wet and damage it appropriately.
* "obj": if null, returns ER_NOTHING
* "ostr", if present, is used instead of the object name in some
* messages.
* "ostr", if present, is used instead of the object name in some messages.
* "force" means not to roll luck to protect some objects.
* Returns an erosion return value (ER_*)
*/
@@ -4253,14 +4252,18 @@ water_damage(
return ER_GREASED;
} else if (Is_container(obj)
&& (!Waterproof_container(obj) || (obj->cursed && !rn2(3)))) {
if (in_invent)
if (in_invent) {
pline("Some %s gets into your %s!", hliquid("water"), ostr);
gm.mentioned_water = !Hallucination;
}
water_damage_chain(obj->cobj, FALSE);
return ER_DAMAGED; /* contents were damaged */
} else if (Waterproof_container(obj)) {
if (in_invent) {
pline_The("%s slides right off your %s.", hliquid("water"), ostr);
makeknown(obj->otyp);
gm.mentioned_water = !Hallucination;
makeknown(obj->otyp); /* if an oilskin sack, discover it; doesn't
* matter for chest, large box, ice box */
}
/* not actually damaged, but because we /didn't/ get the "water
gets into!" message, the player now has more information and