From bbee88dca3aa17a8fd2e8306740b4d6e0199151b Mon Sep 17 00:00:00 2001 From: "nethack.rankin" Date: Fri, 23 Feb 2007 03:13:37 +0000 Subject: [PATCH] fix #H248 - 'speed monster' zap message not always necessary From a bug report: zapping wand of speed monster (or slow monster) at an immobile monster would give the usual ' 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 | 2 ++ src/worn.c | 14 +++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/doc/fixes34.4 b/doc/fixes34.4 index f45f920d9..6e42a24d3 100644 --- a/doc/fixes34.4 +++ b/doc/fixes34.4 @@ -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 diff --git a/src/worn.c b/src/worn.c index 33dcf8d2c..00eabda59 100644 --- a/src/worn.c +++ b/src/worn.c @@ -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); } }