fix github issue #1291 - water walking vs lava

Issue reported by ars3niy:  non-fireproof water walking boots are
supposed to be destroyed if worn on lava, but a post-3.6 change
made that only happen if the hero died and left bones.

The boots remained intact if hero was fire resistant or survived
6d6 damage.  Staying intact should only happen if they're fireproof.

This seems to work but each time lava_effects() gets modified it
becomes more fragile.  Having deleted objects stick around doesn't
help with this problem, which is to keep an item which is being
stolen--and whose loss causes the hero to drop into lava--from
being burned up before being transferred to the thief's inventory.

Fixes #1291
This commit is contained in:
PatR
2024-09-26 08:10:26 -07:00
parent 63294536f6
commit 0dad60e485
3 changed files with 8 additions and 16 deletions

View File

@@ -2039,7 +2039,8 @@ priestname() didn't handle "a" vs" "an" prefix correctly; normally priests are
named as "the priest of <deity>" but hearing an unseen priest read a
scroll doesn't force "the" and yielded "You hear an priest of <deity>
incant <scroll>."
non-fireproof water walking boots wouldn't be burnt up if fire resistant hero
walked on molten lava
Fixes to 3.7.0-x Platform and/or Interface Problems Exposed Via git Repository

View File

@@ -283,19 +283,8 @@ remove_worn_item(
setnotworn(obj);
}
/*
* Fingers crossed; hope unwearing obj didn't destroy it. Loss of
* levitation, flight, water walking, magical breathing or perhaps
* some other property can subject hero to hardship. drown() won't
* drop an 'in_use' item during emergency_disrobe() to crawl out
* of water. Surviving in_lava() only burns up items which aren't
* able to confer such properties but dying to it will destroy all
* in-use items, keeping them out of subsequent bones. Triggering
* traps might pose a risk of item destruction (fire, explosion)
* but usually that will be like the surviving lava case--the items
* that are affected aren't ones that will be unworn and trigger
* the whole mess.
*/
if (obj->where == OBJ_DELETED)
debugpline1("remove_worn_item() \"%s\" deleted!", simpleonames(obj));
obj->in_use = oldinuse;
}

View File

@@ -6650,13 +6650,15 @@ lava_effects(void)
* (3.7: that assumption is no longer true, but having boots be the first
* thing to come into contact with lava makes sense.)
*/
if (uarmf && uarmf->in_use) {
if (uarmf && (uarmf->in_use
|| (is_organic(uarmf) && !uarmf->oerodeproof))) {
obj = uarmf;
pline("%s into flame!", Yobjnam2(obj, "burst"));
++burnmesgcount;
iflags.in_lava_effects++; /* (see above) */
(void) Boots_off();
useup(obj);
if (obj->o_id != protect_oid)
useup(obj);
iflags.in_lava_effects--;
++burncount;
}