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

Function m_tele

src/muse.c:383–413  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

381}
382
383staticfn void
384m_tele(
385 struct monst *mtmp, /* monst that might be teleported */
386 boolean vismon, /* can see it */
387 boolean oseen, /* have seen the object that triggered this */
388 int how) /* type of that object */
389{
390 if (tele_restrict(mtmp)) { /* mysterious force... */
391 if (vismon && how) /* mentions 'teleport' */
392 makeknown(how);
393 /* monster learns that teleportation isn't useful here */
394 if (noteleport_level(mtmp))
395 mon_learns_traps(mtmp, TELEP_TRAP);
396 } else if ((mon_has_amulet(mtmp) || On_W_tower_level(&u.uz)) && !rn2(3)) {
397 if (vismon)
398 pline_mon(mtmp, "%s seems disoriented for a moment.", Monnam(mtmp));
399 } else {
400 /* teleport monster 'mtmp' */
401 if (how) {
402 /* teleporation has been triggered by an object */
403 if (oseen)
404 makeknown(how);
405 (void) rloc(mtmp, RLOC_MSG);
406 } else {
407 /* monster is voluntarily entering a teleporation trap; use the
408 trap instead of rloc() in case it sends 'victim' to a vault */
409 mtmp->mx = gt.trapx, mtmp->my = gt.trapy;
410 (void) mintrap(mtmp, FORCETRAP);
411 }
412 }
413}
414
415/* return TRUE if monster mtmp has another monster next to it.
416 * Called from find_defensive() where it is limited to Is_knox()

Callers 1

use_defensiveFunction · 0.85

Calls 10

tele_restrictFunction · 0.85
noteleport_levelFunction · 0.85
mon_learns_trapsFunction · 0.85
mon_has_amuletFunction · 0.85
On_W_tower_levelFunction · 0.85
rn2Function · 0.85
pline_monFunction · 0.85
MonnamFunction · 0.85
rlocFunction · 0.85
mintrapFunction · 0.85

Tested by

no test coverage detected