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