| 4955 | } |
| 4956 | |
| 4957 | staticfn int |
| 4958 | gulpum(struct monst *mdef, struct attack *mattk) |
| 4959 | { |
| 4960 | static char msgbuf[BUFSZ]; /* for gn.nomovemsg */ |
| 4961 | int tmp; |
| 4962 | int dam = d((int) mattk->damn, (int) mattk->damd); |
| 4963 | boolean fatal_gulp, |
| 4964 | u_digest = digests(gy.youmonst.data), |
| 4965 | u_enfold = enfolds(gy.youmonst.data); |
| 4966 | struct obj *otmp; |
| 4967 | struct permonst *pd = mdef->data; |
| 4968 | const char *expel_verb = u_digest ? "regurgitate" |
| 4969 | : u_enfold ? "release" |
| 4970 | : "expel"; |
| 4971 | |
| 4972 | /* Not totally the same as for real monsters. Specifically, these |
| 4973 | * don't take multiple moves. (It's just too hard, for too little |
| 4974 | * result, to program monsters which attack from inside you, which |
| 4975 | * would be necessary if done accurately.) Instead, we arbitrarily |
| 4976 | * kill the monster immediately for AD_DGST and we regurgitate them |
| 4977 | * after exactly 1 round of attack otherwise. -KAA |
| 4978 | */ |
| 4979 | |
| 4980 | if (!engulf_target(&gy.youmonst, mdef)) |
| 4981 | return M_ATTK_MISS; |
| 4982 | |
| 4983 | if (!(u_digest && u.uhunger >= 1500) && !u.uswallow) { |
| 4984 | if (!flaming(gy.youmonst.data)) { |
| 4985 | for (otmp = mdef->minvent; otmp; otmp = otmp->nobj) |
| 4986 | (void) snuff_lit(otmp); |
| 4987 | } |
| 4988 | |
| 4989 | /* force vampire in bat, cloud, or wolf form to revert back to |
| 4990 | vampire form now instead of dealing with that when it dies */ |
| 4991 | if (is_vampshifter(mdef) |
| 4992 | && newcham(mdef, &mons[mdef->cham], NO_NC_FLAGS)) { |
| 4993 | You("%s it, then %s it.", |
| 4994 | u_digest ? "swallow" : u_enfold ? "enclose" : "engulf", |
| 4995 | expel_verb); |
| 4996 | if (canspotmon(mdef)) { |
| 4997 | /* Avoiding a_monnam here: if the target is named, it gives us |
| 4998 | a sequence like "You bite Dracula. You swallow it, then |
| 4999 | regurgitate it. It turns into Dracula." */ |
| 5000 | pline("It turns into %s.", |
| 5001 | x_monnam(mdef, ARTICLE_A, (char *) 0, |
| 5002 | (SUPPRESS_NAME | SUPPRESS_IT |
| 5003 | | SUPPRESS_INVISIBLE), FALSE)); |
| 5004 | } else { |
| 5005 | map_invisible(mdef->mx, mdef->my); |
| 5006 | } |
| 5007 | return M_ATTK_HIT; |
| 5008 | } |
| 5009 | |
| 5010 | /* engulfing a cockatrice or digesting a Rider or Medusa */ |
| 5011 | fatal_gulp = (touch_petrifies(pd) && !Stone_resistance) |
| 5012 | || (mattk->adtyp == AD_DGST |
| 5013 | && (is_rider(pd) || (pd == &mons[PM_MEDUSA] |
| 5014 | && !Stone_resistance))); |
no test coverage detected