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

Function mb_trapped

src/monmove.c:53–74  ·  view source on GitHub ↗

monster has triggered trapped door lock or was present when it got triggered remotely (at door spot, door hit by zap); returns True if mtmp dies */

Source from the content-addressed store, hash-verified

51 triggered remotely (at door spot, door hit by zap);
52 returns True if mtmp dies */
53boolean
54mb_trapped(struct monst *mtmp, boolean canseeit)
55{
56 if (flags.verbose) {
57 if (canseeit && !Unaware)
58 pline_mon(mtmp, "KABOOM!! You see a door explode.");
59 else if (!Deaf)
60 You_hear("a %s explosion.",
61 (mdistu(mtmp) > 7 * 7) ? "distant" : "nearby");
62 }
63 wake_nearto(mtmp->mx, mtmp->my, 7 * 7);
64 mtmp->mstun = 1;
65 mtmp->mhp -= rnd(15);
66 if (DEADMONSTER(mtmp)) {
67 mondied(mtmp);
68 if (DEADMONSTER(mtmp))
69 return TRUE;
70 /* will get here if lifesaved */
71 }
72 mon_learns_traps(mtmp, TRAPPED_DOOR);
73 return FALSE;
74}
75
76/* push coordinate x,y to mtrack, making monster remember where it was */
77void

Callers 4

mdig_tunnelFunction · 0.85
doorlockFunction · 0.85
vamprisesFunction · 0.85
postmovFunction · 0.85

Calls 6

pline_monFunction · 0.85
You_hearFunction · 0.85
wake_neartoFunction · 0.85
rndFunction · 0.85
mondiedFunction · 0.85
mon_learns_trapsFunction · 0.85

Tested by

no test coverage detected