2 * Copyright (c) 1983, 1993
3 * The Regents of the University of California. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
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. Neither the name of the University nor the names of its contributors
14 * may be used to endorse or promote products derived from this software
15 * without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * @(#)com3.c 8.1 (Berkeley) 5/31/93
30 * $FreeBSD: src/games/battlestar/com3.c,v 1.8.2.1 2001/03/05 11:45:35 kris Exp $
31 * $DragonFly: src/games/battlestar/com3.c,v 1.3 2006/08/08 16:47:20 pavalos Exp $
39 if (testbit(inven
, SHOVEL
)) {
43 case 144: /* copse near beach */
45 setbit(location
[position
].objects
, DEADWOOD
);
46 setbit(location
[position
].objects
, COMPASS
);
47 setbit(location
[position
].objects
, KNIFE
);
48 setbit(location
[position
].objects
, MACE
);
54 puts("Nothing happens.");
57 puts("You don't have a shovel.");
67 puts("Nothing happens.");
89 injuries
[12] = injuries
[8] = injuries
[7] = injuries
[6] = 1;
90 for (n
= 0; n
< NUMOFOBJECTS
; n
++)
91 if (testbit(inven
, n
)) {
93 setbit(location
[position
].objects
, n
);
105 if (testbit(inven
, SHOVEL
)) {
106 while (wordtype
[++wordnumber
] != OBJECT
&&
107 wordtype
[wordnumber
] != NOUNS
&& wordnumber
< wordcount
)
109 value
= wordvalue
[wordnumber
];
110 if (wordtype
[wordnumber
] == NOUNS
&&
111 (testbit(location
[position
].objects
, value
) ||
115 wordtype
[wordnumber
] = OBJECT
;
116 if (testbit(inven
, MAID
) ||
117 testbit(location
[position
].objects
, MAID
))
119 if (testbit(inven
, DEADWOOD
) ||
120 testbit(location
[position
].objects
,
123 if (testbit(inven
, DEADGOD
) ||
124 testbit(location
[position
].objects
,
127 if (testbit(inven
, DEADTIME
) ||
128 testbit(location
[position
].objects
,
131 if (testbit(inven
, DEADNATIVE
) ||
132 testbit(location
[position
].objects
,
139 puts("She screams as you wrestle her into the hole.");
146 wordtype
[wordnumber
] = OBJECT
;
152 if (wordtype
[wordnumber
] == OBJECT
&& position
> 88 &&
153 (testbit(inven
, value
) ||
154 testbit(location
[position
].objects
, value
))) {
156 if (testbit(inven
, value
)) {
157 clearbit(inven
, value
);
158 carrying
-= objwt
[value
];
159 encumber
-= objcumber
[value
];
161 clearbit(location
[position
].objects
, value
);
169 printf("The %s should rest easier now.\n",
173 puts("It doesn't seem to work.");
175 puts("You aren't holding a shovel.");
183 if (testbit(inven
, POTION
)) {
184 puts("The cool liquid runs down your throat but turns to fire and you choke.");
185 puts("The heat reaches your limbs and tingles your spirit. You feel like falling");
187 clearbit(inven
, POTION
);
190 for (n
= 0; n
< NUMOFINJURIES
; n
++)
195 puts("I'm not thirsty.");
201 int firstnumber
, value
;
204 firstnumber
= wordnumber
;
205 if (!testbit(inven
, LASER
))
206 puts("You aren't holding a blaster.");
208 while (wordtype
[++wordnumber
] == ADJS
)
210 while (wordnumber
<= wordcount
&&
211 wordtype
[wordnumber
] == OBJECT
) {
212 value
= wordvalue
[wordnumber
];
213 printf("%s:\n", objsht
[value
]);
214 for (n
= 0; objsht
[value
][n
]; n
++)
216 if (testbit(location
[position
].objects
, value
)) {
217 clearbit(location
[position
].objects
, value
);
219 printf("The %s explode%s\n", objsht
[value
],
220 (objsht
[value
][n
- 1] ==
221 's' ? (objsht
[value
][n
- 2] ==
222 's' ? "s." : ".") : "s."));
226 printf("I dont see any %s around here.\n",
228 if (wordnumber
< wordcount
- 1 &&
229 wordvalue
[++wordnumber
] == AND
)
232 return (firstnumber
);
234 /* special cases with their own return()'s */
236 if (wordnumber
<= wordcount
&& wordtype
[wordnumber
] == NOUNS
) {
238 switch (wordvalue
[wordnumber
]) {
243 puts("The door is unhinged.");
244 location
[189].north
= 231;
245 location
[231].south
= 189;
246 whichway(location
[position
]);
249 puts("The wooden door splinters.");
250 location
[30].west
= 25;
251 whichway(location
[position
]);
254 puts("The laser blast has no effect on the door.");
257 puts("The blast hits the door and it explodes into flame. The magnesium burns");
258 puts("so rapidly that we have no chance to escape.");
261 puts("Nothing happens.");
266 if (testbit(location
[position
].objects
,
268 puts("The goddess is hit in the chest and splashes back against the rocks.");
269 puts("Dark blood oozes from the charred blast hole. Her naked body floats in the");
270 puts("pools and then off downstream.");
271 clearbit(location
[position
].objects
,
273 setbit(location
[180].objects
, DEADGOD
);
278 if (testbit(location
[position
].objects
,
280 puts("The blast catches the goddess in the stomach, knocking her to the ground.");
281 puts("She writhes in the dirt as the agony of death taunts her.");
282 puts("She has stopped moving.");
283 clearbit(location
[position
].objects
, NORMGOD
);
284 setbit(location
[position
].objects
, DEADGOD
);
292 puts("I don't see any goddess around here.");
296 if (testbit(location
[position
].objects
,
298 puts("The old man slumps over the bar.");
302 clearbit(location
[position
].objects
,
304 setbit(location
[position
].objects
,
307 puts("What old timer?");
310 if (testbit(location
[position
].objects
, MAN
)) {
311 puts("The man falls to the ground with blood pouring all over his white suit.");
312 puts("Your fantasy is over.");
318 if (testbit(location
[position
].objects
,
320 puts("The girl is blown backwards several feet and lies in a pool of blood.");
321 clearbit(location
[position
].objects
,
323 setbit(location
[position
].objects
,
329 puts("There is no girl here.");
336 printf("You can't shoot the %s.\n",
337 objsht
[wordvalue
[wordnumber
]]);
340 puts("You must be a looney.");
342 return (firstnumber
);