]> granicus.if.org Git - nethack/commitdiff
fix grab/engulf by tame/peaceful monster (trunk only)
authornethack.rankin <nethack.rankin>
Thu, 17 Aug 2006 04:35:08 +0000 (04:35 +0000)
committernethack.rankin <nethack.rankin>
Thu, 17 Aug 2006 04:35:08 +0000 (04:35 +0000)
     <Someone> reported being swallowed by his pet purple worm during
Conflict, then being stuck inside once Conflict ended.  I'm not entirely
sure what dog_move() intended by the "swallowed case handled above" comment.
It returns without letting the pet move when the distance between pet and
hero is 0; that wasn't much in the way of "handling" being swallowed.
Grabbing pets did let go, but peaceful monsters didn't until you actually
attempted to move away from them.  Now all four combinations (grabbed or
swallowed by tame or peaceful monster) are handled the same:  the monster
will let the hero go next time it gets a chance to try to move, using up
its move in the process.

doc/fixes35.0
src/dogmove.c
src/monmove.c

index 33f4c8e87ac80caadce60ecb6a07448c55ab5711..fbf416760b48a0ff6d3b56a2b53e058270f57705 100644 (file)
@@ -155,6 +155,7 @@ make region ttl field a long instead of short to get rid of lint warnings
 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
 
 
 Platform- and/or Interface-Specific Fixes
index 88224d431804910237e6bc35b217b35942c7ddb0..6b7518fcf2f610924e59854f61dfdd1c915b6b8d 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)dogmove.c  3.5     2005/10/14      */
+/*     SCCS Id: @(#)dogmove.c  3.5     2006/08/16      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -635,11 +635,13 @@ register int after;       /* this is extra fast monster movement */
                return 2;       /* current monster is gone */
            }
        }
+#if 0  /* [this is now handled in dochug()] */
        if (!Conflict && !mtmp->mconf &&
            mtmp == u.ustuck && !sticks(youmonst.data)) {
            unstuck(mtmp);      /* swallowed case handled above */
            You("get released!");
        }
+#endif
        if (!nohands(mtmp->data) && !verysmall(mtmp->data)) {
            allowflags |= OPENDOOR;
            if (monhaskey(mtmp, TRUE)) allowflags |= UNLOCKDOOR;
index 21a89afad184d7eba905df27f9eda7699d5b885c..f3aacb73fab70e5496617a50525e785271b3ca62 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)monmove.c  3.5     2005/10/14      */
+/*     SCCS Id: @(#)monmove.c  3.5     2006/08/16      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -8,13 +8,13 @@
 
 extern boolean notonhead;
 
+STATIC_DCL void FDECL(watch_on_duty,(struct monst *));
 STATIC_DCL int FDECL(disturb,(struct monst *));
+STATIC_DCL void FDECL(release_hero, (struct monst *));
 STATIC_DCL void FDECL(distfleeck,(struct monst *,int *,int *,int *));
 STATIC_DCL int FDECL(m_arrival, (struct monst *));
-STATIC_DCL void FDECL(watch_on_duty,(struct monst *));
 STATIC_DCL boolean FDECL(stuff_prevents_passage, (struct monst *));
-STATIC_OVL int FDECL(vamp_shift, (struct monst *,struct permonst *));
-
+STATIC_DCL int FDECL(vamp_shift, (struct monst *,struct permonst *));
 
 boolean /* TRUE : mtmp died */
 mb_trapped(mtmp)
@@ -203,6 +203,21 @@ disturb(mtmp)
        return(0);
 }
 
+/* ungrab/expel held/swallowed hero */
+STATIC_OVL void
+release_hero(mon)
+struct monst *mon;
+{
+       if (mon == u.ustuck) {
+           if (u.uswallow) {
+               expels(mon, mon->data, TRUE);
+           } else if (!sticks(youmonst.data)) {
+               unstuck(mon);   /* let go */
+               You("get released!");
+           }
+       }
+}
+
 /* monster begins fleeing for the specified time, 0 means untimed flee
  * if first, only adds fleetime if monster isn't already fleeing
  * if fleemsg, prints a message about new flight, otherwise, caller should */
@@ -213,14 +228,7 @@ int fleetime;
 boolean first;
 boolean fleemsg;
 {
-       if (u.ustuck == mtmp) {
-           if (u.uswallow)
-               expels(mtmp, mtmp->data, TRUE);
-           else if (!sticks(youmonst.data)) {
-               unstuck(mtmp);  /* monster lets go when fleeing */
-               You("get released!");
-           }
-       }
+       if (mtmp == u.ustuck) release_hero(mtmp);       /* expels/unstuck */
 
        if (!first || !mtmp->mflee) {
            /* don't lose untimed scare */
@@ -360,6 +368,12 @@ register struct monst *mtmp;
        if (mtmp->mflee && !mtmp->mfleetim
           && mtmp->mhp == mtmp->mhpmax && !rn2(25)) mtmp->mflee = 0;
 
+       /* cease conflict-induced swallow/grab if conflict has ended */
+       if (mtmp == u.ustuck && mtmp->mpeaceful && !mtmp->mconf && !Conflict) {
+           release_hero(mtmp);
+           return 0;   /* uses up monster's turn */
+       }
+
        set_apparxy(mtmp);
        /* Must be done after you move and before the monster does.  The
         * set_apparxy() call in m_move() doesn't suffice since the variables
@@ -1517,4 +1531,5 @@ struct permonst *ptr;
        }
        return reslt;
 }
+
 /*monmove.c*/