1 /* $NetBSD: command3.c,v 1.2 2003/08/07 09:37:00 agc Exp $ */
4 * Copyright (c) 1983, 1993
5 * The Regents of the University of California. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
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. Neither the name of the University nor the names of its contributors
16 * may be used to endorse or promote products derived from this software
17 * without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 #include <sys/cdefs.h>
35 static char sccsid
[] = "@(#)com3.c 8.2 (Berkeley) 4/28/95";
37 __RCSID("$NetBSD: command3.c,v 1.2 2003/08/07 09:37:00 agc Exp $");
46 if (testbit(inven
, SHOVEL
)) {
50 case 144: /* copse near beach */
52 setbit(location
[position
].objects
, DEADWOOD
);
53 setbit(location
[position
].objects
, COMPASS
);
54 setbit(location
[position
].objects
, KNIFE
);
55 setbit(location
[position
].objects
, MACE
);
61 puts("Nothing happens.");
64 puts("You don't have a shovel.");
74 puts("Nothing happens.");
96 injuries
[12] = injuries
[8] = injuries
[7] = injuries
[6] = 1;
97 for (n
= 0; n
< NUMOFOBJECTS
; n
++)
98 if (testbit(inven
, n
)) {
100 setbit(location
[position
].objects
, n
);
112 if (testbit(inven
, SHOVEL
)) {
113 while (wordtype
[++wordnumber
] != OBJECT
&&
114 wordtype
[wordnumber
] != NOUNS
&& wordnumber
< wordcount
)
116 value
= wordvalue
[wordnumber
];
117 if (wordtype
[wordnumber
] == NOUNS
&&
118 (testbit(location
[position
].objects
, value
) ||
122 wordtype
[wordnumber
] = OBJECT
;
123 if (testbit(inven
, MAID
) ||
124 testbit(location
[position
].objects
, MAID
))
126 if (testbit(inven
, DEADWOOD
) ||
127 testbit(location
[position
].objects
,
130 if (testbit(inven
, DEADGOD
) ||
131 testbit(location
[position
].objects
,
134 if (testbit(inven
, DEADTIME
) ||
135 testbit(location
[position
].objects
,
138 if (testbit(inven
, DEADNATIVE
) ||
139 testbit(location
[position
].objects
,
146 printf("She screams as you wrestle her into ");
154 wordtype
[wordnumber
] = OBJECT
;
160 if (wordtype
[wordnumber
] == OBJECT
&& position
> 88 &&
161 (testbit(inven
, value
) ||
162 testbit(location
[position
].objects
, value
))) {
164 if (testbit(inven
, value
)) {
165 clearbit(inven
, value
);
166 carrying
-= objwt
[value
];
167 encumber
-= objcumber
[value
];
169 clearbit(location
[position
].objects
, value
);
177 printf("The %s should rest easier now.\n",
181 puts("It doesn't seem to work.");
183 puts("You aren't holding a shovel.");
191 if (testbit(inven
, POTION
)) {
192 printf("The cool liquid runs down your throat but turns to ");
193 puts("fire and you choke.");
194 printf("The heat reaches your limbs and tingles your spirit.");
195 puts(" You feel like falling");
197 clearbit(inven
, POTION
);
200 for (n
= 0; n
< NUMOFINJURIES
; n
++)
205 puts("I'm not thirsty.");
211 int firstnumber
, value
;
213 firstnumber
= wordnumber
;
214 if (!testbit(inven
, LASER
))
215 puts("You aren't holding a blaster.");
218 while (wordnumber
<= wordcount
&&
219 wordtype
[wordnumber
] == OBJECT
) {
220 value
= wordvalue
[wordnumber
];
221 printf("%s:\n", objsht
[value
]);
222 if (testbit(location
[position
].objects
, value
)) {
223 clearbit(location
[position
].objects
, value
);
225 printf("The %s explode%s\n", objsht
[value
],
226 (is_plural_object(value
) ? "." : "s."));
230 printf("I don't see any %s around here.\n",
232 if (wordnumber
< wordcount
- 1 &&
233 wordvalue
[++wordnumber
] == AND
)
236 return (firstnumber
);
238 /* special cases with their own return()'s */
240 if (wordnumber
<= wordcount
&& wordtype
[wordnumber
] == NOUNS
) {
242 switch (wordvalue
[wordnumber
]) {
248 puts("The door is unhinged.");
249 location
[189].north
= 231;
250 location
[231].south
= 189;
251 whichway(location
[position
]);
254 puts("The wooden door splinters.");
255 location
[30].west
= 25;
256 whichway(location
[position
]);
259 printf("The laser blast has no ");
260 puts("effect on the door.");
263 printf("The blast hits the door and ");
264 printf("it explodes into flame. The ");
265 puts("magnesium burns");
266 printf("so rapidly that we have no ");
267 puts("chance to escape.");
270 puts("Nothing happens.");
275 if (testbit(location
[position
].objects
,
277 printf("The goddess is hit in the ");
278 printf("chest and splashes back ");
279 puts("against the rocks.");
280 printf("Dark blood oozes from the ");
281 printf("charred blast hole. Her ");
282 puts("naked body floats in the");
283 puts("pools and then off downstream.");
284 clearbit(location
[position
].objects
,
286 setbit(location
[180].objects
, DEADGOD
);
291 if (testbit(location
[position
].objects
,
293 printf("The blast catches ");
294 printf("the goddess in the ");
295 printf("stomach, knocking ");
296 puts("her to the ground.");
297 printf("She writhes in the ");
298 printf("dirt as the agony of ");
299 puts("death taunts her.");
300 puts("She has stopped moving.");
301 clearbit(location
[position
].objects
, NORMGOD
);
302 setbit(location
[position
].objects
, DEADGOD
);
310 printf("I don't see any ");
311 puts("goddess around here.");
315 if (testbit(location
[position
].objects
,
317 printf("The old man slumps over ");
322 clearbit(location
[position
].objects
,
324 setbit(location
[position
].objects
,
327 puts("What old-timer?");
330 if (testbit(location
[position
].objects
, MAN
)) {
331 printf("The man falls to the ground ");
332 printf("with blood pouring all over ");
333 puts("his white suit.");
334 puts("Your fantasy is over.");
340 if (testbit(location
[position
].objects
,
342 printf("The girl is blown backwards ");
343 printf("several feet and lies in a ");
344 puts("pool of blood.");
345 clearbit(location
[position
].objects
,
347 setbit(location
[position
].objects
,
353 puts("There is no girl here.");
360 printf("You can't shoot the %s.\n",
361 objsht
[wordvalue
[wordnumber
]]);
364 puts("You must be a looney.");
366 return (firstnumber
);