]> granicus.if.org Git - nethack/commitdiff
fix #H4146 - more enlightenment vs drain resistance
authorPatR <rankin@nethack.org>
Sat, 26 Dec 2015 00:46:02 +0000 (16:46 -0800)
committerPatR <rankin@nethack.org>
Sat, 26 Dec 2015 00:46:02 +0000 (16:46 -0800)
Duplicate of another recent report as far as drain resistance from
Excalibur/Stormbringer/Staff of Aesculapius not being shown by
enlightenment goes, but this one mentioned that it also wasn't being
shown for lycanthropy.  Being inflicted by that does confers level-
drain resistance.  were_change() wasn't calling set_uasmon() since
it isn't changing youmonst.data, but set_uasmon() is were intrinsics
conferred by creature form are set up.  So call it when changing
were-form.  Direct access to u.ulycn wasn't calling it either, so add
a new routine to assign the value to that instead doing so directly.

doc/fixes36.1
include/extern.h
src/attrib.c
src/eat.c
src/mhitu.c
src/potion.c
src/were.c

index c308855e5e2d6410a6437c3f40ba764f1d2c2383..0c9ff48a9e9eb1ec3a427c4683155bbee406af94 100644 (file)
@@ -57,7 +57,7 @@ death due an unseen gas spore's explosion resulted in "killed by a died"
 allow optional parameter "true", "yes", "false", or "no" for boolean options
 actually make the castle chest not trapped
 level-drain resistance wasn't shown during enlightenment if it was conferred
-       by worn/wielded equipment
+       by worn/wielded equipment or by lycanthropy
 wizard mode enlightenment now shows more reasons for various intrinsics
 rehumanizing after being poly'd into vampire left hero with ability to sense
        humans and elves
index 4839a9c2036cfeba14baf6258757ed819d33ffb2..5bfae608096eeb01e33835ee2ffb4c128596d205 100644 (file)
@@ -2609,6 +2609,7 @@ E void FDECL(new_were, (struct monst *));
 E int FDECL(were_summon, (struct permonst *, BOOLEAN_P, int *, char *));
 E void NDECL(you_were);
 E void FDECL(you_unwere, (BOOLEAN_P));
+E void FDECL(set_ulycn, (int));
 
 /* ### wield.c ### */
 
index 76a9fc0e72d398d07afd8fcbf79b5641a5f7afa9..611456f90e1d313393a99d5e793003dde53c10f6 100644 (file)
@@ -770,7 +770,9 @@ int propidx; /* special cases can have negative values */
             if (innateness == FROM_EXP)
                 Strcpy(buf, " because of your experience");
             else if (innateness == FROM_FORM)
-                Strcpy(buf, " from current creature form");
+                Strcpy(buf, (u.ulycn >= LOW_PM)
+                               ? " due to your lycanthropy"
+                               : " from current creature form");
             else if (innateness == FROM_ROLE || innateness == FROM_RACE)
                 Strcpy(buf, " innately");
             else if (wizard
index bea0ccc4c1f58abdd81ef4ae6c0bab629983229b..d041976ddaeec4a23667d9ce37d193bdc3af2e39 100644 (file)
--- a/src/eat.c
+++ b/src/eat.c
@@ -903,7 +903,7 @@ cpostfx(pm)
 register int pm;
 {
     register int tmp = 0;
-    boolean catch_lycanthropy = FALSE;
+    int catch_lycanthropy = NON_PM;
 
     /* in case `afternmv' didn't get called for previously mimicking
        gold, clean up now to avoid `eatmbuf' memory leak */
@@ -931,16 +931,13 @@ register int pm;
         pluslvl(FALSE);
         break;
     case PM_HUMAN_WERERAT:
-        catch_lycanthropy = TRUE;
-        u.ulycn = PM_WERERAT;
+        catch_lycanthropy = PM_WERERAT;
         break;
     case PM_HUMAN_WEREJACKAL:
-        catch_lycanthropy = TRUE;
-        u.ulycn = PM_WEREJACKAL;
+        catch_lycanthropy = PM_WEREJACKAL;
         break;
     case PM_HUMAN_WEREWOLF:
-        catch_lycanthropy = TRUE;
-        u.ulycn = PM_WEREWOLF;
+        catch_lycanthropy = PM_WEREWOLF;
         break;
     case PM_NURSE:
         if (Upolyd)
@@ -1096,12 +1093,14 @@ register int pm;
             gainstr((struct obj *) 0, 0, TRUE);
         else if (tmp > 0)
             givit(tmp, ptr);
-    } break;
-    }
+        break;
+    } /* default case */
+    } /* switch */
 
-    if (catch_lycanthropy)
+    if (catch_lycanthropy >= LOW_PM) {
+        set_ulycn(catch_lycanthropy);
         retouch_equipment(2);
-
+    }
     return;
 }
 
index 1e620dc7df152294f2c5cf312a4316484bfbb5c5..814061ccd6c91ade27cbbc51dae40c9a1779f4a0 100644 (file)
@@ -1248,7 +1248,7 @@ register struct attack *mattk;
             && !Protection_from_shape_changers && !defends(AD_WERE, uwep)) {
             You_feel("feverish.");
             exercise(A_CON, FALSE);
-            u.ulycn = monsndx(mdat);
+            set_ulycn(monsndx(mdat));
             retouch_equipment(2);
         }
         break;
index 2631955b542d02316956beecbefd26eb99b8b100..c18c560b91ba239bdcf0fcd09714dd54648f0f82 100644 (file)
@@ -604,7 +604,7 @@ register struct obj *otmp;
                          makeplural(mons[u.ulycn].mname));
                     if (youmonst.data == &mons[u.ulycn])
                         you_unwere(FALSE);
-                    u.ulycn = NON_PM; /* cure lycanthropy */
+                    set_ulycn(NON_PM); /* cure lycanthropy */
                 }
                 losehp(Maybe_Half_Phys(d(2, 6)), "potion of holy water",
                        KILLED_BY_AN);
index 7ab1051ba642c222e05ae56f6345647825bd26d8..b9e58dd2b5b4ecc6109741c5d73930305d521b82 100644 (file)
@@ -37,6 +37,8 @@ register struct monst *mon;
     } else if (!rn2(30) || Protection_from_shape_changers) {
         new_were(mon); /* change back into human form */
     }
+    /* update innate intrinsics (mainly Drain_resistance) */
+    set_uasmon(); /* new_were() doesn't do this */
 }
 
 int
@@ -118,15 +120,15 @@ register struct monst *mon;
     possibly_unwield(mon, FALSE);
 }
 
-int were_summon(ptr, yours, visible,
-                genbuf) /* were-creature (even you) summons a horde */
-register struct permonst *ptr;
-register boolean yours;
+/* were-creature (even you) summons a horde */
+int were_summon(ptr, yours, visible, genbuf)
+struct permonst *ptr;
+boolean yours;
 int *visible; /* number of visible helpers created */
 char *genbuf;
 {
-    register int i, typ, pm = monsndx(ptr);
-    register struct monst *mtmp;
+    int i, typ, pm = monsndx(ptr);
+    struct monst *mtmp;
     int total = 0;
 
     *visible = 0;
@@ -194,11 +196,21 @@ boolean purify;
 
     if (purify) {
         You_feel("purified.");
-        u.ulycn = NON_PM; /* cure lycanthropy */
+        set_ulycn(NON_PM); /* cure lycanthropy */
     }
     if (!Unchanging && is_were(youmonst.data)
         && (!controllable_poly || yn("Remain in beast form?") == 'n'))
         rehumanize();
 }
 
+/* lycanthropy is being caught or cured, but no shape change is involved */
+void
+set_ulycn(which)
+int which;
+{
+    u.ulycn = which;
+    /* add or remove lycanthrope's innate intrinsics (Drain_resistance) */
+    set_uasmon();
+}
+
 /*were.c*/