]> granicus.if.org Git - nethack/commitdiff
fix B18012 - Werebane
authornethack.rankin <nethack.rankin>
Fri, 14 Feb 2003 01:06:08 +0000 (01:06 +0000)
committernethack.rankin <nethack.rankin>
Fri, 14 Feb 2003 01:06:08 +0000 (01:06 +0000)
     Make wielding Werebane confer defense against catching lychanthropy
from monster bites.  It doesn't protect against catching that from eating
lycanthrope corpses and might blast the character if wielded at such time.

     Also fix artifact handling to recognize the character as lycanthrope
while in normal human/elf/whatever form--rather than only when in beast
form--just like it does for monsters.

doc/fixes34.1
include/artilist.h
src/artifact.c
src/eat.c

index 2c5f8e78f3e046b3907ffcf58b22200731de95c1..36550d8f31101d4946b460a883816cf7b6db2244 100644 (file)
@@ -386,6 +386,10 @@ steed should remember traps encountered while mounted
 killing shopkeeper by throwing unpaid things would result in
        "item not on bill" impossible error
 choking pet to death with cursed leash incurs various pet-killing penalties
+wielding Werebane prevents catching lycanthropy via monster attack (but not
+       via eating, nor does it cure an existing case)
+character inflicted with lycanthropy is vulnerable to Werebane when in
+       human/elf/&c form as well as when in beast form
 
 
 Platform- and/or Interface-Specific Fixes
index 78bc8af818351bc7b1ce509993264801b83e8b3e..1682e39e6856e9cf8731762736caa592343249b9 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)artilist.h 3.4     2001/11/17      */
+/*     SCCS Id: @(#)artilist.h 3.4     2003/02/12      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -107,7 +107,7 @@ A("Demonbane",                      LONG_SWORD,
 
 A("Werebane",                  SILVER_SABER,
        (SPFX_RESTR|SPFX_DFLAG2), 0, M2_WERE,
-       PHYS(5,0),      NO_DFNS,        NO_CARY,        0, A_NONE, NON_PM, NON_PM, 1500L ),
+       PHYS(5,0),      DFNS(AD_WERE),  NO_CARY,        0, A_NONE, NON_PM, NON_PM, 1500L ),
 
 A("Grayswandir",               SILVER_SABER,
        (SPFX_RESTR|SPFX_HALRES), 0, 0,
index 32375114c155eb67b98aa25aa42d8cd66e80efab..102a99d3a00746692941acba4f395f7a4ecbcf7b 100644 (file)
@@ -579,8 +579,9 @@ struct monst *mtmp;
        } else if (weap->spfx & SPFX_DFLAG1) {
            return ((ptr->mflags1 & weap->mtype) != 0L);
        } else if (weap->spfx & SPFX_DFLAG2) {
-           return ((ptr->mflags2 & weap->mtype) ||
-               (yours && !Upolyd && (urace.selfmask & weap->mtype)));
+           return ((ptr->mflags2 & weap->mtype) || (yours &&
+                       ((!Upolyd && (urace.selfmask & weap->mtype)) ||
+                        ((weap->mtype & M2_WERE) && u.ulycn >= LOW_PM))));
        } else if (weap->spfx & SPFX_DALIGN) {
            return yours ? (u.ualign.type != weap->alignment) :
                           (ptr->maligntyp == A_NONE ||
index 35559719117a9f5e662d9d04c4cfec8a7a1b676f..32227c647d52b37dcb03e609e514b662655f7740 100644 (file)
--- a/src/eat.c
+++ b/src/eat.c
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)eat.c      3.4     2002/09/25      */
+/*     SCCS Id: @(#)eat.c      3.4     2003/02/13      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -770,6 +770,7 @@ cpostfx(pm)         /* called after completely consuming a corpse */
 register int pm;
 {
        register int tmp = 0;
+       boolean catch_lycanthropy = FALSE;
 
        /* in case `afternmv' didn't get called for previously mimicking
           gold, clean up now to avoid `eatmbuf' memory leak */
@@ -795,12 +796,15 @@ register int pm;
                pluslvl(FALSE);
                break;
            case PM_HUMAN_WERERAT:
+               catch_lycanthropy = TRUE;
                u.ulycn = PM_WERERAT;
                break;
            case PM_HUMAN_WEREJACKAL:
+               catch_lycanthropy = TRUE;
                u.ulycn = PM_WEREJACKAL;
                break;
            case PM_HUMAN_WEREWOLF:
+               catch_lycanthropy = TRUE;
                u.ulycn = PM_WEREWOLF;
                break;
            case PM_NURSE:
@@ -952,6 +956,14 @@ register int pm;
            }
            break;
        }
+
+       if (catch_lycanthropy && defends(AD_WERE, uwep)) {
+           if (!touch_artifact(uwep, &youmonst)) {
+               dropx(uwep);
+               uwepgone();
+           }
+       }
+
        return;
 }