]>
git.cameronkatri.com Git - bsdgames-darwin.git/blob - battlestar/command5.c
1 /* $NetBSD: command5.c,v 1.3 2005/07/01 06:04:54 jmc 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.3 2005/07/01 06:04:54 jmc 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 if ((snooze
- ourtime
) < (0.75 * CYCLE
)) {
192 ourtime
+= 0.75 * CYCLE
- (snooze
- ourtime
);
194 for (n
= 0; n
< ourtime
- oldtime
; n
++)
197 snooze
+= 3 * (ourtime
- oldtime
);
198 if (notes
[LAUNCHED
]) {
199 fuel
-= (ourtime
- oldtime
);
200 if (location
[position
].down
) {
201 position
= location
[position
].down
;
206 if (OUTSIDE
&& rnd(100) < 50) {
207 printf("You are awakened abruptly by the sound ");
208 puts("of someone nearby.");
212 n
= rnd(NUMOFOBJECTS
);
213 while (!testbit(inven
, n
))
214 n
= rnd(NUMOFOBJECTS
);
216 if (n
!= AMULET
&& n
!= MEDALION
&&
219 location
[position
].objects
,
221 carrying
-= objwt
[n
];
222 encumber
-= objcumber
[n
];
224 printf("A fiendish little Elf is stealing ");
225 puts("your treasures!");
229 setbit(location
[position
].objects
, DEADWOOD
);
232 setbit(location
[position
].objects
, HALBERD
);
246 if ((ourtime
/ CYCLE
+ 1) % 2 && OUTSIDE
)
247 switch ((ourtime
% CYCLE
) / (CYCLE
/ 7)) {
249 puts("It is just after sunrise.");
252 puts("It is early morning.");
255 puts("It is late morning.");
258 puts("It is near noon.");
261 puts("It is early afternoon.");
264 puts("It is late afternoon.");
267 puts("It is near sunset.");
271 switch ((ourtime
% CYCLE
) / (CYCLE
/ 7)) {
273 puts("It is just after sunset.");
276 puts("It is early evening.");
279 puts("The evening is getting old.");
282 puts("It is near midnight.");
285 puts("These are the wee hours of the morning.");
288 puts("The night is waning.");
291 puts("It is almost morning.");
295 puts("I can't tell the time in here.");
301 int obj
= -1, result
= -1, person
= 0, firstnumber
, last1
, last2
;
304 firstnumber
= wordnumber
;
305 while (wordtype
[++wordnumber
] != OBJECT
&&
306 wordvalue
[wordnumber
] != AMULET
&&
307 wordvalue
[wordnumber
] != MEDALION
&&
308 wordvalue
[wordnumber
] != TALISMAN
&& wordnumber
<= wordcount
)
310 if (wordnumber
<= wordcount
) {
311 obj
= wordvalue
[wordnumber
];
312 if (obj
== EVERYTHING
)
313 wordtype
[wordnumber
] = -1;
316 wordnumber
= firstnumber
;
317 while ((wordtype
[++wordnumber
] != NOUNS
||
318 wordvalue
[wordnumber
] == obj
) && wordnumber
<= wordcount
);
319 if (wordtype
[wordnumber
] == NOUNS
) {
320 person
= wordvalue
[wordnumber
];
323 /* Setting wordnumber to last1 - 1 looks wrong if last1 is 0, e.g.,
324 * plain `give'. However, detecting this case is liable to detect
325 * `give foo' as well, which would give a confusing error. We
326 * need to make sure the -1 value can cause no problems if it arises.
327 * If in the below we get to the drop("Given") then drop will look
328 * at word 0 for an object to give, and fail, which is OK; then
329 * result will be -1 and we get to the end, where wordnumber gets
330 * set to something more sensible. If we get to "I don't think
331 * that is possible" then again wordnumber is set to something
332 * sensible. The wordnumber we leave with still isn't right if
333 * you include words the game doesn't know in your command, but
334 * that's no worse than what other commands than give do in
336 wordnumber
= last1
- 1;
337 if (person
&& testbit(location
[position
].objects
, person
)) {
338 if (person
== NORMGOD
&& godready
< 2 &&
339 !(obj
== RING
|| obj
== BRACELET
))
340 puts("The goddess won't look at you.");
342 result
= drop("Given");
344 puts("I don't think that is possible.");
345 wordnumber
= max(last1
, last2
) + 1;
348 if (result
!= -1 && (testbit(location
[position
].objects
, obj
) ||
349 obj
== AMULET
|| obj
== MEDALION
|| obj
== TALISMAN
)) {
350 clearbit(location
[position
].objects
, obj
);
355 puts("She accepts it shyly.");
359 if (obj
== RING
|| obj
== BRACELET
) {
360 printf("She takes the charm and puts it on.");
361 puts(" A little kiss on the cheek is");
362 puts("your reward.");
366 if (obj
== AMULET
|| obj
== MEDALION
||
372 printf("The powers of the earth are ");
373 printf("now legitimate. You have ");
374 puts("destroyed the Darkness");
375 printf("and restored the goddess to ");
376 printf("her throne. The entire ");
377 puts("island celebrates with");
378 printf("dancing and spring feasts. ");
379 printf("As a measure of her ");
380 puts("gratitude, the goddess weds you");
381 printf("in the late summer and ");
382 printf("crowns you Prince Liverwort, ");
383 puts("Lord of Fungus.");
384 printf("\nBut, as the year wears on ");
385 printf("and autumn comes along, you ");
386 puts("become restless and");
387 printf("yearn for adventure. The ");
388 printf("goddess, too, realizes that ");
389 puts("the marriage can't last.");
390 printf("She becomes bored and takes ");
391 printf("several more natives as ");
392 puts("husbands. One evening,");
393 printf("after having been out ");
394 printf("drinking with the girls, she ");
395 puts("kicks the throne particularly");
396 printf("hard and wakes you up. (If ");
397 printf("you want to win this game, ");
398 printf("you're going to have to\n");
400 clearbit(location
[position
].objects
,
408 printf("He fingers the coins for a moment ");
409 printf("and then looks up agape. `Kind you ");
411 printf("I mean to repay you as best I can.' ");
412 printf("Grabbing a pencil and cocktail ");
414 printf("+-----------------------------------");
415 printf("------------------------------------");
417 printf("| xxxxxxxx\\ |\n");
418 printf("| xxxxx\\ CLIFFS |\n");
419 printf("| FOREST xxx\\ |\n");
420 printf("| \\\\ x\\ OCEAN |\n");
421 printf("| || x\\ |\n");
422 printf("| || ROAD x\\ |\n");
423 printf("| || x\\ |\n");
424 printf("| SECRET || ......... |\n");
425 printf("| - + - || ........ |\n");
426 printf("| ENTRANCE || ... BEACH |\n");
427 printf("| || ... E |\n");
428 printf("| || ... | |\n");
429 printf("| // ... N <-- + --- S |\n");
430 printf("| PALM GROVE // ... | |\n");
431 printf("| // ... W |\n");
433 printf("---------------------------------");
434 printf("---------------------------------");
435 printf("-----------+\n");
436 printf("\n`This map shows a secret entrance ");
437 puts("to the catacombs.");
438 printf("You will know when you arrive ");
439 printf("because I left an old pair of shoes ");
445 wordnumber
= max(last1
, last2
) + 1;
446 return (firstnumber
);