BSD 4_3_Reno development
[unix-history] / .ref-BSD-4_3_Tahoe / usr / src / games / battlestar / com5.c
CommitLineData
fdc7d56f 1/*
e95fc82a
KB
2 * Copyright (c) 1983 Regents of the University of California.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms are permitted
28c5bacc
KB
6 * provided that the above copyright notice and this paragraph are
7 * duplicated in all such forms and that any documentation,
8 * advertising materials, and other materials related to such
9 * distribution and use acknowledge that the software was developed
10 * by the University of California, Berkeley. The name of the
11 * University may not be used to endorse or promote products derived
12 * from this software without specific prior written permission.
13 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
fdc7d56f
EW
16 */
17
f0462800 18#ifndef lint
ca67e7b4 19static char sccsid[] = "@(#)com5.c 5.2 (Berkeley) 6/19/88";
e95fc82a 20#endif /* not lint */
f0462800
EW
21
22#include "externs.h"
23
24kiss()
25{
26 while (wordtype[++wordnumber] != NOUNS && wordnumber <= wordcount);
27 if (wordtype[wordnumber] == NOUNS && testbit(location[position].objects,wordvalue[wordnumber])){
28 pleasure++;
29 printf("Kissed.\n");
30 switch (wordvalue[wordnumber]){
31 case NORMGOD:
32 switch(godready++){
33 case 0:
34 puts("She squirms and avoids your advances.");
35 break;
36 case 1:
37 puts("She is coming around; she didn't fight it as much.");
38 break;
39 case 2:
40 puts("She's begining to like it.");
41 break;
42 default:
43 puts("She's gone limp.");
44
45 }
46 break;
47 case NATIVE:
48 puts("The lips are warm and her body robust. She pulls you down to the ground.");
49 break;
50 case TIMER:
51 puts("The old man blushes.");
52 break;
53 case MAN:
54 puts("The dwarf punches you in the kneecap.");
55 break;
56 default:
57 pleasure--;
58 }
59 }
60 else puts("I'd prefer not to.");
61}
62
63love()
64{
65 register int n;
66
67 while (wordtype[++wordnumber] != NOUNS && wordnumber <= wordcount);
68 if (wordtype[wordnumber] == NOUNS && testbit(location[position].objects,wordvalue[wordnumber])){
69 if (wordvalue[wordnumber] == NORMGOD && !loved)
70 if (godready >= 2){
71 puts("She cuddles up to you, and her mouth starts to work:\n'That was my sister's amulet. The lovely goddess, Purl, was she. The Empire\ncaptured her just after the Darkness came. My other sister, Vert, was killed\nby the Dark Lord himself. He took her amulet and warped its power.\nYour quest was foretold by my father before he died, but to get the Dark Lord's\namulet you must use cunning and skill. I will leave you my amulet.");
72 puts("which you may use as you wish. As for me, I am the last goddess of the\nwaters. My father was the Island King, and the rule is rightfully mine.'\n\nShe pulls the throne out into a large bed.");
73 power++;
74 pleasure += 15;
75 ego++;
76 if (card(injuries, NUMOFINJURIES)){
77 puts("Her kisses revive you; your wounds are healed.\n");
78 for (n=0; n < NUMOFINJURIES; n++)
79 injuries[n] = 0;
80 WEIGHT = MAXWEIGHT;
81 CUMBER = MAXCUMBER;
82 }
83 printf("Goddess:\n");
84 if (!loved)
85 setbit(location[position].objects,MEDALION);
86 loved = 1;
87 time += 10;
88 zzz();
89 }
90 else {
91 puts("You wish!");
92 return;
93 }
94 if (wordvalue[wordnumber] == NATIVE){
95 puts("The girl is easy prey. She peals off her sarong and indulges you.");
96 power++;
97 pleasure += 5;
98 printf("Girl:\n");
99 time += 10;
100 zzz();
101 }
102 printf("Loved.\n");
103 }
104 else puts("I't doesn't seem to work.");
105}
106
107zzz()
108{
109 int oldtime;
110 register int n;
111
112 oldtime = time;
113 if ((snooze - time) < (0.75 * CYCLE)){
114 time += 0.75 * CYCLE - (snooze - time);
115 printf("<zzz>");
116 for (n = 0; n < time - oldtime; n++)
117 printf(".");
118 printf("\n");
119 snooze += 3 * (time - oldtime);
120 if (notes[LAUNCHED]){
121 fuel -= (time - oldtime);
122 if (location[position].down){
123 position = location[position].down;
124 crash();
125 }
126 else
127 notes[LAUNCHED] = 0;
128 }
a7c71d1e 129 if (OUTSIDE && rnd(100) < 50){
f0462800 130 puts("You are awakened abruptly by the sound of someone nearby.");
a7c71d1e 131 switch(rnd(4)){
f0462800
EW
132 case 0:
133 if (ucard(inven)){
134 n = rnd(NUMOFOBJECTS);
135 while(!testbit(inven,n))
136 n = rnd(NUMOFOBJECTS);
137 clearbit(inven,n);
138 if (n != AMULET && n != MEDALION && n != TALISMAN)
139 setbit(location[position].objects,n);
140 carrying -= objwt[n];
141 encumber -= objcumber[n];
142 }
143 puts("A fiendish little Elf is stealing your treasures!");
144 fight(ELF,10);
145 break;
146 case 1:
147 setbit(location[position].objects,DEADWOOD);
148 break;
149 case 2:
150 setbit(location[position].objects,HALBERD);
151 break;
a7c71d1e
EW
152 default:
153 break;
f0462800
EW
154 }
155 }
156 }
157 else
158 return(0);
159 return(1);
160}
161
162chime()
163{
164 if ((time / CYCLE + 1) % 2 && OUTSIDE)
165 switch((time % CYCLE)/(CYCLE / 7)){
166 case 0:
167 puts("It is just after sunrise.");
168 break;
169 case 1:
170 puts("It is early morning.");
171 break;
172 case 2:
173 puts("It is late morning.");
174 break;
175 case 3:
176 puts("It is near noon.");
177 break;
178 case 4:
179 puts("It is early afternoon.");
180 break;
181 case 5:
182 puts("It is late afternoon.");
183 break;
184 case 6:
185 puts("It is near sunset.");
186 break;
187 }
188 else if (OUTSIDE)
189 switch((time % CYCLE)/(CYCLE / 7)){
190 case 0:
191 puts("It is just after sunset.");
192 break;
193 case 1:
194 puts("It is early evening.");
195 break;
196 case 2:
197 puts("The evening is getting old.");
198 break;
199 case 3:
200 puts("It is near midnight.");
201 break;
202 case 4:
203 puts("These are the wee hours of the morning.");
204 break;
205 case 5:
206 puts("The night is waning.");
207 break;
208 case 6:
209 puts("It is almost morning.");
210 break;
211 }
212 else
213 puts("I can't tell the time in here.");
214}
215
216give()
217{
218 int obj = -1, result = -1, person = 0, firstnumber, last1, last2;
219
220 firstnumber = wordnumber;
221 while (wordtype[++wordnumber] != OBJECT && wordvalue[wordnumber] != AMULET && wordvalue[wordnumber] != MEDALION && wordvalue[wordnumber] != TALISMAN && wordnumber <= wordcount);
222 if (wordnumber <= wordcount){
223 obj = wordvalue[wordnumber];
224 if (obj == EVERYTHING)
225 wordtype[wordnumber] = -1;
226 last1 = wordnumber;
227 }
228 wordnumber = firstnumber;
229 while ((wordtype[++wordnumber] != NOUNS || wordvalue[wordnumber] == obj) && wordnumber <= wordcount);
230 if (wordtype[wordnumber] == NOUNS){
231 person = wordvalue[wordnumber];
232 last2 = wordnumber;
233 }
234 wordnumber = last1 - 1;
235 if (person && testbit(location[position].objects,person))
236 if (person == NORMGOD && godready < 2 && !(obj == RING || obj == BRACELET))
237 puts("The goddess won't look at you.");
238 else
239 result = drop("Given");
240 else {
241 puts("I don't think that is possible.");
242 return(0);
243 }
244 if (result != -1 && (testbit(location[position].objects,obj) || obj == AMULET || obj == MEDALION || obj == TALISMAN)){
245 clearbit(location[position].objects,obj);
246 time++;
247 ego++;
248 switch(person){
249 case NATIVE:
250 puts("She accepts it shyly.");
251 ego += 2;
252 break;
253 case NORMGOD:
254 if (obj == RING || obj == BRACELET){
255 puts("She takes the charm and puts it on. A little kiss on the cheek is");
256 puts("your reward.");
257 ego += 5;
258 godready += 3;
259 }
260 if (obj == AMULET || obj == MEDALION || obj == TALISMAN){
261 win++;
262 ego += 5;
263 power -= 5;
264 if (win >= 3){
265 puts("The powers of the earth are now legitimate. You have destroyed the Darkness");
266 puts("and restored the goddess to her thrown. The entire island celebrates with");
267 puts("dancing and spring feasts. As a measure of her gratitude, the goddess weds you");
268 puts("in the late summer and crowns you Prince Liverwort, Lord of Fungus.");
269 puts("\nBut, as the year wears on and autumn comes along, you become restless and");
270 puts("yearn for adventure. The goddess, too, realizes that the marriage can't last.");
271 puts("She becomes bored and takes several more natives as husbands. One evening,");
272 puts("after having been out drinking with the girls, she kicks the throne particulary");
273 puts("hard and wakes you up. (If you want to win this game, you're going to have to\nshoot her!)");
274 clearbit(location[position].objects,MEDALION);
275 wintime = time;
276 }
277 }
278 break;
279 case TIMER:
280 if (obj == COINS){
a7c71d1e
EW
281 puts("He fingers the coins for a moment and then looks up agape. `Kind you are and");
282 puts("I mean to repay you as best I can.' Grabbing a pencil and cocktail napkin...\n");
283 printf( "+-----------------------------------------------------------------------------+\n");
284 printf( "| xxxxxxxx\\ |\n");
285 printf( "| xxxxx\\ CLIFFS |\n");
286 printf( "| FOREST xxx\\ |\n");
f0462800
EW
287 printf( "| \\\\ x\\ OCEAN |\n");
288 printf( "| || x\\ |\n");
289 printf( "| || ROAD x\\ |\n");
290 printf( "| || x\\ |\n");
291 printf( "| SECRET || ......... |\n");
292 printf( "| - + - || ........ |\n");
293 printf( "| ENTRANCE || ... BEACH |\n");
294 printf( "| || ... E |\n");
295 printf( "| || ... | |\n");
a7c71d1e 296 printf( "| // ... N <-- + --- S |\n");
f0462800
EW
297 printf( "| PALM GROVE // ... | |\n");
298 printf( "| // ... W |\n");
a7c71d1e
EW
299 printf( "+-----------------------------------------------------------------------------+\n");
300 puts("\n`This map shows a secret entrance to the catacombs.");
f0462800
EW
301 puts("You will know when you arrive because I left an old pair of shoes there.'");
302 }
303 break;
304 }
305 }
306 wordnumber = max(last1,last2);
307 return(firstnumber);
308}