E void FDECL(setworn, (struct obj *,long));
E void FDECL(setnotworn, (struct obj *));
E void FDECL(mon_set_minvis, (struct monst *));
-E void FDECL(mon_adjust_speed, (struct monst *,int));
+E void FDECL(mon_adjust_speed, (struct monst *,int,struct obj *));
E void FDECL(update_mon_intrinsics, (struct monst *,struct obj *,BOOLEAN_P));
E int FDECL(find_mac, (struct monst *));
E void FDECL(m_dowear, (struct monst *,BOOLEAN_P));
-/* SCCS Id: @(#)apply.c 3.4 2002/01/18 */
+/* SCCS Id: @(#)apply.c 3.4 2002/02/07 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
} else switch (rn2(3)) {
default:
break;
- case 1: in_mklev = TRUE; /* don't print messages */
- mon_adjust_speed(mtmp, 2);
- in_mklev = FALSE;
+ case 1:
+ mon_adjust_speed(mtmp, 2, (struct obj *)0);
break;
case 2: /* no explanation; it just happens... */
nomovemsg = "";
-/* SCCS Id: @(#)makemon.c 3.4 2001/11/07 */
+/* SCCS Id: @(#)makemon.c 3.4 2002/02/07 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
break;
case S_BAT:
if (Inhell && is_bat(ptr))
- mon_adjust_speed(mtmp, 2);
+ mon_adjust_speed(mtmp, 2, (struct obj *)0);
break;
}
if ((ct = emits_light(mtmp->data)) > 0)
-/* SCCS Id: @(#)mcastu.c 3.4 2002/01/10 */
+/* SCCS Id: @(#)mcastu.c 3.4 2002/02/07 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
dmg = 0;
break;
case MGC_HASTE_SELF:
- mon_adjust_speed(mtmp, 1);
+ mon_adjust_speed(mtmp, 1, (struct obj *)0);
dmg = 0;
break;
case MGC_CURE_SELF:
-/* SCCS Id: @(#)mhitm.c 3.4 2000/07/29 */
+/* SCCS Id: @(#)mhitm.c 3.4 2002/02/07 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
if (!magr->mcan && vis && mdef->mspeed != MSLOW) {
unsigned int oldspeed = mdef->mspeed;
- mon_adjust_speed(mdef, -1);
+ mon_adjust_speed(mdef, -1, (struct obj *)0);
if (mdef->mspeed != oldspeed && vis)
pline("%s slows down.", Monnam(mdef));
}
-/* SCCS Id: @(#)mon.c 3.4 2002/01/07 */
+/* SCCS Id: @(#)mon.c 3.4 2002/02/07 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
}
if (slow) {
if (mon->mspeed != MSLOW)
- mon_adjust_speed(mon, -1);
+ mon_adjust_speed(mon, -1, (struct obj *)0);
}
if (heal) {
if (mon->mhp < mon->mhpmax) {
-/* SCCS Id: @(#)muse.c 3.4 2002/01/07 */
+/* SCCS Id: @(#)muse.c 3.4 2002/02/07 */
/* Copyright (C) 1990 by Ken Arromdee */
/* NetHack may be freely redistributed. See license for details. */
case MUSE_WAN_SPEED_MONSTER:
mzapmsg(mtmp, otmp, TRUE);
otmp->spe--;
- mon_adjust_speed(mtmp, 1);
+ mon_adjust_speed(mtmp, 1, otmp);
return 2;
case MUSE_POT_SPEED:
mquaffmsg(mtmp, otmp);
different methods of maintaining speed ratings:
player's character becomes "very fast" temporarily;
monster becomes "one stage faster" permanently */
- if (oseen) makeknown(POT_SPEED);
- mon_adjust_speed(mtmp, 1);
+ mon_adjust_speed(mtmp, 1, otmp);
m_useup(mtmp, otmp);
return 2;
case MUSE_WAN_POLYMORPH:
-/* SCCS Id: @(#)potion.c 3.4 2002/01/15 */
+/* SCCS Id: @(#)potion.c 3.4 2002/02/07 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
break;
case POT_SPEED:
angermon = FALSE;
- mon_adjust_speed(mon, 1);
+ mon_adjust_speed(mon, 1, obj);
break;
case POT_BLINDNESS:
if(haseyes(mon->data)) {
-/* SCCS Id: @(#)worn.c 3.4 2002/01/07 */
+/* SCCS Id: @(#)worn.c 3.4 2002/02/07 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
}
void
-mon_adjust_speed(mon, adjust)
+mon_adjust_speed(mon, adjust, obj)
struct monst *mon;
int adjust; /* positive => increase speed, negative => decrease */
+struct obj *obj; /* item to make known if effect can be seen */
{
struct obj *otmp;
-
+ boolean give_msg = !in_mklev;
unsigned int oldspeed = mon->mspeed;
switch (adjust) {
case 2:
mon->permspeed = MFAST;
+ give_msg = FALSE; /* special case monster creation */
break;
case 1:
if (mon->permspeed == MSLOW) mon->permspeed = 0;
break;
case -2:
mon->permspeed = MSLOW;
+ give_msg = FALSE; /* (not currently used) */
break;
}
else
mon->mspeed = mon->permspeed;
- if (!in_mklev && mon->mspeed != oldspeed && canseemon(mon)) {
- if (adjust > 0)
- pline("%s is suddenly moving faster.", Monnam(mon));
+ if (give_msg && mon->mspeed != oldspeed && canseemon(mon)) {
+ /* fast to slow (skipping intermediate state) or vice versa */
+ const char *howmuch = (mon->mspeed + oldspeed == MFAST + MSLOW) ?
+ "much " : "";
+
+ if (adjust > 0 || mon->mspeed == MFAST)
+ pline("%s is suddenly moving %sfaster.", Monnam(mon), howmuch);
else
- pline("%s seems to be moving slower.", Monnam(mon));
+ 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);
}
}
mon->minvis = !mon->invis_blkd;
break;
case FAST:
- mon_adjust_speed(mon, 0);
+ mon_adjust_speed(mon, 0, obj);
break;
/* properties handled elsewhere */
case ANTIMAGIC:
mon->minvis = mon->perminvis;
break;
case FAST:
- mon_adjust_speed(mon, 0);
+ mon_adjust_speed(mon, 0, obj);
break;
case FIRE_RES:
case COLD_RES:
-/* SCCS Id: @(#)zap.c 3.4 2002/01/07 */
+/* SCCS Id: @(#)zap.c 3.4 2002/02/07 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
case WAN_SLOW_MONSTER:
case SPE_SLOW_MONSTER:
if (!resist(mtmp, otmp->oclass, 0, NOTELL)) {
- mon_adjust_speed(mtmp, -1);
+ mon_adjust_speed(mtmp, -1, otmp);
m_dowear(mtmp, FALSE); /* might want speed boots */
if (u.uswallow && (mtmp == u.ustuck) &&
is_whirly(mtmp->data)) {
break;
case WAN_SPEED_MONSTER:
if (!resist(mtmp, otmp->oclass, 0, NOTELL)) {
- mon_adjust_speed(mtmp, 1);
+ mon_adjust_speed(mtmp, 1, otmp);
m_dowear(mtmp, FALSE); /* might want speed boots */
}
break;
NO_MINVENT|MM_NOWAIT);
if (mtmp) {
mtmp->mhp = mtmp->mhpmax = 100;
- mon_adjust_speed(mtmp, 2); /* MFAST */
+ mon_adjust_speed(mtmp, 2, (struct obj *)0); /* MFAST */
}
} else {
if (obj->oxlth && (obj->oattached == OATTACHED_MONST)) {