grammar bit if killed by stealing a cockatrice corpse from a monster
being petrified by swallowing a cockatrice violates foodless conduct
devouring Medusa whole is fatal
+eating pet won't continue eating after becoming paralyzed or falling asleep
Platform- and/or Interface-Specific Fixes
#ifdef BARGETHROUGH
E int FDECL(mdisplacem, (struct monst *,struct monst *,BOOLEAN_P));
#endif
+E void FDECL(paralyze_monst, (struct monst *,int));
E int FDECL(sleep_monst, (struct monst *,int,int));
E void FDECL(slept_monst, (struct monst *));
E long FDECL(attk_protection, (int));
-/* SCCS Id: @(#)apply.c 3.5 2005/09/20 */
+/* SCCS Id: @(#)apply.c 3.5 2005/12/05 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
pline("%s is frozen by its reflection.", Monnam(mtmp));
else
You_hear("%s stop moving.", something);
- mtmp->mcanmove = 0;
- if ( (int) mtmp->mfrozen + tmp > 127)
- mtmp->mfrozen = 127;
- else mtmp->mfrozen += tmp;
+ paralyze_monst(mtmp, (int)mtmp->mfrozen + tmp);
} else if(!mtmp->mcan && !mtmp->minvis &&
mtmp->data == &mons[PM_UMBER_HULK]) {
if (vis)
Strcpy(buf, Monnam(mdef));
pline("%s is frozen by %s.", buf, mon_nam(magr));
}
- mdef->mcanmove = 0;
- mdef->mfrozen = rnd(10);
- mdef->mstrategy &= ~STRAT_WAITFORU;
+ paralyze_monst(mdef, rnd(10));
}
break;
case AD_SLOW:
return (res == MM_AGR_DIED) ? MM_AGR_DIED : MM_HIT;
}
+void
+paralyze_monst(mon, amt)
+struct monst *mon;
+int amt;
+{
+ if (amt > 127) amt = 127;
+
+ mon->mcanmove = 0;
+ mon->mfrozen = amt;
+ mon->meating = 0; /* terminate any meal-in-progress */
+ mon->mstrategy &= ~STRAT_WAITFORU;
+}
+
/* `mon' is hit by a sleep attack; return 1 if it's affected, 0 otherwise */
int
sleep_monst(mon, amt, how)
(how >= 0 && resist(mon, (char)how, 0, NOTELL))) {
shieldeff(mon->mx, mon->my);
} else if (mon->mcanmove) {
+ mon->meating = 0; /* terminate any meal-in-progress */
amt += (int) mon->mfrozen;
if (amt > 0) { /* sleep for N turns */
mon->mcanmove = 0;
if(canseemon(magr))
pline("%s is frozen by %s gaze!",
buf, s_suffix(mon_nam(mdef)));
- magr->mcanmove = 0;
- magr->mfrozen = tmp;
+ paralyze_monst(magr, tmp);
return (mdead|mhit);
}
} else { /* gelatinous cube */
Strcpy(buf, Monnam(magr));
if(canseemon(magr))
pline("%s is frozen by %s.", buf, mon_nam(mdef));
- magr->mcanmove = 0;
- magr->mfrozen = tmp;
+ paralyze_monst(magr, tmp);
return (mdead|mhit);
}
return 1;
-/* SCCS Id: @(#)mhitu.c 3.5 2005/09/27 */
+/* SCCS Id: @(#)mhitu.c 3.5 2005/12/05 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
"Your gaze is reflected by %s %s."))
return 1;
pline("%s is frozen by your gaze!", Monnam(mtmp));
- mtmp->mcanmove = 0;
- mtmp->mfrozen = tmp;
+ paralyze_monst(mtmp, tmp);
return 3;
}
}
} else { /* gelatinous cube */
pline("%s is frozen by you.", Monnam(mtmp));
- mtmp->mcanmove = 0;
- mtmp->mfrozen = tmp;
+ paralyze_monst(mtmp, tmp);
return 3;
}
return 1;
-/* SCCS Id: @(#)muse.c 3.5 2004/06/12 */
+/* SCCS Id: @(#)muse.c 3.5 2005/12/05 */
/* Copyright (C) 1990 by Ken Arromdee */
/* NetHack may be freely redistributed. See license for details. */
pline("%s is frightened to death, and unable to move.",
Monnam(mon));
}
- mon->mcanmove = 0;
- mon->mfrozen = 3;
+ paralyze_monst(mon, 3);
}
return 2;
}
-/* SCCS Id: @(#)potion.c 3.5 2005/06/21 */
+/* SCCS Id: @(#)potion.c 3.5 2005/12/05 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
break;
case POT_PARALYSIS:
if (mon->mcanmove) {
- mon->mcanmove = 0;
/* really should be rnd(5) for consistency with players
* breathing potions, but...
*/
- mon->mfrozen = rnd(25);
+ paralyze_monst(mon, rnd(25));
}
break;
case POT_SPEED:
-/* SCCS Id: @(#)trap.c 3.5 2005/11/01 */
+/* SCCS Id: @(#)trap.c 3.5 2005/12/05 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
case SLP_GAS_TRAP:
if (!resists_sleep(steed) && !breathless(steed->data) &&
!steed->msleeping && steed->mcanmove) {
- steed->mcanmove = 0;
- steed->mfrozen = rnd(25);
- if (in_sight)
+ if (sleep_monst(steed, rnd(25), -1))
+ /* no in_sight check here; you can feel it even if blind */
pline("%s suddenly falls asleep!", Monnam(steed));
}
steedhit = TRUE;
case SLP_GAS_TRAP:
if (!resists_sleep(mtmp) && !breathless(mptr) &&
!mtmp->msleeping && mtmp->mcanmove) {
- mtmp->mcanmove = 0;
- mtmp->mfrozen = rnd(25);
- if (in_sight) {
+ if (sleep_monst(mtmp, rnd(25), -1) && in_sight) {
pline("%s suddenly falls asleep!",
Monnam(mtmp));
seetrap(trap);
case AD_PLYS:
if (!negated && mdef->mcanmove && !rn2(3) && tmp < mdef->mhp) {
if (!Blind) pline("%s is frozen by you!", Monnam(mdef));
- mdef->mcanmove = 0;
- mdef->mfrozen = rnd(10);
+ paralyze_monst(mdef, rnd(10));
}
break;
case AD_SLEE: