MCPcopy Create free account
hub / github.com/NetHack/NetHack / expels

Function expels

src/mhitu.c:263–306  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

261}
262
263void
264expels(
265 struct monst *mtmp,
266 struct permonst *mdat, /* if mtmp is polymorphed, mdat != mtmp->data */
267 boolean message)
268{
269 disp.botl = TRUE;
270 if (message) {
271 if (digests(mdat)) {
272 You("get regurgitated!");
273 } else if (enfolds(mdat)) {
274 pline_mon(mtmp, "%s unfolds and you are released!", Monnam(mtmp));
275 } else {
276 char blast[40];
277 struct attack *attk = attacktype_fordmg(mdat, AT_ENGL, AD_ANY);
278
279 blast[0] = '\0';
280 if (!attk) {
281 impossible("Swallower has no engulfing attack?");
282 } else {
283 if (is_whirly(mdat)) {
284 switch (attk->adtyp) {
285 case AD_ELEC:
286 Strcpy(blast, " in a shower of sparks");
287 break;
288 case AD_COLD:
289 Strcpy(blast, " in a blast of frost");
290 break;
291 }
292 } else {
293 Strcpy(blast, " with a squelch");
294 }
295 You("get expelled from %s%s!", mon_nam(mtmp), blast);
296 }
297 }
298 }
299 unstuck(mtmp); /* ball&chain returned in unstuck() */
300 mnexto(mtmp, RLOC_NOMSG);
301 newsym(u.ux, u.uy);
302 /* to cover for a case where mtmp is not in a next square */
303 if (um_dist(mtmp->mx, mtmp->my, 1))
304 pline("Brrooaa... You land hard at some distance.");
305 spoteffects(TRUE);
306}
307
308/* select a monster's next attack, possibly substituting for its usual one */
309struct attack *

Callers 14

savelifeFunction · 0.85
openitFunction · 0.85
tacticsFunction · 0.85
zap_digFunction · 0.85
polymonFunction · 0.85
dospinwebFunction · 0.85
tamedogFunction · 0.85
vamprisesFunction · 0.85
vamp_stoneFunction · 0.85
newchamFunction · 0.85
bhitmFunction · 0.85
release_holdFunction · 0.85

Calls 12

YouFunction · 0.85
pline_monFunction · 0.85
MonnamFunction · 0.85
attacktype_fordmgFunction · 0.85
mon_namFunction · 0.85
unstuckFunction · 0.85
mnextoFunction · 0.85
newsymFunction · 0.85
um_distFunction · 0.85
spoteffectsFunction · 0.85
impossibleFunction · 0.70
plineFunction · 0.70

Tested by

no test coverage detected