diff --git a/doc/fixes34.4 b/doc/fixes34.4 index 442a7f0bf..853f90211 100644 --- a/doc/fixes34.4 +++ b/doc/fixes34.4 @@ -113,7 +113,7 @@ armor which auto-curses when worn by hero should do same if worn by monster limit how high accuracy, damage, or protection can become via eating rings when blinded hero detects a trap by touch, make sure it shows up on the map confused remove curse will cause loss of knowledge of items' curse/bless state -With astral vision, the ";" command should only display "normal vision" +with astral vision, the ";" command should only display "normal vision" for things that could be seen without astral vision @@ -135,6 +135,7 @@ when adding an item to inventory, try to stack it with the quiver slot #adjust can be used to split an inventory stack cockatrice meat has a distinct flavor to some wish request for " armor" will match item named " mail" +Fire Brand and Frost Brand have a chance to avoid taking rust damage Platform- and/or Interface-Specific New Features diff --git a/include/extern.h b/include/extern.h index 0b6c47a1a..815647132 100644 --- a/include/extern.h +++ b/include/extern.h @@ -60,6 +60,7 @@ E const char *FDECL(artifact_name, (const char *,short *)); E boolean FDECL(exist_artifact, (int,const char *)); E void FDECL(artifact_exists, (struct obj *,const char *,BOOLEAN_P)); E int NDECL(nartifact_exist); +E boolean FDECL(arti_immune, (struct obj *,int)); E boolean FDECL(spec_ability, (struct obj *,unsigned long)); E boolean FDECL(confers_luck, (struct obj *)); E boolean FDECL(arti_reflects, (struct obj *)); diff --git a/src/artifact.c b/src/artifact.c index 5894603b9..2d9cbb719 100644 --- a/src/artifact.c +++ b/src/artifact.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)artifact.c 3.5 2003/08/11 */ +/* SCCS Id: @(#)artifact.c 3.5 2005/04/15 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -545,6 +545,22 @@ touch_artifact(obj,mon) return 1; } +/* decide whether an artifact itself is vulnerable to a particular type + of erosion damage, independent of the properties of its bearer */ +boolean +arti_immune(obj, dtyp) +struct obj *obj; +int dtyp; +{ + register const struct artifact *weap = get_artifact(obj); + + if (!weap) return FALSE; + if (dtyp == AD_PHYS) return FALSE; /* nothing is immune to phys dmg */ + return (weap->attk.adtyp == dtyp || + weap->defn.adtyp == dtyp || + weap->cary.adtyp == dtyp); +} + /* decide whether an artifact's special attacks apply against mtmp */ STATIC_OVL int spec_applies(weap, mtmp) @@ -1551,5 +1567,5 @@ int orc_count; pline("%s stops glowing.", bare_artifactname(uwep)); } } -/*artifact.c*/ +/*artifact.c*/ diff --git a/src/mhitm.c b/src/mhitm.c index edd8208ff..db8fae376 100644 --- a/src/mhitm.c +++ b/src/mhitm.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)mhitm.c 3.5 2004/10/20 */ +/* SCCS Id: @(#)mhitm.c 3.5 2005/04/15 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1308,33 +1308,13 @@ register struct obj *obj; boolean is_acid; if (!magr || !mdef || !obj) return; /* just in case */ - if (dmgtype(mdef->data, AD_CORR)) is_acid = TRUE; else if (dmgtype(mdef->data, AD_RUST)) is_acid = FALSE; else return; - - if (!mdef->mcan && - (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 (cansee(mdef->mx, mdef->my) && flags.verbose) - pline("%s weapon is not affected.", - s_suffix(Monnam(magr))); - if (obj->greased && !rn2(2)) obj->greased = 0; - } else { - if (cansee(mdef->mx, mdef->my)) { - 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); } STATIC_OVL void diff --git a/src/mhitu.c b/src/mhitu.c index 67c892057..14476dd9a 100644 --- a/src/mhitu.c +++ b/src/mhitu.c @@ -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 diff --git a/src/wield.c b/src/wield.c index 66a1b0d69..05d695083 100644 --- a/src/wield.c +++ b/src/wield.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)wield.c 3.5 2005/03/28 */ +/* SCCS Id: @(#)wield.c 3.5 2005/04/15 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -608,8 +608,7 @@ boolean for_dip; { int erosion; struct monst *victim; - boolean vismon; - boolean visobj; + boolean vismon, visobj, chill; boolean ret = FALSE; if (!target) @@ -639,6 +638,26 @@ boolean for_dip; target->spe = 0; ret = TRUE; } + } else if (target->oartifact && + /* (no artifacts currently meet either of these criteria) */ + arti_immune(target, acid_dmg ? AD_ACID : AD_RUST)) { + if (flags.verbose) { + if (victim == &youmonst) + pline("%s.", Yobjnam2(target, "sizzle")); + } + /* no damage to object */ + } else if (target->oartifact && !acid_dmg && + /* cold and fire provide partial protection against rust */ + ((chill = arti_immune(target, AD_COLD)) != 0 || + arti_immune(target, AD_FIRE)) && + /* once rusted, the chance for further rusting goes up */ + rn2(2 * (MAX_ERODE + 1 - erosion))) { + if (flags.verbose && target->oclass == WEAPON_CLASS) { + if (victim == &youmonst || vismon || visobj) + pline("%s some water.", + Yobjnam2(target, chill ? "freeze" : "boil")); + } + /* no damage to object */ } else if (target->oerodeproof || (acid_dmg ? !is_corrodeable(target) : !is_rustprone(target))) { if (flags.verbose || !(target->oerodeproof && target->rknown)) {