diff --git a/doc/fixes35.0 b/doc/fixes35.0 index 4716ff969..c8ffe572b 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -102,6 +102,7 @@ can't wish for a trapped box/chest/tin by specifying "poisoned" 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 diff --git a/include/extern.h b/include/extern.h index cbca118d0..ae343d82d 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1002,6 +1002,7 @@ E int FDECL(mattackm, (struct monst *,struct monst *)); #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)); diff --git a/src/apply.c b/src/apply.c index 907037765..ceef3750c 100644 --- a/src/apply.c +++ b/src/apply.c @@ -1,4 +1,4 @@ -/* 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. */ @@ -786,10 +786,7 @@ struct obj *obj; 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) diff --git a/src/mhitm.c b/src/mhitm.c index e70325a49..f28f011f8 100644 --- a/src/mhitm.c +++ b/src/mhitm.c @@ -987,9 +987,7 @@ mdamagem(magr, mdef, mattk) 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: @@ -1258,6 +1256,19 @@ mdamagem(magr, mdef, mattk) 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) @@ -1268,6 +1279,7 @@ int 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; @@ -1392,16 +1404,14 @@ int mdead; 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; diff --git a/src/mhitu.c b/src/mhitu.c index 41aa0c1c1..bd34b6161 100644 --- a/src/mhitu.c +++ b/src/mhitu.c @@ -1,4 +1,4 @@ -/* 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. */ @@ -2493,15 +2493,13 @@ register struct attack *mattk; "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; diff --git a/src/muse.c b/src/muse.c index 30bada89d..29677214a 100644 --- a/src/muse.c +++ b/src/muse.c @@ -1,4 +1,4 @@ -/* 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. */ @@ -88,8 +88,7 @@ struct obj *obj; pline("%s is frightened to death, and unable to move.", Monnam(mon)); } - mon->mcanmove = 0; - mon->mfrozen = 3; + paralyze_monst(mon, 3); } return 2; } diff --git a/src/potion.c b/src/potion.c index 7e4b3eae4..ee5fbfe8b 100644 --- a/src/potion.c +++ b/src/potion.c @@ -1,4 +1,4 @@ -/* 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. */ @@ -1219,11 +1219,10 @@ boolean your_fault; 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: diff --git a/src/trap.c b/src/trap.c index 213e39146..b3c530a23 100644 --- a/src/trap.c +++ b/src/trap.c @@ -1,4 +1,4 @@ -/* 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. */ @@ -1272,9 +1272,8 @@ struct obj *otmp; 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; @@ -1920,9 +1919,7 @@ register struct monst *mtmp; 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); diff --git a/src/uhitm.c b/src/uhitm.c index 7767f8114..db7262598 100644 --- a/src/uhitm.c +++ b/src/uhitm.c @@ -1629,8 +1629,7 @@ register struct attack *mattk; 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: