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 '<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.
This commit is contained in:
nethack.rankin
2007-02-23 03:13:37 +00:00
parent c0418d52d6
commit bbee88dca3
2 changed files with 9 additions and 7 deletions

View 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);
}
}