Fire/Frost Brand vs rusting

Implement the suggestion that Fire Brand avoids damage from rust traps
by boiling away the water.  Rather than making this be trap-specific, it
applies to all types of erosion which go through erode_obj().  That includes
hitting rust monsters but not dipping into potions or fountains, nor falling
into moats.  And it doesn't provide 100% protection, just a high chance of
avoiding rust damage.  Also, Frost Brand gets similar protection by freezing.

     The message handling needed some rewriting for the branch version.
That compiles ok but hasn't been tested.  It would have been simpler just to
move Yobjnam2() over even if nothing else was changed to use it yet....
This commit is contained in:
nethack.rankin
2005-04-19 04:15:51 +00:00
parent a85d3bf01c
commit f4a3b20afe
6 changed files with 47 additions and 50 deletions

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)mhitu.c 3.5 2005/02/09 */
/* SCCS Id: @(#)mhitu.c 3.5 2005/04/15 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -2077,7 +2077,6 @@ urustm(mon, obj)
register struct monst *mon;
register struct obj *obj;
{
boolean vis;
boolean is_acid;
if (!mon || !obj) return; /* just in case */
@@ -2087,26 +2086,7 @@ register struct obj *obj;
is_acid = FALSE;
else
return;
vis = cansee(mon->mx, mon->my);
if ((is_acid ? is_corrodeable(obj) : is_rustprone(obj)) &&
(is_acid ? obj->oeroded2 : obj->oeroded) < MAX_ERODE) {
if (obj->greased || obj->oerodeproof || (obj->blessed && rn2(3))) {
if (vis)
pline("Somehow, %s weapon is not affected.",
s_suffix(mon_nam(mon)));
if (obj->greased && !rn2(2)) obj->greased = 0;
} else {
if (vis)
pline("%s%s!",
Yobjnam2(obj, (is_acid ? "corrode" : "rust")),
(is_acid ? obj->oeroded2 : obj->oeroded)
? " further" : "");
if (is_acid) obj->oeroded2++;
else obj->oeroded++;
}
}
(void) erode_obj(obj, is_acid, FALSE, FALSE);
}
int