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 $
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 puts("She screams as you wrestle her into the hole.");
147 wordtype
[wordnumber
] = OBJECT
;
153 if (wordtype
[wordnumber
] == OBJECT
&& position
> 88 &&
154 (testbit(inven
, value
) ||
155 testbit(location
[position
].objects
, value
))) {
157 if (testbit(inven
, value
)) {
158 clearbit(inven
, value
);
159 carrying
-= objwt
[value
];
160 encumber
-= objcumber
[value
];
162 clearbit(location
[position
].objects
, value
);
170 printf("The %s should rest easier now.\n",
174 puts("It doesn't seem to work.");
176 puts("You aren't holding a shovel.");
184 if (testbit(inven
, POTION
)) {
185 puts("The cool liquid runs down your throat but turns to fire and you choke.");
186 puts("The heat reaches your limbs and tingles your spirit. You feel like falling");
188 clearbit(inven
, POTION
);
191 for (n
= 0; n
< NUMOFINJURIES
; n
++)
196 puts("I'm not thirsty.");
202 int firstnumber
, value
;
205 firstnumber
= wordnumber
;
206 if (!testbit(inven
, LASER
))
207 puts("You aren't holding a blaster.");
209 while (wordtype
[++wordnumber
] == ADJS
)
211 while (wordnumber
<= wordcount
&&
212 wordtype
[wordnumber
] == OBJECT
) {
213 value
= wordvalue
[wordnumber
];
214 printf("%s:\n", objsht
[value
]);
215 for (n
= 0; objsht
[value
][n
]; n
++)
217 if (testbit(location
[position
].objects
, value
)) {
218 clearbit(location
[position
].objects
, value
);
220 printf("The %s explode%s\n", objsht
[value
],
221 (objsht
[value
][n
- 1] ==
222 's' ? (objsht
[value
][n
- 2] ==
223 's' ? "s." : ".") : "s."));
227 printf("I dont see any %s around here.\n",
229 if (wordnumber
< wordcount
- 1 &&
230 wordvalue
[++wordnumber
] == AND
)
233 return (firstnumber
);
235 /* special cases with their own return()'s */
237 if (wordnumber
<= wordcount
&& wordtype
[wordnumber
] == NOUNS
) {
239 switch (wordvalue
[wordnumber
]) {
244 puts("The door is unhinged.");
245 location
[189].north
= 231;
246 location
[231].south
= 189;
247 whichway(location
[position
]);
250 puts("The wooden door splinters.");
251 location
[30].west
= 25;
252 whichway(location
[position
]);
255 puts("The laser blast has no effect on the door.");
258 puts("The blast hits the door and it explodes into flame. The magnesium burns");
259 puts("so rapidly that we have no chance to escape.");
262 puts("Nothing happens.");
267 if (testbit(location
[position
].objects
,
269 puts("The goddess is hit in the chest and splashes back against the rocks.");
270 puts("Dark blood oozes from the charred blast hole. Her naked body floats in the");
271 puts("pools and then off downstream.");
272 clearbit(location
[position
].objects
,
274 setbit(location
[180].objects
, DEADGOD
);
279 if (testbit(location
[position
].objects
,
281 puts("The blast catches the goddess in the stomach, knocking her to the ground.");
282 puts("She writhes in the dirt as the agony of death taunts her.");
283 puts("She has stopped moving.");
284 clearbit(location
[position
].objects
, NORMGOD
);
285 setbit(location
[position
].objects
, DEADGOD
);
293 puts("I don't see any goddess around here.");
297 if (testbit(location
[position
].objects
,
299 puts("The old man slumps over the bar.");
303 clearbit(location
[position
].objects
,
305 setbit(location
[position
].objects
,
308 puts("What old timer?");
311 if (testbit(location
[position
].objects
, MAN
)) {
312 puts("The man falls to the ground with blood pouring all over his white suit.");
313 puts("Your fantasy is over.");
319 if (testbit(location
[position
].objects
,
321 puts("The girl is blown backwards several feet and lies in a pool of blood.");
322 clearbit(location
[position
].objects
,
324 setbit(location
[position
].objects
,
330 puts("There is no girl here.");
337 printf("You can't shoot the %s.\n",
338 objsht
[wordvalue
[wordnumber
]]);
341 puts("You must be a looney.");
343 return (firstnumber
);