]> granicus.if.org Git - nethack/commitdiff
still held by monster after it moves away (trunk only)
authornethack.rankin <nethack.rankin>
Tue, 30 Jun 2009 02:45:46 +0000 (02:45 +0000)
committernethack.rankin <nethack.rankin>
Tue, 30 Jun 2009 02:45:46 +0000 (02:45 +0000)
     From a bug report, a stunned monster
moved away from the hero, but remained holding him.  That behavior was
still present in the dev code, although the hero was free to move and
would become unstuck as soon as he did so.  I don't know how many fixes
for this sort of thing have been made, but they evidently haven't been
made in the proper place.  [Perhaps it really ought to be done as a
monster is placed somewhere on the map?]

doc/fixes35.0
src/monmove.c

index e62c335525dc1baca617a2d66be138b4c8f2488e..4b1c5a62e44a99568736100b4c66585991967ab8 100644 (file)
@@ -161,6 +161,7 @@ pushing a boulder onto a level teleporter trap could issue repeat messages
 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
index e15c65016d030fe3ec7ded0b14e6622c3b5dee82..16533775b3fde95b753e8d5e6c03ffb7c7f062b2 100644 (file)
@@ -1,5 +1,4 @@
 /* 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. */
 
@@ -295,9 +294,6 @@ register struct monst *mtmp;
        register struct permonst *mdat;
        register int tmp=0;
        int inrange, nearby, scared;
-#ifdef GOLDOBJ
-        struct obj *ygold = 0, *lepgold = 0;
-#endif
 
 /*     Pre-movement adjustments        */
 
@@ -479,19 +475,14 @@ toofar:
 
 /*     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) {
@@ -534,18 +525,21 @@ toofar:
                    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);
                }