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

Function gulpmu

src/mhitu.c:1288–1587  ·  view source on GitHub ↗

monster swallows you, or damage if already swallowed (u.uswallow != 0) */

Source from the content-addressed store, hash-verified

1286
1287/* monster swallows you, or damage if already swallowed (u.uswallow != 0) */
1288staticfn int
1289gulpmu(struct monst *mtmp, struct attack *mattk)
1290{
1291 struct trap *t = t_at(u.ux, u.uy);
1292 int tmp = d((int) mattk->damn, (int) mattk->damd);
1293 int tim_tmp;
1294 struct obj *otmp2, *nextobj;
1295 int i;
1296 boolean physical_damage = FALSE;
1297
1298 if (!u.uswallow) { /* swallows you */
1299 int omx = mtmp->mx, omy = mtmp->my;
1300
1301 if (!engulf_target(mtmp, &gy.youmonst))
1302 return M_ATTK_MISS;
1303 if ((t && is_pit(t->ttyp)) && sobj_at(BOULDER, u.ux, u.uy))
1304 return M_ATTK_MISS;
1305 if (failed_grab(mtmp, &gy.youmonst, mattk))
1306 return M_ATTK_MISS;
1307
1308 if (Punished)
1309 unplacebc(); /* ball&chain go away */
1310 remove_monster(omx, omy);
1311 mtmp->mtrapped = 0; /* no longer on old trap */
1312 place_monster(mtmp, u.ux, u.uy);
1313 set_ustuck(mtmp);
1314 newsym(mtmp->mx, mtmp->my);
1315 /* 5.0: dismount for all engulfers, not just for purple worms */
1316 if (u.usteed) {
1317 char buf[BUFSZ];
1318
1319 Strcpy(buf, mon_nam(u.usteed));
1320 urgent_pline("%s %s forward and plucks you off %s!",
1321 Some_Monnam(mtmp),
1322 /* 't', purple 'w' */
1323 is_animal(mtmp->data) ? "lunges"
1324 /* 'v', air 'E' */
1325 : is_whirly(mtmp->data) ? "whirls"
1326 /* none (some 'v', already whirling) */
1327 : unsolid(mtmp->data) ? "flows"
1328 /* ochre 'j', Juiblex */
1329 : amorphous(mtmp->data) ? "oozes"
1330 /* none (all AT_ENGL are already covered) */
1331 : "surges",
1332 buf);
1333 dismount_steed(DISMOUNT_ENGULFED);
1334 } else {
1335 urgent_pline("%s %s!", Monnam(mtmp),
1336 digests(mtmp->data) ? "swallows you whole"
1337 : enfolds(mtmp->data) ? "folds itself around you"
1338 : "engulfs you");
1339 }
1340 stop_occupation();
1341 reset_occupations(); /* behave as if you had moved */
1342
1343 if (u.utrap) {
1344 You("are released from the %s!",
1345 (u.utraptype == TT_WEB) ? "web" : "trap");

Callers 2

mattackuFunction · 0.85
gulp_blnd_checkFunction · 0.85

Calls 15

t_atFunction · 0.85
dFunction · 0.85
engulf_targetFunction · 0.85
sobj_atFunction · 0.85
failed_grabFunction · 0.85
unplacebcFunction · 0.85
place_monsterFunction · 0.85
set_ustuckFunction · 0.85
newsymFunction · 0.85
mon_namFunction · 0.85
urgent_plineFunction · 0.85
Some_MonnamFunction · 0.85

Tested by

no test coverage detected