gas spores attempting to attack
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.
This commit is contained in:
14
src/mhitm.c
14
src/mhitm.c
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user