unwatched hiders may hide again; if so, returns True */
| 4659 | |
| 4660 | /* unwatched hiders may hide again; if so, returns True */ |
| 4661 | staticfn boolean |
| 4662 | restrap(struct monst *mtmp) |
| 4663 | { |
| 4664 | struct trap *t; |
| 4665 | |
| 4666 | if (mtmp->mcan || M_AP_TYPE(mtmp) || cansee(mtmp->mx, mtmp->my) |
| 4667 | || rn2(3) || mtmp == u.ustuck |
| 4668 | /* can't hide while trapped except in pits */ |
| 4669 | || (mtmp->mtrapped && (t = t_at(mtmp->mx, mtmp->my)) != 0 |
| 4670 | && !is_pit(t->ttyp)) |
| 4671 | /* can't hide on ceiling if there isn't one */ |
| 4672 | || (ceiling_hider(mtmp->data) && !has_ceiling(&u.uz)) |
| 4673 | /* won't hide when adjacent to hero */ |
| 4674 | || (sensemon(mtmp) && m_next2u(mtmp))) |
| 4675 | return FALSE; |
| 4676 | |
| 4677 | if (mtmp->data->mlet == S_MIMIC) { |
| 4678 | if (mtmp->msleeping || mtmp->mfrozen) { |
| 4679 | /* |
| 4680 | * The mimic needs to be awake to disguise itself |
| 4681 | * as something else. |
| 4682 | */ |
| 4683 | return FALSE; |
| 4684 | } |
| 4685 | set_mimic_sym(mtmp); |
| 4686 | return TRUE; |
| 4687 | } else if (levl[mtmp->mx][mtmp->my].typ == ROOM) { |
| 4688 | mtmp->mundetected = 1; |
| 4689 | return TRUE; |
| 4690 | } |
| 4691 | |
| 4692 | return FALSE; |
| 4693 | } |
| 4694 | |
| 4695 | /* reveal a hiding monster at x,y, either under nonexistent object, |
| 4696 | or an eel out of water. */ |
no test coverage detected