Sleeping vs Sleepy (trunk only)
While looking at fixing the mfrozen issue for monsters (there's no
way to tell whether it's been caused by sleep or paralysis, necessitating
that some messages be vague or suppressed when actions impact monsters
who can't move), I noticed a drawbridge bug for the hero. It was using
the misleadingly named Sleeping intrinsic incorrectly. When that is
nonzero, the hero is prone to falling asleep at random intervals, not
necessarily asleep right now. I've always intended to rename it to
something that's not misleading, but hadn't ever gotten around to doing
so, until now: change the SLEEPING property to SLEEPY and the Sleeping
intrinsic/attribute to Sleepy.
This may be moot for the drawbridge. I can't remember any hero ever
jumping to safety instead of being crushed by either the bridge or its
portcullis, and I'm sure sleepiness hasn't been a factor. So I haven't
included any fixes entry about misusing Sleeping when it meant u.usleep
(or better yet, unconscious(); or even better, Unaware [a post-3.4.3
pseudo-property that tests both unconscious() and fainted() when checking
whether hero is incapacitated]).
This commit is contained in:
@@ -376,6 +376,7 @@ for poly'd hero hiding on ceiling, attack by long worm might fill hero's
|
||||
when shop prices are adjusted, handle roundoff (integer truncation) better
|
||||
for hero poly'd into a monster form that lacks a weapon attack but has a claw
|
||||
attack, use wielded weapon even when claw attack isn't the very first
|
||||
rename the SLEEPING property and Sleeping attribute to SLEEPY and Sleepy, resp.
|
||||
|
||||
|
||||
Platform- and/or Interface-Specific Fixes
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
/* NetHack 3.5 prop.h $Date$ $Revision$ */
|
||||
/* SCCS Id: @(#)prop.h 3.5 1999/07/07 */
|
||||
/* Copyright (c) 1989 Mike Threepoint */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -36,7 +35,7 @@
|
||||
#define HALLUC_RES 24
|
||||
#define FUMBLING 25
|
||||
#define WOUNDED_LEGS 26
|
||||
#define SLEEPING 27
|
||||
#define SLEEPY 27
|
||||
#define HUNGER 28
|
||||
/* Vision and senses */
|
||||
#define SEE_INVIS 29
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
/* NetHack 3.5 youprop.h $Date$ $Revision$ */
|
||||
/* SCCS Id: @(#)youprop.h 3.5 2007/03/16 */
|
||||
/* Copyright (c) 1989 Mike Threepoint */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -132,9 +131,9 @@
|
||||
#define EWounded_legs u.uprops[WOUNDED_LEGS].extrinsic
|
||||
#define Wounded_legs (HWounded_legs || EWounded_legs)
|
||||
|
||||
#define HSleeping u.uprops[SLEEPING].intrinsic
|
||||
#define ESleeping u.uprops[SLEEPING].extrinsic
|
||||
#define Sleeping (HSleeping || ESleeping)
|
||||
#define HSleepy u.uprops[SLEEPY].intrinsic
|
||||
#define ESleepy u.uprops[SLEEPY].extrinsic
|
||||
#define Sleepy (HSleepy || ESleepy)
|
||||
|
||||
#define HHunger u.uprops[HUNGER].intrinsic
|
||||
#define EHunger u.uprops[HUNGER].extrinsic
|
||||
|
||||
@@ -1544,11 +1544,11 @@ int final;
|
||||
if (magic || cause_known(FUMBLING))
|
||||
enl_msg(You_, "fumble", "fumbled", "", from_what(FUMBLING));
|
||||
}
|
||||
if (Sleeping) {
|
||||
if (magic || cause_known(SLEEPING)) {
|
||||
Strcpy(buf, from_what(SLEEPING));
|
||||
if (Sleepy) {
|
||||
if (magic || cause_known(SLEEPY)) {
|
||||
Strcpy(buf, from_what(SLEEPY));
|
||||
#ifdef WIZARD
|
||||
if (wizard) Sprintf(eos(buf), " (%ld)", (HSleeping & TIMEOUT));
|
||||
if (wizard) Sprintf(eos(buf), " (%ld)", (HSleepy & TIMEOUT));
|
||||
#endif
|
||||
enl_msg("You ", "fall", "fell", " asleep uncontrollably", buf);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
/* NetHack 3.5 dbridge.c $Date$ $Revision$ */
|
||||
/* SCCS Id: @(#)dbridge.c 3.5 2007/02/19 */
|
||||
/* Copyright (c) 1989 by Jean-Christophe Collet */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -463,8 +462,8 @@ boolean chunks;
|
||||
return(TRUE);
|
||||
|
||||
if (is_flyer(etmp->edata) &&
|
||||
(is_u(etmp)? !Sleeping :
|
||||
(etmp->emon->mcanmove && !etmp->emon->msleeping)))
|
||||
(is_u(etmp)? !Unaware :
|
||||
(etmp->emon->mcanmove && !etmp->emon->msleeping)))
|
||||
/* flying requires mobility */
|
||||
misses = 5; /* out of 8 */
|
||||
else if (is_floater(etmp->edata) ||
|
||||
@@ -495,9 +494,9 @@ struct entity *etmp;
|
||||
{
|
||||
int tmp = 4; /* out of 10 */
|
||||
|
||||
if (is_u(etmp)? (Sleeping || Fumbling) :
|
||||
(!etmp->emon->mcanmove || etmp->emon->msleeping ||
|
||||
!etmp->edata->mmove || etmp->emon->wormno))
|
||||
if (is_u(etmp) ? (Unaware || Fumbling) :
|
||||
(!etmp->emon->mcanmove || etmp->emon->msleeping ||
|
||||
!etmp->edata->mmove || etmp->emon->wormno))
|
||||
return(FALSE);
|
||||
|
||||
if (is_u(etmp)? Confusion : etmp->emon->mconf)
|
||||
|
||||
@@ -712,12 +712,12 @@ Amulet_on()
|
||||
break;
|
||||
case AMULET_OF_RESTFUL_SLEEP:
|
||||
{
|
||||
long newnap = (long)rnd(100), oldnap = (HSleeping & TIMEOUT);
|
||||
long newnap = (long)rnd(100), oldnap = (HSleepy & TIMEOUT);
|
||||
|
||||
/* avoid clobbering FROMOUTSIDE bit, which might have
|
||||
gotten set by previously eating one of these amulets */
|
||||
if (newnap < oldnap || oldnap == 0L)
|
||||
HSleeping = (HSleeping & ~TIMEOUT) | newnap;
|
||||
HSleepy = (HSleepy & ~TIMEOUT) | newnap;
|
||||
}
|
||||
break;
|
||||
case AMULET_OF_YENDOR:
|
||||
@@ -767,9 +767,9 @@ Amulet_off()
|
||||
break;
|
||||
case AMULET_OF_RESTFUL_SLEEP:
|
||||
setworn((struct obj *)0, W_AMUL);
|
||||
/* HSleeping = 0L; -- avoid clobbering FROMOUTSIDE bit */
|
||||
if (!ESleeping && !(HSleeping & ~TIMEOUT))
|
||||
HSleeping &= ~TIMEOUT; /* clear timeout bits */
|
||||
/* HSleepy = 0L; -- avoid clobbering FROMOUTSIDE bit */
|
||||
if (!ESleepy && !(HSleepy & ~TIMEOUT))
|
||||
HSleepy &= ~TIMEOUT; /* clear timeout bits */
|
||||
return;
|
||||
case AMULET_OF_YENDOR:
|
||||
break;
|
||||
|
||||
@@ -1953,14 +1953,14 @@ struct obj *otmp;
|
||||
break;
|
||||
case AMULET_OF_RESTFUL_SLEEP: /* another bad idea! */
|
||||
{
|
||||
long newnap = (long)rnd(100), oldnap = (HSleeping & TIMEOUT);
|
||||
long newnap = (long)rnd(100), oldnap = (HSleepy & TIMEOUT);
|
||||
|
||||
if (!(HSleeping & FROMOUTSIDE))
|
||||
if (!(HSleepy & FROMOUTSIDE))
|
||||
accessory_has_effect(otmp);
|
||||
HSleeping |= FROMOUTSIDE;
|
||||
HSleepy |= FROMOUTSIDE;
|
||||
/* might also be wearing one; use shorter of two timeouts */
|
||||
if (newnap < oldnap || oldnap == 0L)
|
||||
HSleeping = (HSleeping & ~TIMEOUT) | newnap;
|
||||
HSleepy = (HSleepy & ~TIMEOUT) | newnap;
|
||||
}
|
||||
break;
|
||||
case RIN_SUSTAIN_ABILITY:
|
||||
|
||||
@@ -548,7 +548,7 @@ RING("protection from shape changers", PROT_FROM_SHAPE_CHANGERS, "shiny",
|
||||
AMULET("amulet of ESP", "circular", TELEPAT, 175),
|
||||
AMULET("amulet of life saving", "spherical", LIFESAVED, 75),
|
||||
AMULET("amulet of strangulation", "oval", STRANGLED, 135),
|
||||
AMULET("amulet of restful sleep", "triangular", SLEEPING, 135),
|
||||
AMULET("amulet of restful sleep", "triangular", SLEEPY, 135),
|
||||
AMULET("amulet versus poison", "pyramidal", POISON_RES, 165),
|
||||
AMULET("amulet of change", "square", 0, 130),
|
||||
/* POLYMORPH */
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
/* NetHack 3.5 timeout.c $Date$ $Revision$ */
|
||||
/* SCCS Id: @(#)timeout.c 3.5 2009/01/20 */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -337,14 +336,14 @@ nh_timeout()
|
||||
(void) make_hallucinated(0L, TRUE, 0L);
|
||||
stop_occupation();
|
||||
break;
|
||||
case SLEEPING:
|
||||
case SLEEPY:
|
||||
if (unconscious() || Sleep_resistance)
|
||||
HSleeping += rnd(100);
|
||||
else if (Sleeping) {
|
||||
HSleepy += rnd(100);
|
||||
else if (Sleepy) {
|
||||
You("fall asleep.");
|
||||
sleeptime = rnd(20);
|
||||
fall_asleep(-sleeptime, TRUE);
|
||||
HSleeping += sleeptime + rnd(100);
|
||||
HSleepy += sleeptime + rnd(100);
|
||||
}
|
||||
break;
|
||||
case LEVITATION:
|
||||
|
||||
Reference in New Issue
Block a user