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