if shopkeeper or priest gets teleported while inside his shop or temple,
give locations inside that room preference when choosing destination
tame/peaceful grabber/engulfer will release hero after conflict ends
+any grabber will release hero if it moves away while confused/stunned/afraid
make changes in hallucination be reflected by changes in mimickery feedback
add Unaware pseudo-property to suppress various messages while unconscious
missile which kills engulfer will now be placed prior to hero's return to map
/* NetHack 3.5 monmove.c $Date$ $Revision$ */
-/* SCCS Id: @(#)monmove.c 3.5 2007/08/19 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
register struct permonst *mdat;
register int tmp=0;
int inrange, nearby, scared;
-#ifdef GOLDOBJ
- struct obj *ygold = 0, *lepgold = 0;
-#endif
/* Pre-movement adjustments */
/* Now the actual movement phase */
-#ifndef GOLDOBJ
if(!nearby || mtmp->mflee || scared ||
mtmp->mconf || mtmp->mstun || (mtmp->minvis && !rn2(3)) ||
- (mdat->mlet == S_LEPRECHAUN && !u.ugold && (mtmp->mgold || rn2(2))) ||
+#ifndef GOLDOBJ
+ (mdat->mlet == S_LEPRECHAUN &&
+ !u.ugold && (mtmp->mgold || rn2(2))) ||
#else
- if (mdat->mlet == S_LEPRECHAUN) {
- ygold = findgold(invent);
- lepgold = findgold(mtmp->minvent);
- }
-
- if(!nearby || mtmp->mflee || scared ||
- mtmp->mconf || mtmp->mstun || (mtmp->minvis && !rn2(3)) ||
- (mdat->mlet == S_LEPRECHAUN && !ygold && (lepgold || rn2(2))) ||
+ (mdat->mlet == S_LEPRECHAUN &&
+ !findgold(invent) && (findgold(mtmp->minvent) || rn2(2))) ||
#endif
(is_wanderer(mdat) && !rn2(4)) || (Conflict && !mtmp->iswiz) ||
(!mtmp->mcansee && !rn2(4)) || mtmp->mpeaceful) {
case 1: /* monster moved */
/* Maybe it stepped on a trap and fell asleep... */
if (mtmp->msleeping || !mtmp->mcanmove) return(0);
- if(!nearby &&
- (ranged_attk(mdat) || find_offensive(mtmp)))
+ /* Monsters can move and then shoot on same turn;
+ our hero can't. Is that fair? */
+ if (!nearby &&
+ (ranged_attk(mdat) || find_offensive(mtmp)))
break;
- else if(u.uswallow && mtmp == u.ustuck) {
+ /* engulfer/grabber checks */
+ if (mtmp == u.ustuck) {
/* a monster that's digesting you can move at the
* same time -dlc
*/
- return(mattacku(mtmp));
- } else
- return(0);
- /*NOTREACHED*/
- break;
+ if (u.uswallow) return mattacku(mtmp);
+ /* if confused grabber has wandered off, let go */
+ if (distu(mtmp->mx, mtmp->my) > 2) unstuck(mtmp);
+ }
+ return(0);
case 2: /* monster died */
return(1);
}