]>
git.cameronkatri.com Git - bsdgames-darwin.git/blob - battlestar/command5.c
1 /* $NetBSD: command5.c,v 1.5 2014/03/22 23:31:28 dholland Exp $ */
4 * Copyright (c) 1983, 1993
5 * The Regents of the University of California. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. Neither the name of the University nor the names of its contributors
16 * may be used to endorse or promote products derived from this software
17 * without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 #include <sys/cdefs.h>
35 static char sccsid
[] = "@(#)com5.c 8.2 (Berkeley) 4/28/95";
37 __RCSID("$NetBSD: command5.c,v 1.5 2014/03/22 23:31:28 dholland Exp $");
46 while (wordtype
[++wordnumber
] != NOUNS
&& wordnumber
<= wordcount
)
48 /* The goddess must be "taken" first if bathing. */
49 if (wordtype
[wordnumber
] == NOUNS
&& wordvalue
[wordnumber
] == NORMGOD
50 && testbit(location
[position
].objects
, BATHGOD
)) {
51 wordvalue
[--wordnumber
] = TAKE
;
55 if (wordtype
[wordnumber
] == NOUNS
) {
56 if (testbit(location
[position
].objects
,
57 wordvalue
[wordnumber
])) {
60 switch (wordvalue
[wordnumber
]) {
64 printf("She squirms and avoids your ");
68 puts("She is coming around; she ");
69 puts("didn't fight it as much.");
72 puts("She's beginning to like it.");
75 puts("She's gone limp.");
80 printf("Her lips are warm and her body ");
81 printf("robust. She pulls you down to ");
85 puts("The old man blushes.");
88 puts("The dwarf punches you in the kneecap.");
94 puts("I see nothing like that here.");
96 puts("I'd prefer not to.");
104 while (wordtype
[++wordnumber
] != NOUNS
&& wordnumber
<= wordcount
)
106 if (wordtype
[wordnumber
] == NOUNS
) {
107 if ((testbit(location
[position
].objects
, BATHGOD
) ||
108 testbit(location
[position
].objects
, NORMGOD
)) &&
109 wordvalue
[wordnumber
] == NORMGOD
) {
115 printf("She cuddles up to you, and her mouth ");
116 printf("starts to work:\n'That was my ");
117 printf("sister's amulet. The lovely ");
118 printf("goddess, Purl, was she. The Empire\n");
119 printf("captured her just after the Darkness ");
120 printf("came. My other sister, Vert, was ");
121 printf("killed\nby the Dark Lord himself. ");
122 printf("He took her amulet and warped its ");
123 printf("power.\nYour quest was foretold by ");
124 printf("my father before he died, but to get ");
125 printf("the Dark Lord's\namulet you must use ");
126 printf("cunning and skill. I will leave you ");
128 printf("which you may use as you wish. As ");
129 printf("for me, I am the last goddess of ");
130 printf("the\nwaters. My father was the ");
131 printf("Island King, and the rule is ");
132 printf("rightfully mine.'\n\nShe pulls the ");
133 puts("throne out into a large bed.");
137 if (card(injuries
, NUMOFINJURIES
)) {
138 printf("Her kisses revive you; your ");
139 printf("wounds are healed.\n");
140 for (n
= 0; n
< NUMOFINJURIES
; n
++)
145 printf("Goddess:\n");
147 setbit(location
[position
].objects
,
159 if (testbit(location
[position
].objects
,
160 wordvalue
[wordnumber
])) {
161 if (wordvalue
[wordnumber
] == NATIVE
) {
162 printf("The girl is easy prey. She peels ");
163 puts("off her sarong and indulges you.");
171 if (wordvalue
[wordnumber
] == MAN
||
172 wordvalue
[wordnumber
] == BODY
||
173 wordvalue
[wordnumber
] == ELF
||
174 wordvalue
[wordnumber
] == TIMER
)
177 puts("It doesn't seem to work.");
179 puts("Where's your lover?");
181 puts("It doesn't seem to work.");
191 zzztime
= (3 * CYCLE
) / 4;
194 if ((snooze
- ourtime
) < zzztime
) {
195 ourtime
+= zzztime
- (snooze
- ourtime
);
197 for (n
= 0; n
< ourtime
- oldtime
; n
++)
200 snooze
+= 3 * (ourtime
- oldtime
);
201 if (notes
[LAUNCHED
]) {
202 fuel
-= (ourtime
- oldtime
);
203 if (location
[position
].down
) {
204 position
= location
[position
].down
;
209 if (OUTSIDE
&& rnd(100) < 50) {
210 printf("You are awakened abruptly by the sound ");
211 puts("of someone nearby.");
215 n
= rnd(NUMOFOBJECTS
);
216 while (!testbit(inven
, n
))
217 n
= rnd(NUMOFOBJECTS
);
219 if (n
!= AMULET
&& n
!= MEDALION
&&
222 location
[position
].objects
,
224 carrying
-= objwt
[n
];
225 encumber
-= objcumber
[n
];
227 printf("A fiendish little Elf is stealing ");
228 puts("your treasures!");
232 setbit(location
[position
].objects
, DEADWOOD
);
235 setbit(location
[position
].objects
, HALBERD
);
249 if ((ourtime
/ CYCLE
+ 1) % 2 && OUTSIDE
)
250 switch ((ourtime
% CYCLE
) / (CYCLE
/ 7)) {
252 puts("It is just after sunrise.");
255 puts("It is early morning.");
258 puts("It is late morning.");
261 puts("It is near noon.");
264 puts("It is early afternoon.");
267 puts("It is late afternoon.");
270 puts("It is near sunset.");
274 switch ((ourtime
% CYCLE
) / (CYCLE
/ 7)) {
276 puts("It is just after sunset.");
279 puts("It is early evening.");
282 puts("The evening is getting old.");
285 puts("It is near midnight.");
288 puts("These are the wee hours of the morning.");
291 puts("The night is waning.");
294 puts("It is almost morning.");
298 puts("I can't tell the time in here.");
304 int obj
= -1, result
= -1, person
= 0, firstnumber
, last1
, last2
;
307 firstnumber
= wordnumber
;
308 while (wordtype
[++wordnumber
] != OBJECT
&&
309 wordvalue
[wordnumber
] != AMULET
&&
310 wordvalue
[wordnumber
] != MEDALION
&&
311 wordvalue
[wordnumber
] != TALISMAN
&& wordnumber
<= wordcount
)
313 if (wordnumber
<= wordcount
) {
314 obj
= wordvalue
[wordnumber
];
315 if (obj
== EVERYTHING
)
316 wordtype
[wordnumber
] = -1;
319 wordnumber
= firstnumber
;
320 while ((wordtype
[++wordnumber
] != NOUNS
||
321 wordvalue
[wordnumber
] == obj
) && wordnumber
<= wordcount
);
322 if (wordtype
[wordnumber
] == NOUNS
) {
323 person
= wordvalue
[wordnumber
];
326 /* Setting wordnumber to last1 - 1 looks wrong if last1 is 0, e.g.,
327 * plain `give'. However, detecting this case is liable to detect
328 * `give foo' as well, which would give a confusing error. We
329 * need to make sure the -1 value can cause no problems if it arises.
330 * If in the below we get to the drop("Given") then drop will look
331 * at word 0 for an object to give, and fail, which is OK; then
332 * result will be -1 and we get to the end, where wordnumber gets
333 * set to something more sensible. If we get to "I don't think
334 * that is possible" then again wordnumber is set to something
335 * sensible. The wordnumber we leave with still isn't right if
336 * you include words the game doesn't know in your command, but
337 * that's no worse than what other commands than give do in
339 wordnumber
= last1
- 1;
340 if (person
&& testbit(location
[position
].objects
, person
)) {
341 if (person
== NORMGOD
&& godready
< 2 &&
342 !(obj
== RING
|| obj
== BRACELET
))
343 puts("The goddess won't look at you.");
345 result
= drop("Given");
347 puts("I don't think that is possible.");
348 wordnumber
= max(last1
, last2
) + 1;
351 if (result
!= -1 && (testbit(location
[position
].objects
, obj
) ||
352 obj
== AMULET
|| obj
== MEDALION
|| obj
== TALISMAN
)) {
353 clearbit(location
[position
].objects
, obj
);
358 puts("She accepts it shyly.");
362 if (obj
== RING
|| obj
== BRACELET
) {
363 printf("She takes the charm and puts it on.");
364 puts(" A little kiss on the cheek is");
365 puts("your reward.");
369 if (obj
== AMULET
|| obj
== MEDALION
||
375 printf("The powers of the earth are ");
376 printf("now legitimate. You have ");
377 puts("destroyed the Darkness");
378 printf("and restored the goddess to ");
379 printf("her throne. The entire ");
380 puts("island celebrates with");
381 printf("dancing and spring feasts. ");
382 printf("As a measure of her ");
383 puts("gratitude, the goddess weds you");
384 printf("in the late summer and ");
385 printf("crowns you Prince Liverwort, ");
386 puts("Lord of Fungus.");
387 printf("\nBut, as the year wears on ");
388 printf("and autumn comes along, you ");
389 puts("become restless and");
390 printf("yearn for adventure. The ");
391 printf("goddess, too, realizes that ");
392 puts("the marriage can't last.");
393 printf("She becomes bored and takes ");
394 printf("several more natives as ");
395 puts("husbands. One evening,");
396 printf("after having been out ");
397 printf("drinking with the girls, she ");
398 puts("kicks the throne particularly");
399 printf("hard and wakes you up. (If ");
400 printf("you want to win this game, ");
401 printf("you're going to have to\n");
403 clearbit(location
[position
].objects
,
411 printf("He fingers the coins for a moment ");
412 printf("and then looks up agape. `Kind you ");
414 printf("I mean to repay you as best I can.' ");
415 printf("Grabbing a pencil and cocktail ");
417 printf("+-----------------------------------");
418 printf("------------------------------------");
420 printf("| xxxxxxxx\\ |\n");
421 printf("| xxxxx\\ CLIFFS |\n");
422 printf("| FOREST xxx\\ |\n");
423 printf("| \\\\ x\\ OCEAN |\n");
424 printf("| || x\\ |\n");
425 printf("| || ROAD x\\ |\n");
426 printf("| || x\\ |\n");
427 printf("| SECRET || ......... |\n");
428 printf("| - + - || ........ |\n");
429 printf("| ENTRANCE || ... BEACH |\n");
430 printf("| || ... E |\n");
431 printf("| || ... | |\n");
432 printf("| // ... N <-- + --- S |\n");
433 printf("| PALM GROVE // ... | |\n");
434 printf("| // ... W |\n");
436 printf("---------------------------------");
437 printf("---------------------------------");
438 printf("-----------+\n");
439 printf("\n`This map shows a secret entrance ");
440 puts("to the catacombs.");
441 printf("You will know when you arrive ");
442 printf("because I left an old pair of shoes ");
448 wordnumber
= max(last1
, last2
) + 1;
449 return (firstnumber
);