weapon rustproofing status

From a bug report, hitting a rust monster with a
fireproof--but not identified as fireproof--weapon caused the rknown bit
to become set, identifying the item as fireproof.  That would also happen
for a monster's anything-proof weapon if it hit a rust monster, whether
you could see it happen or not.  The code involved is convoluted; I hope
this fix is correct.
This commit is contained in:
nethack.rankin
2007-02-08 07:06:39 +00:00
parent 6b2078f89c
commit e46663e456
2 changed files with 16 additions and 9 deletions
+2
View File
@@ -307,6 +307,8 @@ non-unicorn horn healing magic which cures sickness now also cures vomiting
vomiting/nauseated state is included in enlightenment feedback vomiting/nauseated state is included in enlightenment feedback
vomiting countdown actually triggered the final vomit code twice vomiting countdown actually triggered the final vomit code twice
rats aren't capable of vomiting rats aren't capable of vomiting
fireproof, non-rustable weapon would be revealed as fireproof by hitting a
rust-causing target; ditto for fixed crysknife
Platform- and/or Interface-Specific Fixes Platform- and/or Interface-Specific Fixes
+14 -9
View File
@@ -1,4 +1,4 @@
/* SCCS Id: @(#)wield.c 3.5 2006/07/14 */ /* SCCS Id: @(#)wield.c 3.5 2007/02/07 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -622,7 +622,7 @@ boolean for_dip;
{ {
int erosion; int erosion;
struct monst *victim; struct monst *victim;
boolean vismon, visobj, chill; boolean vismon, visobj, chill, erodible;
boolean ret = FALSE; boolean ret = FALSE;
boolean already_affected = FALSE; boolean already_affected = FALSE;
@@ -638,6 +638,7 @@ boolean for_dip;
if (already_affected) ret = TRUE; if (already_affected) ret = TRUE;
} }
erosion = acid_dmg ? target->oeroded2 : target->oeroded; erosion = acid_dmg ? target->oeroded2 : target->oeroded;
erodible = acid_dmg ? is_corrodeable(target) : is_rustprone(target);
if (target->greased) { if (target->greased) {
grease_protect(target,(char *)0,victim); grease_protect(target,(char *)0,victim);
@@ -677,20 +678,24 @@ boolean for_dip;
Yobjnam2(target, chill ? "freeze" : "boil")); Yobjnam2(target, chill ? "freeze" : "boil"));
} }
/* no damage to object */ /* no damage to object */
} else if (target->oerodeproof || } else if (target->oerodeproof || !erodible) {
(acid_dmg ? !is_corrodeable(target) : !is_rustprone(target))) { /* no message if dipping or not carried */
if (flags.verbose || !(target->oerodeproof && target->rknown)) { if (for_dip) {
if (((victim == &youmonst) || vismon) && !for_dip) /* assumes that for_dip implies player action */
if (!Blind) target->rknown = 0;
} else if (victim == &youmonst || vismon) {
if (flags.verbose || (erodible && !target->rknown))
pline("%s not %s.", Yobjnam2(target, "are"), pline("%s not %s.", Yobjnam2(target, "are"),
already_affected ? "harmed" : "affected"); already_affected ? "harmed" : "affected");
/* no message if not carried or dipping */ if (erodible) target->rknown = 1;
} }
if (target->oerodeproof) target->rknown = !for_dip;
} else if (erosion < MAX_ERODE) { } else if (erosion < MAX_ERODE) {
if ((victim == &youmonst) || vismon || visobj) if (victim == &youmonst || vismon || visobj) {
pline("%s%s!", Yobjnam2(target, acid_dmg ? "corrode" : "rust"), pline("%s%s!", Yobjnam2(target, acid_dmg ? "corrode" : "rust"),
erosion+1 == MAX_ERODE ? " completely" : erosion+1 == MAX_ERODE ? " completely" :
erosion ? " further" : ""); erosion ? " further" : "");
target->rknown = 1; /* it's obviously not erode-proof */
}
if (acid_dmg) if (acid_dmg)
target->oeroded2++; target->oeroded2++;
else else