register struct monst *mdef;
register struct attack *mattk;
{
+#ifdef LINT /* static char msgbuf[BUFSZ]; */
+ char msgbuf[BUFSZ];
+#else
+ static char msgbuf[BUFSZ]; /* for nomovemsg */
+#endif
register int tmp;
register int dam = d((int)mattk->damn, (int)mattk->damd);
+ boolean fatal_gulp;
struct obj *otmp;
+ struct permonst *pd = mdef->data;
+
/* Not totally the same as for real monsters. Specifically, these
* don't take multiple moves. (It's just too hard, for too little
* result, to program monsters which attack from inside you, which
* after exactly 1 round of attack otherwise. -KAA
*/
- if(mdef->data->msize >= MZ_HUGE) return 0;
+ if (pd->msize >= MZ_HUGE) return 0;
if(u.uhunger < 1500 && !u.uswallow) {
for (otmp = mdef->minvent; otmp; otmp = otmp->nobj)
(void) snuff_lit(otmp);
- if(!touch_petrifies(mdef->data) || Stone_resistance) {
-#ifdef LINT /* static char msgbuf[BUFSZ]; */
- char msgbuf[BUFSZ];
-#else
- static char msgbuf[BUFSZ];
-#endif
+ /* engulfing a cockatrice or digesting a Rider or Medusa */
+ fatal_gulp = (touch_petrifies(pd) && !Stone_resistance) ||
+ (mattk->adtyp == AD_DGST && (is_rider(pd) ||
+ (pd == &mons[PM_MEDUSA]) && !Stone_resistance));
+
+ if ((mattk->adtyp == AD_DGST && !Slow_digestion) || fatal_gulp) {
+ /* KMH, conduct */
+ u.uconduct.food++;
+ if (!vegan(pd))
+ u.uconduct.unvegan++;
+ if (!vegetarian(pd))
+ violated_vegetarian();
+ }
+
+ if (fatal_gulp && !is_rider(pd)) { /* petrification */
+ char kbuf[BUFSZ];
+ const char *mname = pd->mname;
+
+ if (!type_is_pname(pd)) mname = an(mname);
+ You("bite into %s.", mon_nam(mdef));
+ Sprintf(kbuf, "swallowing %s whole", mname);
+ instapetrify(kbuf);
+ } else {
start_engulf(mdef);
switch(mattk->adtyp) {
case AD_DGST:
/* eating a Rider or its corpse is fatal */
- if (is_rider(mdef->data)) {
+ if (is_rider(pd)) {
pline("Unfortunately, digesting any of it is fatal.");
end_engulf();
Sprintf(killer.name, "unwisely tried to eat %s",
- mdef->data->mname);
+ pd->mname);
killer.format = NO_KILLER_PREFIX;
done(DIED);
return 0; /* lifesaved */
break;
}
- /* KMH, conduct */
- u.uconduct.food++;
- if (!vegan(mdef->data))
- u.uconduct.unvegan++;
- if (!vegetarian(mdef->data))
- violated_vegetarian();
-
/* Use up amulet of life saving */
if (!!(otmp = mlifesaver(mdef))) m_useup(mdef, otmp);
You("hurriedly regurgitate the sizzling in your %s.",
body_part(STOMACH));
} else {
- tmp = 1 + (mdef->data->cwt >> 8);
+ tmp = 1 + (pd->cwt >> 8);
if (corpse_chance(mdef, &youmonst, TRUE) &&
- !(mvitals[monsndx(mdef->data)].mvflags &
- G_NOCORPSE)) {
+ !(mvitals[monsndx(pd)].mvflags & G_NOCORPSE)) {
/* nutrition only if there can be a corpse */
- u.uhunger += (mdef->data->cnutrit+1) / 2;
+ u.uhunger += (pd->cnutrit + 1) / 2;
} else tmp = 0;
Sprintf(msgbuf, "You totally digest %s.",
mon_nam(mdef));
nomul(-tmp);
nomovemsg = msgbuf;
} else pline("%s", msgbuf);
- if (mdef->data == &mons[PM_GREEN_SLIME]) {
+ if (pd == &mons[PM_GREEN_SLIME]) {
Sprintf(msgbuf, "%s isn't sitting well with you.",
- The(mdef->data->mname));
+ The(pd->mname));
if (!Unchanging) {
make_slimed(5L, (char*) 0);
}
if (youmonst.data == &mons[PM_FOG_CLOUD]) {
pline("%s is laden with your moisture.",
Monnam(mdef));
- if (amphibious(mdef->data) &&
- !flaming(mdef->data)) {
+ if (amphibious(pd) && !flaming(pd)) {
dam = 0;
pline("%s seems unharmed.", Monnam(mdef));
}
pline("Obviously, you didn't like %s taste.",
s_suffix(mon_nam(mdef)));
}
- } else {
- char kbuf[BUFSZ];
-
- You("bite into %s.", mon_nam(mdef));
- Sprintf(kbuf, "swallowing %s whole", an(mdef->data->mname));
- instapetrify(kbuf);
}
}
return(0);