From 9269642f2a3957d5759e30352bb8eb44a081cde2 Mon Sep 17 00:00:00 2001 From: "nethack.rankin" Date: Tue, 15 Dec 2009 02:38:50 +0000 Subject: [PATCH] fix #H2060 - objects blanked by water while hero is blind From a bug report, if you entered water while blind and any spellbooks got blanked, you would know they became "plain spellbooks" iff their original description was known. The same situation applied to scrolls and potions; if they had been previously seen you'd learn they'd become blank or clear. This fix resets the obj->dknown flag during transformation so that altered objects are only known by their class when blind, never their description, the same as when they hadn't been seen before being blanked. (When sighted, the dknown flag gets set again the next time the object's name is formatted, so the player shouldn't be able to notice that any reset took place.) Unpaid objects which get blanked should be treated as used up for shop billing purposes (force the hero to buy), but there aren't any pools in shops so aside from the added comment I'm going to pretend I didn't notice that that isn't being done.... Potions seen before becoming blind which become diluted while blind will be known to be diluted since there's no way to know the description without also knowing the dilution. I don't think that's important enough to track known-dilution separately, although I suppose we could overload the cknown (contents-known) flag for that if necessary. This also removes an inaccurate comment about the effects of Luck. Its maximum is always 13 regardless of whether the moon is full, so 5% for the lowest chance of blanking via submersion was impossible. --- doc/fixes34.4 | 2 ++ src/trap.c | 30 +++++++++++++++++++++--------- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/doc/fixes34.4 b/doc/fixes34.4 index 66d1e028f..71287b93b 100644 --- a/doc/fixes34.4 +++ b/doc/fixes34.4 @@ -389,6 +389,8 @@ prevent "object lost" panic if/when drinking a wielded potion of polymorph documentation tidbit: change Guidebook and in-game help for pickup_burden option to match game's 'O' command ("Unencumbered", not "Unburdened") writing while blind no longer possible for books, might fail for scrolls +blanking items in pools while blind shouldn't reveal new obj description + for ones which had been seen before becoming blind Platform- and/or Interface-Specific Fixes diff --git a/src/trap.c b/src/trap.c index 497f9762b..eb8f38162 100644 --- a/src/trap.c +++ b/src/trap.c @@ -1,5 +1,4 @@ /* NetHack 3.5 trap.c $Date$ $Revision$ */ -/* SCCS Id: @(#)trap.c 3.5 2007/12/19 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -3087,7 +3086,18 @@ boolean force, here; } /* Scrolls, spellbooks, potions, weapons and - pieces of armor may get affected by the water */ + pieces of armor may get affected by the water. + + [FIXME? The item transformations here lack shop price/billing + handling [costly_alteration()], which is okay as long as shops + don't contain any pools. However, that's probably not a valid + assumption; a broken fountain might spill new pools far enough + to put one inside a nearby shop, particularly if dug walls in + Minetown haven't been repaired yet. Note that water_damage() + might be getting called right now because we're in the midst + of creating such a pool, not just because one has already been + created and we've walked into it while carrying unpaid stuff.] + */ for (; obj; obj = otmp) { otmp = here ? obj->nexthere : obj->nobj; @@ -3102,24 +3112,25 @@ boolean force, here; water_damage(&obj->cobj, force, FALSE); } else if (!force && (Luck + 5) > rn2(20)) { /* chance per item of sustaining damage: - * max luck (full moon): 5% - * max luck (elsewhen): 10% + * max luck: 10% * avg luck (Luck==0): 75% * awful luck (Luck<-4): 100% */ continue; } else if (obj->oclass == SCROLL_CLASS) { #ifdef MAIL - if (obj->otyp != SCR_MAIL) + if (obj->otyp == SCR_MAIL) continue; #endif - { obj->otyp = SCR_BLANK_PAPER; + obj->dknown = 0; obj->spe = 0; - } } else if (obj->oclass == SPBOOK_CLASS) { - if (obj->otyp == SPE_BOOK_OF_THE_DEAD) + if (obj->otyp == SPE_BOOK_OF_THE_DEAD) { pline("Steam rises from %s.", the(xname(obj))); - else obj->otyp = SPE_BLANK_PAPER; + continue; + } + obj->otyp = SPE_BLANK_PAPER; + obj->dknown = 0; } else if (obj->oclass == POTION_CLASS) { if (obj->otyp == POT_ACID) { char *bufp, buf[BUFSZ]; @@ -3143,6 +3154,7 @@ boolean force, here; continue; } else if (obj->odiluted) { obj->otyp = POT_WATER; + obj->dknown = 0; obj->blessed = obj->cursed = 0; obj->odiluted = 0; } else if (obj->otyp != POT_WATER) -- 2.40.0