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

Function mk_trap_statue

src/trap.c:389–414  ·  view source on GitHub ↗

create a "living" statue at x,y */

Source from the content-addressed store, hash-verified

387
388/* create a "living" statue at x,y */
389staticfn void
390mk_trap_statue(coordxy x, coordxy y)
391{
392 struct monst *mtmp;
393 struct obj *otmp, *statue;
394 struct permonst *mptr;
395 int trycount = 10;
396
397 do { /* avoid ultimately hostile co-aligned unicorn */
398 mptr = &mons[rndmonnum_adj(3, 6)];
399 } while (--trycount > 0 && is_unicorn(mptr)
400 && sgn(u.ualign.type) == sgn(mptr->maligntyp));
401 statue = mkcorpstat(STATUE, (struct monst *) 0, mptr, x, y,
402 CORPSTAT_NONE);
403 mtmp = makemon(&mons[statue->corpsenm], 0, 0, MM_NOCOUNTBIRTH | MM_NOMSG);
404 if (!mtmp)
405 return; /* should never happen */
406 while (mtmp->minvent) {
407 otmp = mtmp->minvent;
408 otmp->owornmask = 0;
409 obj_extract_self(otmp);
410 (void) add_to_container(statue, otmp);
411 }
412 statue->owt = weight(statue);
413 mongone(mtmp);
414}
415
416/* find "bottom" level of specified dungeon, stopping at quest locate */
417staticfn int

Callers 1

maketrapFunction · 0.85

Calls 8

rndmonnum_adjFunction · 0.85
sgnFunction · 0.85
mkcorpstatFunction · 0.85
makemonFunction · 0.85
obj_extract_selfFunction · 0.85
add_to_containerFunction · 0.85
weightFunction · 0.85
mongoneFunction · 0.85

Tested by

no test coverage detected