1 /* @(#)com3.c 8.2 (Berkeley) 4/28/95 */
2 /* $NetBSD: command3.c,v 1.5 2019/02/03 03:19:25 mrg Exp $ */
5 * Copyright (c) 1983, 1993
6 * The Regents of the University of California. All rights reserved.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. Neither the name of the University nor the names of its contributors
17 * may be used to endorse or promote products derived from this software
18 * without specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38 if (testbit(inven
, SHOVEL
)) {
42 case 144: /* copse near beach */
44 setbit(location
[position
].objects
, DEADWOOD
);
45 setbit(location
[position
].objects
, COMPASS
);
46 setbit(location
[position
].objects
, KNIFE
);
47 setbit(location
[position
].objects
, MACE
);
53 puts("Nothing happens.");
56 puts("You don't have a shovel.");
66 puts("Nothing happens.");
88 injuries
[12] = injuries
[8] = injuries
[7] = injuries
[6] = 1;
89 for (n
= 0; n
< NUMOFOBJECTS
; n
++)
90 if (testbit(inven
, n
)) {
92 setbit(location
[position
].objects
, n
);
104 if (testbit(inven
, SHOVEL
)) {
105 while (wordtype
[++wordnumber
] != OBJECT
&&
106 wordtype
[wordnumber
] != NOUNS
&& wordnumber
< wordcount
)
108 value
= wordvalue
[wordnumber
];
109 if (wordtype
[wordnumber
] == NOUNS
&&
110 (testbit(location
[position
].objects
, value
) ||
114 wordtype
[wordnumber
] = OBJECT
;
115 if (testbit(inven
, MAID
) ||
116 testbit(location
[position
].objects
, MAID
))
118 if (testbit(inven
, DEADWOOD
) ||
119 testbit(location
[position
].objects
,
122 if (testbit(inven
, DEADGOD
) ||
123 testbit(location
[position
].objects
,
126 if (testbit(inven
, DEADTIME
) ||
127 testbit(location
[position
].objects
,
130 if (testbit(inven
, DEADNATIVE
) ||
131 testbit(location
[position
].objects
,
138 printf("She screams as you wrestle her into ");
148 wordtype
[wordnumber
] = OBJECT
;
154 if (wordtype
[wordnumber
] == OBJECT
&& position
> 88 &&
155 (testbit(inven
, value
) ||
156 testbit(location
[position
].objects
, value
))) {
158 if (testbit(inven
, value
)) {
159 clearbit(inven
, value
);
160 carrying
-= objwt
[value
];
161 encumber
-= objcumber
[value
];
163 clearbit(location
[position
].objects
, value
);
171 printf("The %s should rest easier now.\n",
175 puts("It doesn't seem to work.");
177 puts("You aren't holding a shovel.");
185 if (testbit(inven
, POTION
)) {
186 printf("The cool liquid runs down your throat but turns to ");
187 puts("fire and you choke.");
188 printf("The heat reaches your limbs and tingles your spirit.");
189 puts(" You feel like falling");
191 clearbit(inven
, POTION
);
194 for (n
= 0; n
< NUMOFINJURIES
; n
++)
199 puts("I'm not thirsty.");
205 int firstnumber
, value
;
207 firstnumber
= wordnumber
;
208 if (!testbit(inven
, LASER
))
209 puts("You aren't holding a blaster.");
212 while (wordnumber
<= wordcount
&&
213 wordtype
[wordnumber
] == OBJECT
) {
214 value
= wordvalue
[wordnumber
];
215 printf("%s:\n", objsht
[value
]);
216 if (testbit(location
[position
].objects
, value
)) {
217 clearbit(location
[position
].objects
, value
);
219 printf("The %s explode%s\n", objsht
[value
],
220 (is_plural_object(value
) ? "." : "s."));
224 printf("I don't see any %s around here.\n",
226 if (wordnumber
< wordcount
- 1 &&
227 wordvalue
[++wordnumber
] == AND
)
230 return (firstnumber
);
232 /* special cases with their own return()'s */
234 if (wordnumber
<= wordcount
&& wordtype
[wordnumber
] == NOUNS
) {
236 switch (wordvalue
[wordnumber
]) {
242 puts("The door is unhinged.");
243 location
[189].north
= 231;
244 location
[231].south
= 189;
245 whichway(location
[position
]);
248 puts("The wooden door splinters.");
249 location
[30].west
= 25;
250 whichway(location
[position
]);
253 printf("The laser blast has no ");
254 puts("effect on the door.");
257 printf("The blast hits the door and ");
258 printf("it explodes into flame. The ");
259 puts("magnesium burns");
260 printf("so rapidly that we have no ");
261 puts("chance to escape.");
264 puts("Nothing happens.");
269 if (testbit(location
[position
].objects
,
271 printf("The goddess is hit in the ");
272 printf("chest and splashes back ");
273 puts("against the rocks.");
274 printf("Dark blood oozes from the ");
275 printf("charred blast hole. Her ");
276 puts("naked body floats in the");
277 puts("pools and then off downstream.");
278 clearbit(location
[position
].objects
,
280 setbit(location
[180].objects
, DEADGOD
);
285 if (testbit(location
[position
].objects
,
287 printf("The blast catches ");
288 printf("the goddess in the ");
289 printf("stomach, knocking ");
290 puts("her to the ground.");
291 printf("She writhes in the ");
292 printf("dirt as the agony of ");
293 puts("death taunts her.");
294 puts("She has stopped moving.");
295 clearbit(location
[position
].objects
, NORMGOD
);
296 setbit(location
[position
].objects
, DEADGOD
);
304 printf("I don't see any ");
305 puts("goddess around here.");
310 if (testbit(location
[position
].objects
,
312 printf("The old man slumps over ");
317 clearbit(location
[position
].objects
,
319 setbit(location
[position
].objects
,
322 puts("What old-timer?");
325 if (testbit(location
[position
].objects
, MAN
)) {
326 printf("The man falls to the ground ");
327 printf("with blood pouring all over ");
328 puts("his white suit.");
329 puts("Your fantasy is over.");
335 if (testbit(location
[position
].objects
,
337 printf("The girl is blown backwards ");
338 printf("several feet and lies in a ");
339 puts("pool of blood.");
340 clearbit(location
[position
].objects
,
342 setbit(location
[position
].objects
,
348 puts("There is no girl here.");
355 printf("You can't shoot the %s.\n",
356 objsht
[wordvalue
[wordnumber
]]);
359 puts("You must be a looney.");
361 return (firstnumber
);