]> granicus.if.org Git - nethack/commitdiff
mind flayer vs ghost (trunk only)
authornethack.rankin <nethack.rankin>
Sat, 24 Feb 2007 04:59:43 +0000 (04:59 +0000)
committernethack.rankin <nethack.rankin>
Sat, 24 Feb 2007 04:59:43 +0000 (04:59 +0000)
     There's newsgroup discussion about a mind flayer sucking the brains
of a ghost, plus speculation that the fix for C343-121 has already taken
care of it.  I agree with them that ghost's brains are too insubstantial
to be hit by brainsuck damage from mind flayers' tentacles.  C343-121 is
vague enough to cover this; the corresponding fixes entry was more specific
and is augmented here.

doc/fixes35.0
src/eat.c
src/mhitu.c

index 50bac50395d4b3ffc500937fec167bd8a40c6c7e..159ffe7f449c70f830c540cc2521aea10a775437 100644 (file)
@@ -88,6 +88,7 @@ prevent polymorphing into "new man" at low level from magnifying HP and Pw
 losing a level while polymorphed affects hero's current monster HP as well as
        underlying normal HP
 mind flayer brain eating is subject to certain fatal targets and to cannibalism
+mind flayer can't eat brains of ghost or shade
 corpses of unique monsters in bones behaved incorrectly if revived or eaten
 fix pluralization for "this tin smells like mother-in-laws" when hallucinating
 try harder to keep pluralization straight when user assigns an already plural
index 8da84fc2ac1d02a493d2c91feb7bd4cf83005139..781f028dc1926f2b6c9b9d69364d20b0116fed25 100644 (file)
--- a/src/eat.c
+++ b/src/eat.c
@@ -468,7 +468,12 @@ int *dmg_p;        /* for dishing out extra damage in lieu of Int loss */
     boolean give_nutrit = FALSE;
     int result = MM_HIT, xtra_dmg = rnd(10);
 
-    if (magr == &youmonst) {
+    if (noncorporeal(pd)) {
+       if (visflag)
+           pline("%s brain is unharmed.",
+                 (mdef == &youmonst) ? "Your" : s_suffix(mon_nam(mdef)));
+       return MM_MISS; /* side-effects can't occur */
+    } else if (magr == &youmonst) {
        You("eat %s brain!", s_suffix(mon_nam(mdef)));
     } else if (mdef == &youmonst) {
        Your("brain is eaten!");
index 98e797ee0827433398e7b5ef325790816c694308..29dc2b101eb15ccd5e1922f4cd2f130ba175641b 100644 (file)
@@ -1073,8 +1073,15 @@ dopois:
                if (Half_physical_damage) dmg = (dmg+1) / 2;
                mdamageu(mtmp, dmg);
 
-               if (!uarmh || uarmh->otyp != DUNCE_CAP)
-                   (void) eat_brains(mtmp, &youmonst, TRUE, (int *)0);
+               if (!uarmh || uarmh->otyp != DUNCE_CAP) {
+                   /* eat_brains() will miss if target is mindless (won't
+                      happen here; hero is considered to retain his mind
+                      regardless of current shape) or is noncorporeal
+                      (can't happen here; no one can poly into a ghost
+                      or shade) so this check for missing is academic */
+                   if (eat_brains(mtmp, &youmonst, TRUE, (int *)0) == MM_MISS)
+                       break;
+               }
                /* adjattrib gives dunce cap message when appropriate */
                (void) adjattrib(A_INT, -rnd(2), FALSE);
                forget_levels(25);      /* lose memory of 25% of levels */