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