MCPcopy Index your code
hub / github.com/NetHack/NetHack / unstuck

Function unstuck

src/mon.c:3437–3467  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3435}
3436
3437void
3438unstuck(struct monst *mtmp)
3439{
3440 if (u.ustuck == mtmp) {
3441 struct permonst *ptr = mtmp->data;
3442 unsigned swallowed = u.uswallow;
3443
3444 /* do this first so that docrt()'s botl update is accurate;
3445 clears u.uswallow as well as setting u.ustuck to Null */
3446 set_ustuck((struct monst *) 0);
3447
3448 if (swallowed) {
3449 gm.mswallower = (struct monst *) 0;
3450 u.ux = mtmp->mx;
3451 u.uy = mtmp->my;
3452 if (Punished && uchain->where != OBJ_FLOOR)
3453 placebc();
3454 gv.vision_full_recalc = 1;
3455 docrt();
3456 }
3457
3458 /* prevent holder/engulfer from immediately re-holding/re-engulfing
3459 [note: this call to unstuck() might be because u.ustuck has just
3460 changed shape and doesn't have a holding attack any more, hence
3461 don't set mspec_used unconditionally] */
3462 if (!mtmp->mspec_used && (dmgtype(ptr, AD_STCK)
3463 || attacktype(ptr, AT_ENGL)
3464 || attacktype(ptr, AT_HUGS)))
3465 mtmp->mspec_used = rnd(2);
3466 }
3467}
3468
3469void
3470killed(struct monst *mtmp)

Callers 15

savelifeFunction · 0.85
mhitm_knockbackFunction · 0.85
rloc_to_coreFunction · 0.85
u_teleport_monFunction · 0.85
slept_monstFunction · 0.85
dog_moveFunction · 0.85
tamedogFunction · 0.85
mon_leaving_levelFunction · 0.85
mongoneFunction · 0.85
migrate_monFunction · 0.85
newchamFunction · 0.85
release_holdFunction · 0.85

Calls 6

set_ustuckFunction · 0.85
placebcFunction · 0.85
docrtFunction · 0.85
dmgtypeFunction · 0.85
attacktypeFunction · 0.85
rndFunction · 0.85

Tested by

no test coverage detected