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