"SLEEP for
ENCHANTER
Copyright 1983 Infocom, Inc. All Rights Reserved.
"
<GLOBAL LAST-SLEEP 0>
How long you can be awake before you start feeling sleepy. See I-TIRED.
<CONSTANT MOVES-PER-DAY 86>
How long you sleep for when you go to sleep. See V-SLEEP.
<CONSTANT MOVES-PER-SLEEP 42>
<ROUTINE V-TIME ("AUX" EL)
<TELL "It would be " <GET ,TIME-TABLE .EL> " now." CR>>
A table of time descriptions. These follow the TOD scale, where dawn is 0 and the following dawn in 128. Each line is 10 TOD units, about two hours.
The TIME command reports these strings. They do not take account of the advancing DUSK and NIGHTFALL as Krill’s power increases.
<GLOBAL TIME-TABLE <TABLE
"just past dawn"
"early morning"
"mid-morning"
"around noon"
"early afternoon"
"mid-afternoon"
"early evening"
"mid evening"
"late evening"
"midnight"
"in the early hours"
"pre-dawn"
"dawn">>
<OBJECT GLOBAL-SLEEP
(DESC "sleep")
(SYNONYM SLEEP)
<ROUTINE GLOBAL-SLEEP-F ()
<COND (<VERB? WALK-TO TAKE>
<RTRUE>)
(<VERB? FIND> <TELL "Why not find a bed to sleep in?" CR>)>>
<GLOBAL THIRST-COUNT 0>
<ROUTINE I-THIRST ()
"You pass out from lack of water and die." <>>)
(T
<GLOBAL THIRST-TABLE <LTABLE
"Your mouth is getting rather dry."
"You are becoming quite thirsty."
"You are very thirsty now. You'd better have a drink soon."
"Your lips are parched. If you don't get a drink soon you will pass out."
"You are beginning to feel faint from lack of water."
"BUG">>
<GLOBAL HUNGER-COUNT 0>
<ROUTINE I-HUNGER ()
"You pass out from lack of strength and die." <>>)
(T
<GLOBAL HUNGER-TABLE <LTABLE
"Your stomach is starting to grumble."
"You are becoming quite hungry."
"You are very hungry now. You'd better have something to eat."
"You're fairly starving. If you don't eat soon you will pass out."
"You are beginning to feel faint from lack of sustenance."
"BUG">>
<ROUTINE I-TIRED ("AUX" (FORG <>))
<TELL
"The bed sure is comfortable and you are becoming tired." CR>
<RFATAL>)>
<SET FORG T>
<ENABLE <QUEUE I-TIRED 10>>
<TELL
"You drop in your tracks from exhaustion." CR>
<CRLF>
<RFATAL>)
(ELSE
<COND (.FORG
<TELL
" and the spells you've memorized are becoming confused">)>
<TELL "." CR>)>>
How tired you are. -1 means fully awake. After MOVES-PER-DAY turns, the I-TIRED timer increases AWAKE periodically. When it reaches 10, you collapse.
<GLOBAL AWAKE -1>
<ROUTINE V-DIAGNOSE ()
<TELL "You are wide awake">)
<TELL ". You are ">
<TELL " and ">
<TELL "." CR>>
<GLOBAL HUNGER-TELL <TABLE
"well fed"
"a bit hungry"
"becoming quite hungry"
"very hungry"
"fairly starving"
"faint from lack of food"
"huoo">>
<GLOBAL THIRST-TELL <TABLE
"well hydrated"
"a bit thirsty"
"quite thirsty"
"very thirsty"
"extremely thirsty"
"faint from lack of water">>
<GLOBAL TIRED-TELL <TABLE
"beginning to tire"
"feeling tired"
"worn out"
"feeling wrung out and tired"
"getting more and more tired"
"dead on your feet"
"so tired you can barely put one foot in front of another"
"practically asleep"
"moving only on your last reserves of strength"
"barely able to move your arms"
"unable to keep your eyes open for more than a few moments
at a time">>
<GLOBAL BED-WARNING <>>
This handles the effects of sleeping. (Both the SLEEP verb and collapsing from exhaustion.) The optional TOLD? argument just indicates whether the game has already told you “the bed is very comfortable”.
Sleeping advances time by MOVES-PER-SLEEP turns, and has many beneficial effects. REAL-SPELL-MAX increases by one; the weariness penalties to LOAD-ALLOWED, FUMBLE-NUMBER, and FUMBLE-PROB are reset. Also, DREAMS are important. On the down side, you forget all your spells, and there’s a chance that monsters will rob or kill you.
There is, however, a serious bug in the SLEEP logic.
<ROUTINE V-SLEEP ("OPTIONAL" (TOLD? <>) "AUX" TILL-TIRED MUNGED?)
<TELL "To sleep here would be fatal!" CR>)
(<G? .TILL-TIRED 10>
<TELL
"You settle down to sleep, but you really aren't tired, so you
thrash around for a while and then give up." CR>)
<TELL "You try to sleep but it's too noisy." CR>)
<TELL
"You might try getting into the bed first. It would be more comfortable." CR>)
(ELSE
<COND (<AND <G? .TILL-TIRED 0>
<NOT .TOLD?>>
<TELL
"You're not all that tired, but the bed is very comfortable." CR>)>
The time-of-day (TOD) is increased by MOVES-PER-SLEEP turns. The MOD ensures that values beyond 128 wrap around to zero, as they should.
But there is a serious gap in this logic! If TOD wraps around here, the game does not apply the normal end-of-day logic from I-TIME. This means that Krill’s power does not increase. NIGHTFALL does not shift, LOSSAGE does not advance, and so on.
This means that if you are careful to only sleep at “midnight” or later, you can block Krill’s dominion and play for as many days as you like. Until you run out of bread, at least.
(Rooms are still ruined by I-MUNG-ROOM, though. That’s handled as a special case in V-SLEEP.)
<SETG TOD <MOD <+ ,TOD ,MOVES-PER-SLEEP> 128>>
<COND (<AND <NOT .MUNGED?>
<TELL
"You fall asleep quickly and begin to dream. The dream turns into a
nightmare of decay and desolation, as your surroundings turn grey and
lifeless. You feel a great weight, like a pile of ashes, constricting
your movements, and then you bolt awake!" CR>
<RTRUE>)
<TELL
"You fall asleep quickly, the bed being so comfortable. You dream as
well, of this very room. A beautiful damsel, obviously noble, is
standing by the bed holding a scroll in one hand and resting the other
on the bedpost. Turning to block your view, she does something you can't
see. Then she gets in bed and turns out the light, but before she does
you can see she is no longer carrying the scroll... You wake." CR>
<RTRUE>)>
<TELL
"Ah, sleep! It's been a long day, indeed. The rest will do you good.
">
<TELL "You make yourself comfortable on the bed">)
<TELL "You spread your cloak under the open sky">)
(T <TELL "You spread your cloak on the floor">)>
<TELL " and drift off, renewing your powers
and refreshing your mind ... Time passes as you snore blissfully." CR>
<CRLF>
"You sleep blissfully, unaware of the evil creatures lurking in the
darkness. Unaware, that is, until one of them sets upon you with nasty
sharp teeth.">
<RFATAL>)
(ELSE
<TELL
"You don't sleep too well, and you awake at least once with the feeling
that something has jostled you in the dark." CR>)>)
<TELL
"After a while, your sleep is disturbed by a strange dream. You are
wandering in a darkened place, for you have no light or other
possessions. You feel that you are being watched! You are surrounded by
faces, their eyes following you. They drift in and out, staring at you
with proud indifference. One face, brightly lit (unlike the rest), draws
you closer and closer. As you touch it, you wake." CR>)
<TELL
"Your sleep is disturbed by the strange dream of an earlier night. You are
in the dark, with no light or other possessions. You are surrounded by
many faces, their eyes following you. The one brightly lit face beckons
you closer and closer. You wake, convinced that the dream holds a message
for you." CR>)
<TELL
"You dream of a nondescript room in which a cartoonish figure casually opens
a simple wooden door and ascends the flight of stairs which lies behind. The
scene fades to black, but you awaken in a cold sweat." CR>)
<TELL
"You dream of climbing in an unfamiliar place. You seem to climb forever,
beyond reason. A fleeting hope arises in you, and you search furiously in
your spell book and possessions for something. After a moment, you become
frantic as you realize that you don't have it! You bolt awake in a cold
sweat." CR>)
<PROB 50>>
<TELL
"You sleep fitfully. At one point it seems that some evil presence is searching
nearby. The tense feeling passes, but it's replaced by one of foreboding." CR>)
(<PROB 50>
<TELL
"You sleep uneventfully, dreamlessly, and awake refreshed." CR>)
(ELSE
<TELL " You awaken." CR>)>)>>
<GLOBAL DOOR-DREAM-2 <>>
<GLOBAL DOOR-DREAM <>>
<GLOBAL GALLERY-DREAM <>>
The chance of lurking creatures robbing you in your sleep. If this happens, there is also a chance (based on MUNCHED) that they will eat you.
This increases every day.
<GLOBAL MOLESTED 20>
The chance of lurking creatures devouring you in your sleep, once they run across you. (See MOLESTED. If they don’t eat you, they will just steal your stuff.)
This increases every day.
<GLOBAL MUNCHED 45>
A list of prosaic dreams. Significant dreams are handled in V-SLEEP.
<GLOBAL DREAMS <LTABLE 0
"You dream of being pursued through a dank cavern. Something is behind
you, something horrible that you can't turn to face. It gets closer and
closer, and you can feel its hot breath on your neck."
"You dream of an idyllic scene in the country, a picnic of wood-sprites
and dryads."
"You dream of Krill. He works feverishly in an evilly lit workroom. He
is working a conjuration of great complexity and power, and the room is
strewn with the noisome components of this horrific casting. Krill chants
words of awful power as he works."
"You dream of dancing penguins in formal dress. One has a particularly
nice tuxedo and a cane with a gold top."
This may be an underhanded reference to Infidel, Infocom’s next-coming game.
"You dream of a river, slow and muddy. Great grey hippopotami sport there,
bellowing and splashing, and twitching their ears.">>