| 381 | } |
| 382 | |
| 383 | staticfn void |
| 384 | m_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() |
no test coverage detected