]>
git.cameronkatri.com Git - bsdgames-darwin.git/blob - battlestar/command3.c
1 /* $NetBSD: command3.c,v 1.5 2019/02/03 03:19:25 mrg 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.5 2019/02/03 03:19:25 mrg 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 ");
156 wordtype
[wordnumber
] = OBJECT
;
162 if (wordtype
[wordnumber
] == OBJECT
&& position
> 88 &&
163 (testbit(inven
, value
) ||
164 testbit(location
[position
].objects
, value
))) {
166 if (testbit(inven
, value
)) {
167 clearbit(inven
, value
);
168 carrying
-= objwt
[value
];
169 encumber
-= objcumber
[value
];
171 clearbit(location
[position
].objects
, value
);
179 printf("The %s should rest easier now.\n",
183 puts("It doesn't seem to work.");
185 puts("You aren't holding a shovel.");
193 if (testbit(inven
, POTION
)) {
194 printf("The cool liquid runs down your throat but turns to ");
195 puts("fire and you choke.");
196 printf("The heat reaches your limbs and tingles your spirit.");
197 puts(" You feel like falling");
199 clearbit(inven
, POTION
);
202 for (n
= 0; n
< NUMOFINJURIES
; n
++)
207 puts("I'm not thirsty.");
213 int firstnumber
, value
;
215 firstnumber
= wordnumber
;
216 if (!testbit(inven
, LASER
))
217 puts("You aren't holding a blaster.");
220 while (wordnumber
<= wordcount
&&
221 wordtype
[wordnumber
] == OBJECT
) {
222 value
= wordvalue
[wordnumber
];
223 printf("%s:\n", objsht
[value
]);
224 if (testbit(location
[position
].objects
, value
)) {
225 clearbit(location
[position
].objects
, value
);
227 printf("The %s explode%s\n", objsht
[value
],
228 (is_plural_object(value
) ? "." : "s."));
232 printf("I don't see any %s around here.\n",
234 if (wordnumber
< wordcount
- 1 &&
235 wordvalue
[++wordnumber
] == AND
)
238 return (firstnumber
);
240 /* special cases with their own return()'s */
242 if (wordnumber
<= wordcount
&& wordtype
[wordnumber
] == NOUNS
) {
244 switch (wordvalue
[wordnumber
]) {
250 puts("The door is unhinged.");
251 location
[189].north
= 231;
252 location
[231].south
= 189;
253 whichway(location
[position
]);
256 puts("The wooden door splinters.");
257 location
[30].west
= 25;
258 whichway(location
[position
]);
261 printf("The laser blast has no ");
262 puts("effect on the door.");
265 printf("The blast hits the door and ");
266 printf("it explodes into flame. The ");
267 puts("magnesium burns");
268 printf("so rapidly that we have no ");
269 puts("chance to escape.");
272 puts("Nothing happens.");
277 if (testbit(location
[position
].objects
,
279 printf("The goddess is hit in the ");
280 printf("chest and splashes back ");
281 puts("against the rocks.");
282 printf("Dark blood oozes from the ");
283 printf("charred blast hole. Her ");
284 puts("naked body floats in the");
285 puts("pools and then off downstream.");
286 clearbit(location
[position
].objects
,
288 setbit(location
[180].objects
, DEADGOD
);
293 if (testbit(location
[position
].objects
,
295 printf("The blast catches ");
296 printf("the goddess in the ");
297 printf("stomach, knocking ");
298 puts("her to the ground.");
299 printf("She writhes in the ");
300 printf("dirt as the agony of ");
301 puts("death taunts her.");
302 puts("She has stopped moving.");
303 clearbit(location
[position
].objects
, NORMGOD
);
304 setbit(location
[position
].objects
, DEADGOD
);
312 printf("I don't see any ");
313 puts("goddess around here.");
318 if (testbit(location
[position
].objects
,
320 printf("The old man slumps over ");
325 clearbit(location
[position
].objects
,
327 setbit(location
[position
].objects
,
330 puts("What old-timer?");
333 if (testbit(location
[position
].objects
, MAN
)) {
334 printf("The man falls to the ground ");
335 printf("with blood pouring all over ");
336 puts("his white suit.");
337 puts("Your fantasy is over.");
343 if (testbit(location
[position
].objects
,
345 printf("The girl is blown backwards ");
346 printf("several feet and lies in a ");
347 puts("pool of blood.");
348 clearbit(location
[position
].objects
,
350 setbit(location
[position
].objects
,
356 puts("There is no girl here.");
363 printf("You can't shoot the %s.\n",
364 objsht
[wordvalue
[wordnumber
]]);
367 puts("You must be a looney.");
369 return (firstnumber
);