]> granicus.if.org Git - nethack/commitdiff
fix #H248 - 'speed monster' zap message not always necessary
authornethack.rankin <nethack.rankin>
Fri, 23 Feb 2007 03:13:37 +0000 (03:13 +0000)
committernethack.rankin <nethack.rankin>
Fri, 23 Feb 2007 03:13:37 +0000 (03:13 +0000)
     From a bug report:  zapping wand
of speed monster (or slow monster) at an immobile monster would give the
usual '<mon> is moving faster" (or slower) message even though the monster
couldn't move at all.  This fixes that for monsters who can never move
and also for monsters who are temporarily paralyzed or asleep, although I
wonder whether speed change magic ought to also snap the latter out of it.

doc/fixes34.4
src/worn.c

index f45f920d965233e4befaad52754ff88cc1c2711e..6e42a24d3385ee9c4c3c06814fb624e314b034b1 100644 (file)
@@ -327,6 +327,8 @@ can't #force floor item while engulfed, levitating, or unskilled riding
 can't lock or unlock doors while engulfed
 if hero or monster standing on opened drawbridge survives its destruction,
        fall into water or lava instead of remaining on top
+don't give a speed change message when an immobile monster is seen to be hit
+       by a wand of speed or slow monster
 
 
 Platform- and/or Interface-Specific Fixes
index 33dcf8d2ca9eda8bfd5a93a5fd6053755b10344c..00eabda59c6a1b8e477eceb1d0bb304ac27ab0bc 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)worn.c     3.5     2005/11/27      */
+/*     SCCS Id: @(#)worn.c     3.5     2007/02/22      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -246,7 +246,10 @@ struct obj *obj;   /* item to make known if effect can be seen */
     else
        mon->mspeed = mon->permspeed;
 
-    if (give_msg && (mon->mspeed != oldspeed || petrify) && canseemon(mon)) {
+    /* no message if monster is immobile (temp or perm) or unseen */
+    if (give_msg && (mon->mspeed != oldspeed || petrify) &&
+           mon->data->mmove && !(mon->mfrozen || mon->msleeping) &&
+           canseemon(mon)) {
        /* fast to slow (skipping intermediate state) or vice versa */
        const char *howmuch = (mon->mspeed + oldspeed == MFAST + MSLOW) ?
                                "much " : "";
@@ -260,11 +263,8 @@ struct obj *obj;   /* item to make known if effect can be seen */
        else
            pline("%s seems to be moving %sslower.", Monnam(mon), howmuch);
 
-       /* might discover an object if we see the speed change happen, but
-          avoid making possibly forgotten book known when casting its spell */
-       if (obj != 0 && obj->dknown &&
-               objects[obj->otyp].oc_class != SPBOOK_CLASS)
-           makeknown(obj->otyp);
+       /* might discover an object if we see the speed change happen */
+       if (obj != 0) learnwand(obj);
     }
 }