hiding monsters vs traps (trunk only)

From a bug report, the game gave feedback
about a monster becoming stuck in a web but there seemed to be no monster
around because it immediately began hiding under an object at the web's
location.  Prevent monsters--or poly'd hero--from hiding when trapped in
anything other than a pit or spiked pit.  Also, prevent them from hiding if
they're holding you or you're poly'd and holding them.  I'm not sure whether
either of those cases ever actually happened but big mimics are capable of
both hiding and grabbing on.
This commit is contained in:
nethack.rankin
2006-05-27 03:46:03 +00:00
parent a58f2c59eb
commit 72d819a020
3 changed files with 29 additions and 6 deletions

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)polyself.c 3.5 2005/09/19 */
/* SCCS Id: @(#)polyself.c 3.5 2006/05/26 */
/* Copyright (C) 1987, 1988, 1989 by Ken Arromdee */
/* NetHack may be freely redistributed. See license for details. */
@@ -1096,6 +1096,20 @@ dohide()
{
boolean ismimic = youmonst.data->mlet == S_MIMIC;
if ((u.utrap && u.utraptype != TT_PIT) || u.ustuck) {
You_cant("hide while you're %s.",
!u.ustuck ? "trapped" :
!sticks(youmonst.data) ? "being held" :
humanoid(u.ustuck->data) ? "holding someone" :
"holding that creature");
if (u.uundetected ||
(ismimic && youmonst.m_ap_type != M_AP_NOTHING)) {
u.uundetected = 0;
youmonst.m_ap_type = M_AP_NOTHING;
newsym(u.ux, u.uy);
}
return 0;
}
if (u.uundetected || (ismimic && youmonst.m_ap_type != M_AP_NOTHING)) {
You("are already hiding.");
return(0);