]> granicus.if.org Git - nethack/commitdiff
gas spores attempting to attack
authornethack.rankin <nethack.rankin>
Fri, 22 Oct 2004 02:15:33 +0000 (02:15 +0000)
committernethack.rankin <nethack.rankin>
Fri, 22 Oct 2004 02:15:33 +0000 (02:15 +0000)
     From a bug report, but pulls back" while successfully
praying.  Gas spores' only "attack" is to explode when dying, so the code
that checks whether the monster has any attack needs to handle AT_BOOM as
a special case.  Unfortunately this change means that you won't interrupt
an occupation when a gas spore approaches, and a subsequent kill by your
pet might end up causing you harm while still occupied.  The callers of
`noattacks()' are messy enough that I didn't want to try to address that.

     This also moves noattacks() from mhitm.c to somewhere more sensible.

doc/fixes34.4
include/extern.h
src/mhitm.c
src/mondata.c

index ace4cfb2512cac9109e9325f8894105715bde921..1c90981a5a75af833c06c7ad21aa27b7be89d740 100644 (file)
@@ -56,6 +56,7 @@ destroying a worn item via dipping in burning oil would not unwear/unwield
        the item properly, possibly leading to various strange behaviors
 avoid a panic splitbill when shopkeeper is trapped by the door
 grammar tidbit for message given when eating tainted meat is also cannibalism
+gas spores shouldn't be described as "unable to attack" while hero is praying
 
 
 Platform- and/or Interface-Specific Fixes
index 7c53e4ab0e59dcc64c71f0d5e7a429a38d607996..11db72c199416f2c5f9faa07d6d213636beede5b 100644 (file)
@@ -996,7 +996,6 @@ E int FDECL(mattackm, (struct monst *,struct monst *));
 #ifdef BARGETHROUGH
 E int FDECL(mdisplacem, (struct monst *,struct monst *,BOOLEAN_P));
 #endif
-E int FDECL(noattacks, (struct permonst *));
 E int FDECL(sleep_monst, (struct monst *,int,int));
 E void FDECL(slept_monst, (struct monst *));
 E long FDECL(attk_protection, (int));
@@ -1203,6 +1202,7 @@ E void FDECL(decide_to_shapeshift, (struct monst *,int));
 E void FDECL(set_mon_data, (struct monst *,struct permonst *,int));
 E struct attack *FDECL(attacktype_fordmg, (struct permonst *,int,int));
 E boolean FDECL(attacktype, (struct permonst *,int));
+E boolean FDECL(noattacks, (struct permonst *));
 E boolean FDECL(poly_when_stoned, (struct permonst *));
 E boolean FDECL(resists_drli, (struct monst *));
 E boolean FDECL(resists_magm, (struct monst *));
index 1a74dbf831bf6637df8d902ce393c941a4fe2047..f085ef00efdb4b1c4ac0e7da344b481e069f41e7 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)mhitm.c    3.4     2003/01/02      */
+/*     SCCS Id: @(#)mhitm.c    3.4     2004/10/20      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -1265,18 +1265,6 @@ mdamagem(magr, mdef, mattk)
        return(MM_HIT);
 }
 
-int
-noattacks(ptr)                 /* returns 1 if monster doesn't attack */
-       struct  permonst *ptr;
-{
-       int i;
-
-       for(i = 0; i < NATTK; i++)
-               if(ptr->mattk[i].aatyp) return(0);
-
-       return(1);
-}
-
 /* `mon' is hit by a sleep attack; return 1 if it's affected, 0 otherwise */
 int
 sleep_monst(mon, amt, how)
index 33d0bd0f75dd6460287af3a4ec9f86d1c8e573c1..53077129d4fa34131a65457c61b1df766d715c4d 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)mondata.c  3.4     2004/06/12      */
+/*     SCCS Id: @(#)mondata.c  3.4     2004/10/20      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -46,6 +46,25 @@ int atyp;
     return attacktype_fordmg(ptr, atyp, AD_ANY) ? TRUE : FALSE;
 }
 
+/* returns TRUE if monster doesn't attack, FALSE if it does */
+boolean
+noattacks(ptr)
+struct permonst *ptr;
+{
+    int i;
+    struct attack *mattk = ptr->mattk;
+
+    for (i = 0; i < NATTK; i++) {
+       /* AT_BOOM "passive attack" (gas spore's explosion upon death)
+          isn't an attack as far as our callers are concerned */
+       if (mattk[i].aatyp == AT_BOOM) continue;
+
+       if (mattk[i].aatyp) return FALSE;
+    }
+
+    return TRUE;
+}
+
 boolean
 poly_when_stoned(ptr)
     struct permonst *ptr;