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