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
|
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
|
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
|
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
|
Platform- and/or Interface-Specific Fixes
|
||||||
|
|||||||
+1
-2
@@ -1,5 +1,4 @@
|
|||||||
/* NetHack 3.5 prop.h $Date$ $Revision$ */
|
/* NetHack 3.5 prop.h $Date$ $Revision$ */
|
||||||
/* SCCS Id: @(#)prop.h 3.5 1999/07/07 */
|
|
||||||
/* Copyright (c) 1989 Mike Threepoint */
|
/* Copyright (c) 1989 Mike Threepoint */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
@@ -36,7 +35,7 @@
|
|||||||
#define HALLUC_RES 24
|
#define HALLUC_RES 24
|
||||||
#define FUMBLING 25
|
#define FUMBLING 25
|
||||||
#define WOUNDED_LEGS 26
|
#define WOUNDED_LEGS 26
|
||||||
#define SLEEPING 27
|
#define SLEEPY 27
|
||||||
#define HUNGER 28
|
#define HUNGER 28
|
||||||
/* Vision and senses */
|
/* Vision and senses */
|
||||||
#define SEE_INVIS 29
|
#define SEE_INVIS 29
|
||||||
|
|||||||
+3
-4
@@ -1,5 +1,4 @@
|
|||||||
/* NetHack 3.5 youprop.h $Date$ $Revision$ */
|
/* NetHack 3.5 youprop.h $Date$ $Revision$ */
|
||||||
/* SCCS Id: @(#)youprop.h 3.5 2007/03/16 */
|
|
||||||
/* Copyright (c) 1989 Mike Threepoint */
|
/* Copyright (c) 1989 Mike Threepoint */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
@@ -132,9 +131,9 @@
|
|||||||
#define EWounded_legs u.uprops[WOUNDED_LEGS].extrinsic
|
#define EWounded_legs u.uprops[WOUNDED_LEGS].extrinsic
|
||||||
#define Wounded_legs (HWounded_legs || EWounded_legs)
|
#define Wounded_legs (HWounded_legs || EWounded_legs)
|
||||||
|
|
||||||
#define HSleeping u.uprops[SLEEPING].intrinsic
|
#define HSleepy u.uprops[SLEEPY].intrinsic
|
||||||
#define ESleeping u.uprops[SLEEPING].extrinsic
|
#define ESleepy u.uprops[SLEEPY].extrinsic
|
||||||
#define Sleeping (HSleeping || ESleeping)
|
#define Sleepy (HSleepy || ESleepy)
|
||||||
|
|
||||||
#define HHunger u.uprops[HUNGER].intrinsic
|
#define HHunger u.uprops[HUNGER].intrinsic
|
||||||
#define EHunger u.uprops[HUNGER].extrinsic
|
#define EHunger u.uprops[HUNGER].extrinsic
|
||||||
|
|||||||
@@ -1544,11 +1544,11 @@ int final;
|
|||||||
if (magic || cause_known(FUMBLING))
|
if (magic || cause_known(FUMBLING))
|
||||||
enl_msg(You_, "fumble", "fumbled", "", from_what(FUMBLING));
|
enl_msg(You_, "fumble", "fumbled", "", from_what(FUMBLING));
|
||||||
}
|
}
|
||||||
if (Sleeping) {
|
if (Sleepy) {
|
||||||
if (magic || cause_known(SLEEPING)) {
|
if (magic || cause_known(SLEEPY)) {
|
||||||
Strcpy(buf, from_what(SLEEPING));
|
Strcpy(buf, from_what(SLEEPY));
|
||||||
#ifdef WIZARD
|
#ifdef WIZARD
|
||||||
if (wizard) Sprintf(eos(buf), " (%ld)", (HSleeping & TIMEOUT));
|
if (wizard) Sprintf(eos(buf), " (%ld)", (HSleepy & TIMEOUT));
|
||||||
#endif
|
#endif
|
||||||
enl_msg("You ", "fall", "fell", " asleep uncontrollably", buf);
|
enl_msg("You ", "fall", "fell", " asleep uncontrollably", buf);
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-6
@@ -1,5 +1,4 @@
|
|||||||
/* NetHack 3.5 dbridge.c $Date$ $Revision$ */
|
/* NetHack 3.5 dbridge.c $Date$ $Revision$ */
|
||||||
/* SCCS Id: @(#)dbridge.c 3.5 2007/02/19 */
|
|
||||||
/* Copyright (c) 1989 by Jean-Christophe Collet */
|
/* Copyright (c) 1989 by Jean-Christophe Collet */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
@@ -463,8 +462,8 @@ boolean chunks;
|
|||||||
return(TRUE);
|
return(TRUE);
|
||||||
|
|
||||||
if (is_flyer(etmp->edata) &&
|
if (is_flyer(etmp->edata) &&
|
||||||
(is_u(etmp)? !Sleeping :
|
(is_u(etmp)? !Unaware :
|
||||||
(etmp->emon->mcanmove && !etmp->emon->msleeping)))
|
(etmp->emon->mcanmove && !etmp->emon->msleeping)))
|
||||||
/* flying requires mobility */
|
/* flying requires mobility */
|
||||||
misses = 5; /* out of 8 */
|
misses = 5; /* out of 8 */
|
||||||
else if (is_floater(etmp->edata) ||
|
else if (is_floater(etmp->edata) ||
|
||||||
@@ -495,9 +494,9 @@ struct entity *etmp;
|
|||||||
{
|
{
|
||||||
int tmp = 4; /* out of 10 */
|
int tmp = 4; /* out of 10 */
|
||||||
|
|
||||||
if (is_u(etmp)? (Sleeping || Fumbling) :
|
if (is_u(etmp) ? (Unaware || Fumbling) :
|
||||||
(!etmp->emon->mcanmove || etmp->emon->msleeping ||
|
(!etmp->emon->mcanmove || etmp->emon->msleeping ||
|
||||||
!etmp->edata->mmove || etmp->emon->wormno))
|
!etmp->edata->mmove || etmp->emon->wormno))
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
|
|
||||||
if (is_u(etmp)? Confusion : etmp->emon->mconf)
|
if (is_u(etmp)? Confusion : etmp->emon->mconf)
|
||||||
|
|||||||
+5
-5
@@ -712,12 +712,12 @@ Amulet_on()
|
|||||||
break;
|
break;
|
||||||
case AMULET_OF_RESTFUL_SLEEP:
|
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
|
/* avoid clobbering FROMOUTSIDE bit, which might have
|
||||||
gotten set by previously eating one of these amulets */
|
gotten set by previously eating one of these amulets */
|
||||||
if (newnap < oldnap || oldnap == 0L)
|
if (newnap < oldnap || oldnap == 0L)
|
||||||
HSleeping = (HSleeping & ~TIMEOUT) | newnap;
|
HSleepy = (HSleepy & ~TIMEOUT) | newnap;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case AMULET_OF_YENDOR:
|
case AMULET_OF_YENDOR:
|
||||||
@@ -767,9 +767,9 @@ Amulet_off()
|
|||||||
break;
|
break;
|
||||||
case AMULET_OF_RESTFUL_SLEEP:
|
case AMULET_OF_RESTFUL_SLEEP:
|
||||||
setworn((struct obj *)0, W_AMUL);
|
setworn((struct obj *)0, W_AMUL);
|
||||||
/* HSleeping = 0L; -- avoid clobbering FROMOUTSIDE bit */
|
/* HSleepy = 0L; -- avoid clobbering FROMOUTSIDE bit */
|
||||||
if (!ESleeping && !(HSleeping & ~TIMEOUT))
|
if (!ESleepy && !(HSleepy & ~TIMEOUT))
|
||||||
HSleeping &= ~TIMEOUT; /* clear timeout bits */
|
HSleepy &= ~TIMEOUT; /* clear timeout bits */
|
||||||
return;
|
return;
|
||||||
case AMULET_OF_YENDOR:
|
case AMULET_OF_YENDOR:
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -1953,14 +1953,14 @@ struct obj *otmp;
|
|||||||
break;
|
break;
|
||||||
case AMULET_OF_RESTFUL_SLEEP: /* another bad idea! */
|
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);
|
accessory_has_effect(otmp);
|
||||||
HSleeping |= FROMOUTSIDE;
|
HSleepy |= FROMOUTSIDE;
|
||||||
/* might also be wearing one; use shorter of two timeouts */
|
/* might also be wearing one; use shorter of two timeouts */
|
||||||
if (newnap < oldnap || oldnap == 0L)
|
if (newnap < oldnap || oldnap == 0L)
|
||||||
HSleeping = (HSleeping & ~TIMEOUT) | newnap;
|
HSleepy = (HSleepy & ~TIMEOUT) | newnap;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RIN_SUSTAIN_ABILITY:
|
case RIN_SUSTAIN_ABILITY:
|
||||||
|
|||||||
+1
-1
@@ -548,7 +548,7 @@ RING("protection from shape changers", PROT_FROM_SHAPE_CHANGERS, "shiny",
|
|||||||
AMULET("amulet of ESP", "circular", TELEPAT, 175),
|
AMULET("amulet of ESP", "circular", TELEPAT, 175),
|
||||||
AMULET("amulet of life saving", "spherical", LIFESAVED, 75),
|
AMULET("amulet of life saving", "spherical", LIFESAVED, 75),
|
||||||
AMULET("amulet of strangulation", "oval", STRANGLED, 135),
|
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 versus poison", "pyramidal", POISON_RES, 165),
|
||||||
AMULET("amulet of change", "square", 0, 130),
|
AMULET("amulet of change", "square", 0, 130),
|
||||||
/* POLYMORPH */
|
/* POLYMORPH */
|
||||||
|
|||||||
+4
-5
@@ -1,5 +1,4 @@
|
|||||||
/* NetHack 3.5 timeout.c $Date$ $Revision$ */
|
/* NetHack 3.5 timeout.c $Date$ $Revision$ */
|
||||||
/* SCCS Id: @(#)timeout.c 3.5 2009/01/20 */
|
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
@@ -337,14 +336,14 @@ nh_timeout()
|
|||||||
(void) make_hallucinated(0L, TRUE, 0L);
|
(void) make_hallucinated(0L, TRUE, 0L);
|
||||||
stop_occupation();
|
stop_occupation();
|
||||||
break;
|
break;
|
||||||
case SLEEPING:
|
case SLEEPY:
|
||||||
if (unconscious() || Sleep_resistance)
|
if (unconscious() || Sleep_resistance)
|
||||||
HSleeping += rnd(100);
|
HSleepy += rnd(100);
|
||||||
else if (Sleeping) {
|
else if (Sleepy) {
|
||||||
You("fall asleep.");
|
You("fall asleep.");
|
||||||
sleeptime = rnd(20);
|
sleeptime = rnd(20);
|
||||||
fall_asleep(-sleeptime, TRUE);
|
fall_asleep(-sleeptime, TRUE);
|
||||||
HSleeping += sleeptime + rnd(100);
|
HSleepy += sleeptime + rnd(100);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case LEVITATION:
|
case LEVITATION:
|
||||||
|
|||||||
Reference in New Issue
Block a user