]> granicus.if.org Git - nethack/commitdiff
fix #H2397 - "<Mon> turns to flee" when paralyzed (trunk only)
authornethack.rankin <nethack.rankin>
Sat, 20 Aug 2011 00:22:20 +0000 (00:22 +0000)
committernethack.rankin <nethack.rankin>
Sat, 20 Aug 2011 00:22:20 +0000 (00:22 +0000)
     From a bug report, a
monster incapable of moving could yield the message "<Mon> turns to flee!"
when hit by an attack which scared it.  I thought that something to fix
this had already been done, but that wasn't the case.  Now it will give
"The immobile <mon> seems to flinch" instead.  I'd rather use
  mon->data->mmove == 0 ? "immobile <mon>" :
    mon->paralyzed ? "paralyzed <mon>" : "sleeping <mon>"
but it presently isn't possible to distinguish between sleep, paralysis,
and being busy doning armor because mon->mfrozen is used for all three.
(I'm not going to worry about the busy case, even though "immobile" sounds
inaccurate for it.)

     Also, stethoscope and probing were suppressing "scared" after giving
"can't move", in order to reduce the chance of wrapping the top line.
This changes it to display both status conditions so that scared state
isn't hidden when the target is paralyzed or asleep (or busy).

doc/fixes35.0
src/fountain.c
src/monmove.c
src/pline.c
src/uhitm.c

index 4a7c0a4a255b5da3f1db1559fe2f1899e5d467f1..657a2cabf6baeecc4b80993c6a5ac2a871eb45b1 100644 (file)
@@ -377,6 +377,7 @@ when shop prices are adjusted, handle roundoff (integer truncation) better
 for hero poly'd into a monster form that lacks a weapon attack but has a claw
        attack, use wielded weapon even when claw attack isn't the very first
 rename the SLEEPING property and Sleeping attribute to SLEEPY and Sleepy, resp.
+give alternate message for "<mon> turns to flee" when mon can't move
 
 
 Platform- and/or Interface-Specific Fixes
index 0339b8391da877695c2b562ec955128e8a7935fb..bb0745002136ede5d2ef1de5d8c1fbd58aebbbe4 100644 (file)
@@ -1,5 +1,4 @@
 /* NetHack 3.5 fountain.c      $Date$  $Revision$ */
-/*     SCCS Id: @(#)fountain.c 3.5     2009/01/31      */
 /*     Copyright Scott R. Turner, srt@ucla, 10/27/86 */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -334,15 +333,17 @@ drinkfountain()
                        dowaternymph();
                        break;
 
-               case 29: /* Scare */ {
+               case 29: /* Scare */
+                   {
                        register struct monst *mtmp;
 
                        pline("This water gives you bad breath!");
-                       for(mtmp = fmon; mtmp; mtmp = mtmp->nmon)
-                           if(!DEADMONSTER(mtmp))
-                               monflee(mtmp, 0, FALSE, FALSE);
+                       for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
+                           if (DEADMONSTER(mtmp)) continue;
+                           monflee(mtmp, 0, FALSE, FALSE);
                        }
                        break;
+                   }
 
                case 30: /* Gushing forth in this room */
 
index 16533775b3fde95b753e8d5e6c03ffb7c7f062b2..45aa8443f3d98230aee9770a9b07cb277ea0cc7b 100644 (file)
@@ -221,15 +221,22 @@ boolean fleemsg;
            if (!fleetime)
                mtmp->mfleetim = 0;
            else if (!mtmp->mflee || mtmp->mfleetim) {
-               fleetime += mtmp->mfleetim;
+               fleetime += (int)mtmp->mfleetim;
                /* ensure monster flees long enough to visibly stop fighting */
                if (fleetime == 1) fleetime++;
-               mtmp->mfleetim = min(fleetime, 127);
+               mtmp->mfleetim = (unsigned)min(fleetime, 127);
+           }
+           if (!mtmp->mflee && fleemsg && canseemon(mtmp) &&
+                   mtmp->m_ap_type != M_AP_FURNITURE &&
+                   mtmp->m_ap_type != M_AP_OBJECT) {
+               /* unfortunately we can't distinguish between temporary
+                  sleep and temporary paralysis, so both conditions
+                  receive the same alternate message */
+               if (!mtmp->mcanmove || !mtmp->data->mmove)
+                   pline("%s seems to flinch.", Adjmonnam(mtmp, "immobile"));
+               else
+                   pline("%s turns to flee.", Monnam(mtmp));
            }
-           if (!mtmp->mflee && fleemsg && canseemon(mtmp) && !mtmp->mfrozen &&
-               mtmp->m_ap_type != M_AP_FURNITURE &&
-               mtmp->m_ap_type != M_AP_OBJECT)
-               pline("%s turns to flee!", (Monnam(mtmp)));
            mtmp->mflee = 1;
        }
 }
@@ -259,17 +266,13 @@ int *inrange, *nearby, *scared;
                seescaryx = u.ux;
                seescaryy = u.uy;
        }
-       *scared = (*nearby && (onscary(seescaryx, seescaryy, mtmp) ||
-                              (!mtmp->mpeaceful &&
-                                   in_your_sanctuary(mtmp, 0, 0))));
-
-       if(*scared) {
-               if (rn2(7))
-                   monflee(mtmp, rnd(10), TRUE, TRUE);
-               else
-                   monflee(mtmp, rnd(100), TRUE, TRUE);
-       }
-
+       if (*nearby &&
+               (onscary(seescaryx, seescaryy, mtmp) ||
+                   (!mtmp->mpeaceful && in_your_sanctuary(mtmp, 0, 0)))) {
+               *scared = 1;
+               monflee(mtmp, rnd(rn2(7) ? 10 : 100), TRUE, TRUE);
+       } else
+               *scared = 0;
 }
 
 /* perform a special one-time action for a monster; returns -1 if nothing
index 6d7b9edef209f1ede389b8c2aa83ab6497eaee0e..53029c8dc73d370d5d726e66018304ac351a4259 100644 (file)
@@ -1,5 +1,4 @@
 /* NetHack 3.5 pline.c $Date$  $Revision$ */
-/*     SCCS Id: @(#)pline.c    3.5     2009/01/29      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -386,7 +385,7 @@ register struct monst *mtmp;
                                  /* [arbitrary reason why it isn't moving] */
        else if (mtmp->mstrategy & STRAT_WAITMASK)
                                  Strcat(info, ", meditating");
-       else if (mtmp->mflee)     Strcat(info, ", scared");
+       if (mtmp->mflee)          Strcat(info, ", scared");
        if (mtmp->mtrapped)       Strcat(info, ", trapped");
        if (mtmp->mspeed)         Strcat(info,
                                        mtmp->mspeed == MFAST ? ", fast" :
index 9e336f5f678f44aed62ebae2b5766221cc5bdd7c..f2c65bb6113a83584c70a9c88e48d2bd1700eb99 100644 (file)
@@ -2622,12 +2622,8 @@ struct obj *otmp;        /* source of flash */
                }
                if (mtmp->mhp > 0) {
                    if (!context.mon_moving) setmangry(mtmp);
-                   if (tmp < 9 && !mtmp->isshk && rn2(4)) {
-                       if (rn2(4))
-                           monflee(mtmp, rnd(100), FALSE, TRUE);
-                       else
-                           monflee(mtmp, 0, FALSE, TRUE);
-                   }
+                   if (tmp < 9 && !mtmp->isshk && rn2(4))
+                       monflee(mtmp, rn2(4) ? rnd(100) : 0, FALSE, TRUE);
                    mtmp->mcansee = 0;
                    mtmp->mblinded = (tmp < 3) ? 0 : rnd(1 + 50/tmp);
                }