]> git.cameronkatri.com Git - bsdgames-darwin.git/blob - battlestar/com2.c
From OpenBSD: in kiss(), "take" the bathing goddess if required, and
[bsdgames-darwin.git] / battlestar / com2.c
1 /* $NetBSD: com2.c,v 1.10 2000/09/17 23:04:17 jsm 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 #include <sys/cdefs.h>
37 #ifndef lint
38 #if 0
39 static char sccsid[] = "@(#)com2.c 8.2 (Berkeley) 4/28/95";
40 #else
41 __RCSID("$NetBSD: com2.c,v 1.10 2000/09/17 23:04:17 jsm Exp $");
42 #endif
43 #endif /* not lint */
44
45 #include "extern.h"
46
47 int
48 wearit()
49 { /* synonyms = {sheathe, sheath} */
50 int n;
51 int firstnumber, value;
52
53 firstnumber = wordnumber;
54 while (wordtype[++wordnumber] == ADJS);
55 while (wordnumber <= wordcount) {
56 value = wordvalue[wordnumber];
57 for (n = 0; objsht[value][n]; n++);
58 switch (value) {
59
60 case -1:
61 puts("Wear what?");
62 return (firstnumber);
63
64 default:
65 printf("You can't wear%s%s!\n", (objsht[value][n - 1] == 's' ? " " : " a "), objsht[value]);
66 return (firstnumber);
67
68 case KNIFE:
69 /* case SHIRT: */
70 case ROBE:
71 case LEVIS: /* wearable things */
72 case SWORD:
73 case MAIL:
74 case HELM:
75 case SHOES:
76 case PAJAMAS:
77 case COMPASS:
78 case LASER:
79 case AMULET:
80 case TALISMAN:
81 case MEDALION:
82 case ROPE:
83 case RING:
84 case BRACELET:
85 case GRENADE:
86
87 if (testbit(inven, value)) {
88 clearbit(inven, value);
89 setbit(wear, value);
90 carrying -= objwt[value];
91 encumber -= objcumber[value];
92 ourtime++;
93 printf("You are now wearing %s %s.\n",
94 (objsht[value][n - 1] == 's' ? "the"
95 : "a"), objsht[value]);
96 } else
97 if (testbit(wear, value))
98 printf("You are already wearing the %s.\n",
99 objsht[value]);
100 else
101 printf("You aren't holding the %s.\n",
102 objsht[value]);
103 if (wordnumber < wordcount - 1 &&
104 wordvalue[++wordnumber] == AND)
105 wordnumber++;
106 else
107 return (firstnumber);
108 } /* end switch */
109 } /* end while */
110 puts("Don't be ridiculous.");
111 return (firstnumber);
112 }
113
114 int
115 put()
116 { /* synonyms = {buckle, strap, tie} */
117 if (wordvalue[wordnumber + 1] == ON) {
118 wordvalue[++wordnumber] = PUTON;
119 return (cypher());
120 }
121 if (wordvalue[wordnumber + 1] == DOWN) {
122 wordvalue[++wordnumber] = DROP;
123 return (cypher());
124 }
125 puts("I don't understand what you want to put.");
126 return (-1);
127
128 }
129
130 int
131 draw()
132 { /* synonyms = {pull, carry} */
133 return (take(wear));
134 }
135
136 int
137 use()
138 {
139 while (wordtype[++wordnumber] == ADJS && wordnumber < wordcount);
140 if (wordvalue[wordnumber] == AMULET && testbit(inven, AMULET) &&
141 position != FINAL) {
142 puts("The amulet begins to glow.");
143 if (testbit(inven, MEDALION)) {
144 puts("The medallion comes to life too.");
145 if (position == 114) {
146 location[position].down = 160;
147 whichway(location[position]);
148 puts("The waves subside and it is possible to descend to the sea cave now.");
149 ourtime++;
150 return (-1);
151 }
152 }
153 puts("A light mist falls over your eyes and the sound of purling water trickles in");
154 puts("your ears. When the mist lifts you are standing beside a cool stream.");
155 if (position == 229)
156 position = 224;
157 else
158 position = 229;
159 ourtime++;
160 notes[CANTSEE] = 0;
161 return (0);
162 } else if (position == FINAL)
163 puts("The amulet won't work in here.");
164 else if (wordvalue[wordnumber] == COMPASS && testbit(inven, COMPASS))
165 printf("Your compass points %s.\n", truedirec(NORTH, '-'));
166 else if (wordvalue[wordnumber] == COMPASS)
167 puts("You aren't holding the compass.");
168 else if (wordvalue[wordnumber] == AMULET)
169 puts("You aren't holding the amulet.");
170 else
171 puts("There is no apparent use.");
172 return (-1);
173 }
174
175 void
176 murder()
177 {
178 int n;
179
180 for (n = 0; !((n == SWORD || n == KNIFE || n == TWO_HANDED || n == MACE || n == CLEAVER || n == BROAD || n == CHAIN || n == SHOVEL || n == HALBERD) && testbit(inven, n)) && n < NUMOFOBJECTS; n++);
181 if (n == NUMOFOBJECTS)
182 puts("You don't have suitable weapons to kill.");
183 else {
184 printf("Your %s should do the trick.\n", objsht[n]);
185 while (wordtype[++wordnumber] == ADJS);
186 switch (wordvalue[wordnumber]) {
187
188 case NORMGOD:
189 if (testbit(location[position].objects, BATHGOD)) {
190 puts("The goddess's head slices off. Her corpse floats in the water.");
191 clearbit(location[position].objects, BATHGOD);
192 setbit(location[position].objects, DEADGOD);
193 power += 5;
194 notes[JINXED]++;
195 } else
196 if (testbit(location[position].objects, NORMGOD)) {
197 puts("The goddess pleads but you strike her mercilessly. Her broken body lies in a\npool of blood.");
198 clearbit(location[position].objects, NORMGOD);
199 setbit(location[position].objects, DEADGOD);
200 power += 5;
201 notes[JINXED]++;
202 if (wintime)
203 live();
204 } else
205 puts("I dont see her anywhere.");
206 break;
207 case TIMER:
208 if (testbit(location[position].objects, TIMER)) {
209 puts("The old man offers no resistance.");
210 clearbit(location[position].objects, TIMER);
211 setbit(location[position].objects, DEADTIME);
212 power++;
213 notes[JINXED]++;
214 } else
215 puts("Who?");
216 break;
217 case NATIVE:
218 if (testbit(location[position].objects, NATIVE)) {
219 puts("The girl screams as you cut her body to shreds. She is dead.");
220 clearbit(location[position].objects, NATIVE);
221 setbit(location[position].objects, DEADNATIVE);
222 power += 5;
223 notes[JINXED]++;
224 } else
225 puts("What girl?");
226 break;
227 case MAN:
228 if (testbit(location[position].objects, MAN)) {
229 puts("You strike him to the ground, and he coughs up blood.");
230 puts("Your fantasy is over.");
231 die();
232 }
233 case -1:
234 puts("Kill what?");
235 break;
236
237 default:
238 if (wordtype[wordnumber] != OBJECT)
239 puts("You can't kill that!");
240 else
241 printf("You can't kill the %s!\n",
242 objsht[wordvalue[wordnumber]]);
243 }
244 }
245 }
246
247 void
248 ravage()
249 {
250 while (wordtype[++wordnumber] != NOUNS && wordnumber <= wordcount);
251 if (wordtype[wordnumber] == NOUNS && testbit(location[position].objects, wordvalue[wordnumber])) {
252 ourtime++;
253 switch (wordvalue[wordnumber]) {
254 case NORMGOD:
255 puts("You attack the goddess, and she screams as you beat her. She falls down");
256 puts("crying and tries to hold her torn and bloodied dress around her.");
257 power += 5;
258 pleasure += 8;
259 ego -= 10;
260 wordnumber--;
261 godready = -30000;
262 murder();
263 win = -30000;
264 break;
265 case NATIVE:
266 puts("The girl tries to run, but you catch her and throw her down. Her face is");
267 puts("bleeding, and she screams as you tear off her clothes.");
268 power += 3;
269 pleasure += 5;
270 ego -= 10;
271 wordnumber--;
272 murder();
273 if (rnd(100) < 50) {
274 puts("Her screams have attracted attention. I think we are surrounded.");
275 setbit(location[ahead].objects, WOODSMAN);
276 setbit(location[ahead].objects, DEADWOOD);
277 setbit(location[ahead].objects, MALLET);
278 setbit(location[back].objects, WOODSMAN);
279 setbit(location[back].objects, DEADWOOD);
280 setbit(location[back].objects, MALLET);
281 setbit(location[left].objects, WOODSMAN);
282 setbit(location[left].objects, DEADWOOD);
283 setbit(location[left].objects, MALLET);
284 setbit(location[right].objects, WOODSMAN);
285 setbit(location[right].objects, DEADWOOD);
286 setbit(location[right].objects, MALLET);
287 }
288 break;
289 default:
290 puts("You are perverted.");
291 }
292 } else
293 puts("Who?");
294 }
295
296 int
297 follow()
298 {
299 if (followfight == ourtime) {
300 puts("The Dark Lord leaps away and runs down secret tunnels and corridors.");
301 puts("You chase him through the darkness and splash in pools of water.");
302 puts("You have cornered him. His laser sword extends as he steps forward.");
303 position = FINAL;
304 fight(DARK, 75);
305 setbit(location[position].objects, TALISMAN);
306 setbit(location[position].objects, AMULET);
307 return (0);
308 } else
309 if (followgod == ourtime) {
310 puts("The goddess leads you down a steamy tunnel and into a high, wide chamber.");
311 puts("She sits down on a throne.");
312 position = 268;
313 setbit(location[position].objects, NORMGOD);
314 notes[CANTSEE] = 1;
315 return (0);
316 } else
317 puts("There is no one to follow.");
318 return (-1);
319 }