!has_ceiling(&u.uz) ? "without ceiling"
: "in solid stone",
msg);
- if (mtmp->mtrapped && (t = t_at(mx, my)) != 0
- && !(t->ttyp == PIT || t->ttyp == SPIKED_PIT))
+ if (mtmp->mtrapped && (t = t_at(mx, my)) != 0 && !is_pit(t->ttyp))
impossible("hiding while trapped in a non-pit (%s)", msg);
} else if (M_AP_TYPE(mtmp) != M_AP_NOTHING) {
boolean is_mimic = (mptr->mlet == S_MIMIC);
if ((mtmp = m_at(x, y)) == 0 && u_at(x, y))
mtmp = &gy.youmonst;
if (mtmp && mtmp->mundetected
- && ((hides_under(mtmp->data) && !OBJ_AT(x, y))
+ && ((hides_under(mtmp->data) && (!OBJ_AT(x, y) || mtmp->mtrapped))
|| (mtmp->data->mlet == S_EEL && !is_pool(x, y))))
(void) hideunder(mtmp);
}
coordxy x = is_u ? u.ux : mtmp->mx, y = is_u ? u.uy : mtmp->my;
if (mtmp == u.ustuck) {
- ; /* can't hide if holding you or held by you */
+ ; /* undetected==FALSE; can't hide if holding you or held by you */
} else if (is_u ? (u.utrap && u.utraptype != TT_PIT)
- : (mtmp->mtrapped && (t = t_at(x, y)) != 0
- && !is_pit(t->ttyp))) {
- ; /* can't hide while stuck in a non-pit trap */
+ : (mtmp->mtrapped
+ && (t = t_at(x, y)) != 0 && !is_pit(t->ttyp))) {
+ ; /* undetected==FALSE; can't hide while stuck in a non-pit trap */
} else if (mtmp->data->mlet == S_EEL) {
undetected = (is_pool(x, y) && !Is_waterlevel(&u.uz));
} else if (hides_under(mtmp->data) && OBJ_AT(x, y)) {
/* if (n == 0) animal_temp[n++] = NON_PM; */
ga.animal_list = (short *) alloc(n * sizeof *ga.animal_list);
- (void) memcpy((genericptr_t) ga.animal_list, (genericptr_t) animal_temp,
+ (void) memcpy((genericptr_t) ga.animal_list,
+ (genericptr_t) animal_temp,
n * sizeof *ga.animal_list);
ga.animal_list_count = n;
} else { /* release */
otmp->opoisoned = 1;
if (u.usteed && !rn2(2) && steedintrap(trap, otmp)) {
; /* nothing */
- } else if (thitu(7, dmgval(otmp, &gy.youmonst), &otmp, "little dart")) {
+ } else if (thitu(7, dmgval(otmp, &gy.youmonst),
+ &otmp, "little dart")) {
if (otmp) {
if (otmp->opoisoned)
poisoned("dart", A_CON, "little dart",
plunged
? "deliberately plunged into a pit of iron spikes"
: (conj_pit || deliberate)
- ? "stepped into a pit of iron spikes"
- : adj_pit
- ? "stumbled into a pit of iron spikes"
- : "fell into a pit of iron spikes",
+ ? "stepped into a pit of iron spikes"
+ : adj_pit
+ ? "stumbled into a pit of iron spikes"
+ : "fell into a pit of iron spikes",
NO_KILLER_PREFIX);
if (!rn2(6))
poisoned("spikes", A_STR,
}
static int
-steedintrap(struct trap* trap, struct obj* otmp)
+steedintrap(struct trap *trap, struct obj *otmp)
{
struct monst *steed = u.usteed;
int tt;
|| (tt == HOLE && !mindless(mptr)));
if (mtmp == u.usteed) {
- /* true when called from dotrap, inescapable is not an option */
+ ; /* true when called from dotrap, inescapable is not an option */
} else if (Sokoban && (is_pit(tt) || is_hole(tt)) && !trap->madeby_u) {
- /* nothing here, the trap effects will handle messaging */
+ ; /* nothing here, the trap effects will handle messaging */
} else if (!forcetrap) {
if (floor_trigger(tt) && check_in_air(mtmp, mintrapflags)) {
return Trap_Effect_Finished;
setmangry(mtmp, FALSE);
trap_result = trapeffect_selector(mtmp, trap, mintrapflags);
+
+ /* mtmp can't stay hiding under an object if trapped in non-pit
+ (mtmp hiding under object at armed bear trap loccation, hero
+ zaps wand of locking or spell of wizard lock at spot triggering
+ the trap and trapping mtmp there) */
+ if (!DEADMONSTER(mtmp) && mtmp->mtrapped) {
+ boolean alreadyspotted = canspotmon(mtmp);
+
+ maybe_unhide_at(mtmp->mx, mtmp->my);
+ if (!alreadyspotted && canseemon(mtmp))
+ pline("%s appears.", Amonnam(mtmp));
+ }
}
return trap_result;
}