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

Function disturb

src/monmove.c:326–358  ·  view source on GitHub ↗

* Possibly awaken the given monster. Return a 1 if the monster has been * jolted awake. */

Source from the content-addressed store, hash-verified

324 * jolted awake.
325 */
326staticfn int
327disturb(struct monst *mtmp)
328{
329 /*
330 * + Ettins are hard to surprise.
331 * + Nymphs, jabberwocks, and leprechauns do not easily wake up.
332 *
333 * Wake up if:
334 * in direct LOS AND
335 * within 10 squares AND
336 * not stealthy or (mon is an ettin and 9/10) AND
337 * (mon is not a nymph, jabberwock, or leprechaun) or 1/50 AND
338 * Aggravate or mon is (dog or human) or
339 * (1/7 and mon is not mimicking furniture or object)
340 */
341 if (couldsee(mtmp->mx, mtmp->my) && mdistu(mtmp) <= 100
342 && (!Stealth || (mtmp->data == &mons[PM_ETTIN] && rn2(10)))
343 && (!(mtmp->data->mlet == S_NYMPH
344 || mtmp->data == &mons[PM_JABBERWOCK]
345#if 0 /* DEFERRED */
346 || mtmp->data == &mons[PM_VORPAL_JABBERWOCK]
347#endif
348 || mtmp->data->mlet == S_LEPRECHAUN) || !rn2(50))
349 && (Aggravate_monster
350 || (mtmp->data->mlet == S_DOG || mtmp->data->mlet == S_HUMAN)
351 || (!rn2(7) && M_AP_TYPE(mtmp) != M_AP_FURNITURE
352 && M_AP_TYPE(mtmp) != M_AP_OBJECT))) {
353 wake_msg(mtmp, !mtmp->mpeaceful);
354 mtmp->msleeping = 0;
355 return 1;
356 }
357 return 0;
358}
359
360/* ungrab/expel held/swallowed hero */
361staticfn void

Callers 1

dochugFunction · 0.85

Calls 2

rn2Function · 0.85
wake_msgFunction · 0.85

Tested by

no test coverage detected