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