1 /* @(#)com5.c 8.2 (Berkeley) 4/28/95 */
2 /* $NetBSD: command5.c,v 1.5 2014/03/22 23:31:28 dholland Exp $ */
5 * Copyright (c) 1983, 1993
6 * The Regents of the University of California. All rights reserved.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. Neither the name of the University nor the names of its contributors
17 * may be used to endorse or promote products derived from this software
18 * without specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38 while (wordtype[++wordnumber] != NOUNS && wordnumber <= wordcount)
40 /* The goddess must be "taken" first if bathing. */
41 if (wordtype[wordnumber] == NOUNS && wordvalue[wordnumber] == NORMGOD
42 && testbit(location[position].objects, BATHGOD)) {
43 wordvalue[--wordnumber] = TAKE;
47 if (wordtype[wordnumber] == NOUNS) {
48 if (testbit(location[position].objects,
49 wordvalue[wordnumber])) {
52 switch (wordvalue[wordnumber]) {
56 printf("She squirms and avoids your ");
60 puts("She is coming around; she ");
61 puts("didn't fight it as much.");
64 puts("She's beginning to like it.");
67 puts("She's gone limp.");
72 printf("Her lips are warm and her body ");
73 printf("robust. She pulls you down to ");
77 puts("The old man blushes.");
80 puts("The dwarf punches you in the kneecap.");
86 puts("I see nothing like that here.");
88 puts("I'd prefer not to.");
96 while (wordtype[++wordnumber] != NOUNS && wordnumber <= wordcount)
98 if (wordtype[wordnumber] == NOUNS) {
99 if ((testbit(location[position].objects, BATHGOD) ||
100 testbit(location[position].objects, NORMGOD)) &&
101 wordvalue[wordnumber] == NORMGOD) {
107 printf("She cuddles up to you, and her mouth ");
108 printf("starts to work:\n'That was my ");
109 printf("sister's amulet. The lovely ");
110 printf("goddess, Purl, was she. The Empire\n");
111 printf("captured her just after the Darkness ");
112 printf("came. My other sister, Vert, was ");
113 printf("killed\nby the Dark Lord himself. ");
114 printf("He took her amulet and warped its ");
115 printf("power.\nYour quest was foretold by ");
116 printf("my father before he died, but to get ");
117 printf("the Dark Lord's\namulet you must use ");
118 printf("cunning and skill. I will leave you ");
120 printf("which you may use as you wish. As ");
121 printf("for me, I am the last goddess of ");
122 printf("the\nwaters. My father was the ");
123 printf("Island King, and the rule is ");
124 printf("rightfully mine.'\n\nShe pulls the ");
125 puts("throne out into a large bed.");
129 if (card(injuries, NUMOFINJURIES)) {
130 printf("Her kisses revive you; your ");
131 printf("wounds are healed.\n");
132 for (n = 0; n < NUMOFINJURIES; n++)
137 printf("Goddess:\n");
139 setbit(location[position].objects,
151 if (testbit(location[position].objects,
152 wordvalue[wordnumber])) {
153 if (wordvalue[wordnumber] == NATIVE) {
154 printf("The girl is easy prey. She peels ");
155 puts("off her sarong and indulges you.");
163 if (wordvalue[wordnumber] == MAN ||
164 wordvalue[wordnumber] == BODY ||
165 wordvalue[wordnumber] == ELF ||
166 wordvalue[wordnumber] == TIMER)
169 puts("It doesn't seem to work.");
171 puts("Where's your lover?");
173 puts("It doesn't seem to work.");
183 zzztime = (3 * CYCLE) / 4;
186 if ((snooze - ourtime) < zzztime) {
187 ourtime += zzztime - (snooze - ourtime);
189 for (n = 0; n < ourtime - oldtime; n++)
192 snooze += 3 * (ourtime - oldtime);
193 if (notes[LAUNCHED]) {
194 fuel -= (ourtime - oldtime);
195 if (location[position].down) {
196 position = location[position].down;
201 if (OUTSIDE && rnd(100) < 50) {
202 printf("You are awakened abruptly by the sound ");
203 puts("of someone nearby.");
207 n = rnd(NUMOFOBJECTS);
208 while (!testbit(inven, n))
209 n = rnd(NUMOFOBJECTS);
211 if (n != AMULET && n != MEDALION &&
214 location[position].objects,
216 carrying -= objwt[n];
217 encumber -= objcumber[n];
219 printf("A fiendish little Elf is stealing ");
220 puts("your treasures!");
224 setbit(location[position].objects, DEADWOOD);
227 setbit(location[position].objects, HALBERD);
241 if ((ourtime / CYCLE + 1) % 2 && OUTSIDE)
242 switch ((ourtime % CYCLE) / (CYCLE / 7)) {
244 puts("It is just after sunrise.");
247 puts("It is early morning.");
250 puts("It is late morning.");
253 puts("It is near noon.");
256 puts("It is early afternoon.");
259 puts("It is late afternoon.");
262 puts("It is near sunset.");
266 switch ((ourtime % CYCLE) / (CYCLE / 7)) {
268 puts("It is just after sunset.");
271 puts("It is early evening.");
274 puts("The evening is getting old.");
277 puts("It is near midnight.");
280 puts("These are the wee hours of the morning.");
283 puts("The night is waning.");
286 puts("It is almost morning.");
290 puts("I can't tell the time in here.");
296 int obj = -1, result = -1, person = 0, firstnumber, last1, last2;
299 firstnumber = wordnumber;
300 while (wordtype[++wordnumber] != OBJECT &&
301 wordvalue[wordnumber] != AMULET &&
302 wordvalue[wordnumber] != MEDALION &&
303 wordvalue[wordnumber] != TALISMAN && wordnumber <= wordcount)
305 if (wordnumber <= wordcount) {
306 obj = wordvalue[wordnumber];
307 if (obj == EVERYTHING)
308 wordtype[wordnumber] = -1;
311 wordnumber = firstnumber;
312 while ((wordtype[++wordnumber] != NOUNS ||
313 wordvalue[wordnumber] == obj) && wordnumber <= wordcount);
314 if (wordtype[wordnumber] == NOUNS) {
315 person = wordvalue[wordnumber];
318 /* Setting wordnumber to last1 - 1 looks wrong if last1 is 0, e.g.,
319 * plain `give'. However, detecting this case is liable to detect
320 * `give foo' as well, which would give a confusing error. We
321 * need to make sure the -1 value can cause no problems if it arises.
322 * If in the below we get to the drop("Given") then drop will look
323 * at word 0 for an object to give, and fail, which is OK; then
324 * result will be -1 and we get to the end, where wordnumber gets
325 * set to something more sensible. If we get to "I don't think
326 * that is possible" then again wordnumber is set to something
327 * sensible. The wordnumber we leave with still isn't right if
328 * you include words the game doesn't know in your command, but
329 * that's no worse than what other commands than give do in
331 wordnumber = last1 - 1;
332 if (person && testbit(location[position].objects, person)) {
333 if (person == NORMGOD && godready < 2 &&
334 !(obj == RING || obj == BRACELET))
335 puts("The goddess won't look at you.");
337 result = drop("Given");
339 puts("I don't think that is possible.");
340 wordnumber = max(last1, last2) + 1;
343 if (result != -1 && (testbit(location[position].objects, obj) ||
344 obj == AMULET || obj == MEDALION || obj == TALISMAN)) {
345 clearbit(location[position].objects, obj);
350 puts("She accepts it shyly.");
354 if (obj == RING || obj == BRACELET) {
355 printf("She takes the charm and puts it on.");
356 puts(" A little kiss on the cheek is");
357 puts("your reward.");
361 if (obj == AMULET || obj == MEDALION ||
367 printf("The powers of the earth are ");
368 printf("now legitimate. You have ");
369 puts("destroyed the Darkness");
370 printf("and restored the goddess to ");
371 printf("her throne. The entire ");
372 puts("island celebrates with");
373 printf("dancing and spring feasts. ");
374 printf("As a measure of her ");
375 puts("gratitude, the goddess weds you");
376 printf("in the late summer and ");
377 printf("crowns you Prince Liverwort, ");
378 puts("Lord of Fungus.");
379 printf("\nBut, as the year wears on ");
380 printf("and autumn comes along, you ");
381 puts("become restless and");
382 printf("yearn for adventure. The ");
383 printf("goddess, too, realizes that ");
384 puts("the marriage can't last.");
385 printf("She becomes bored and takes ");
386 printf("several more natives as ");
387 puts("husbands. One evening,");
388 printf("after having been out ");
389 printf("drinking with the girls, she ");
390 puts("kicks the throne particularly");
391 printf("hard and wakes you up. (If ");
392 printf("you want to win this game, ");
393 printf("you're going to have to\n");
395 clearbit(location[position].objects,
403 printf("He fingers the coins for a moment ");
404 printf("and then looks up agape. `Kind you ");
406 printf("I mean to repay you as best I can.' ");
407 printf("Grabbing a pencil and cocktail ");
409 printf("+-----------------------------------");
410 printf("------------------------------------");
412 printf("| xxxxxxxx\\ |\n");
413 printf("| xxxxx\\ CLIFFS |\n");
414 printf("| FOREST xxx\\ |\n");
415 printf("| \\\\ x\\ OCEAN |\n");
416 printf("| || x\\ |\n");
417 printf("| || ROAD x\\ |\n");
418 printf("| || x\\ |\n");
419 printf("| SECRET || ......... |\n");
420 printf("| - + - || ........ |\n");
421 printf("| ENTRANCE || ... BEACH |\n");
422 printf("| || ... E |\n");
423 printf("| || ... | |\n");
424 printf("| // ... N <-- + --- S |\n");
425 printf("| PALM GROVE // ... | |\n");
426 printf("| // ... W |\n");
428 printf("---------------------------------");
429 printf("---------------------------------");
430 printf("-----------+\n");
431 printf("\n`This map shows a secret entrance ");
432 puts("to the catacombs.");
433 printf("You will know when you arrive ");
434 printf("because I left an old pair of shoes ");
440 wordnumber = max(last1, last2) + 1;
441 return (firstnumber);