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