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. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
15 * This product includes software developed by the University of
16 * California, Berkeley and its contributors.
17 * 4. Neither the name of the University nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * @(#)com3.c 8.1 (Berkeley) 5/31/93
34 * $FreeBSD: src/games/battlestar/com3.c,v 1.8.2.1 2001/03/05 11:45:35 kris Exp $
35 * $DragonFly: src/games/battlestar/com3.c,v 1.3 2006/08/08 16:47:20 pavalos Exp $
43 if (testbit(inven
,SHOVEL
)){
47 case 144: /* copse near beach */
49 setbit(location
[position
].objects
,DEADWOOD
);
50 setbit(location
[position
].objects
,COMPASS
);
51 setbit(location
[position
].objects
,KNIFE
);
52 setbit(location
[position
].objects
,MACE
);
58 puts("Nothing happens.");
62 puts("You don't have a shovel.");
72 puts("Nothing happens.");
94 injuries
[12] = injuries
[8] = injuries
[7] = injuries
[6] = 1;
95 for (n
=0; n
< NUMOFOBJECTS
; n
++)
96 if (testbit(inven
,n
)){
98 setbit(location
[position
].objects
,n
);
110 if (testbit(inven
,SHOVEL
)){
111 while(wordtype
[++wordnumber
] != OBJECT
&& wordtype
[wordnumber
] != NOUNS
&& wordnumber
< wordcount
);
112 value
= wordvalue
[wordnumber
];
113 if (wordtype
[wordnumber
] == NOUNS
&& (testbit(location
[position
].objects
,value
) || value
== BODY
))
116 wordtype
[wordnumber
] = OBJECT
;
117 if (testbit(inven
,MAID
) || testbit(location
[position
].objects
,MAID
))
119 if (testbit(inven
,DEADWOOD
) || testbit(location
[position
].objects
,DEADWOOD
))
121 if (testbit(inven
,DEADGOD
) || testbit(location
[position
].objects
,DEADGOD
))
123 if (testbit(inven
,DEADTIME
) || testbit(location
[position
].objects
,DEADTIME
))
125 if (testbit(inven
,DEADNATIVE
) || testbit(location
[position
].objects
,DEADNATIVE
))
131 puts("She screams as you wrestle her into the hole.");
138 wordtype
[wordnumber
] = OBJECT
;
144 if (wordtype
[wordnumber
] == OBJECT
&& position
> 88 && (testbit(inven
,value
) || testbit(location
[position
].objects
,value
))){
146 if (testbit(inven
,value
)){
147 clearbit(inven
,value
);
148 carrying
-= objwt
[value
];
149 encumber
-= objcumber
[value
];
151 clearbit(location
[position
].objects
,value
);
159 printf("The %s should rest easier now.\n",objsht
[value
]);
163 puts("It doesn't seem to work.");
166 puts("You aren't holding a shovel.");
174 if (testbit(inven
,POTION
)){
175 puts("The cool liquid runs down your throat but turns to fire and you choke.");
176 puts("The heat reaches your limbs and tingles your spirit. You feel like falling");
178 clearbit(inven
, POTION
);
181 for (n
=0; n
< NUMOFINJURIES
; n
++)
187 puts("I'm not thirsty.");
193 int firstnumber
, value
;
196 firstnumber
= wordnumber
;
197 if (!testbit(inven
,LASER
))
198 puts("You aren't holding a blaster.");
200 while(wordtype
[++wordnumber
] == ADJS
);
201 while(wordnumber
<=wordcount
&& wordtype
[wordnumber
] == OBJECT
){
202 value
= wordvalue
[wordnumber
];
203 printf("%s:\n", objsht
[value
]);
204 for (n
=0; objsht
[value
][n
]; n
++);
205 if (testbit(location
[position
].objects
,value
)){
206 clearbit(location
[position
].objects
,value
);
208 printf("The %s explode%s\n",objsht
[value
],(objsht
[value
][n
-1]=='s' ? (objsht
[value
][n
-2]=='s' ? "s." : ".") : "s."));
213 printf("I dont see any %s around here.\n", objsht
[value
]);
214 if (wordnumber
< wordcount
- 1 && wordvalue
[++wordnumber
] == AND
)
219 /* special cases with their own return()'s */
221 if (wordnumber
<= wordcount
&& wordtype
[wordnumber
] == NOUNS
){
223 switch(wordvalue
[wordnumber
]){
229 puts("The door is unhinged.");
230 location
[189].north
= 231;
231 location
[231].south
= 189;
232 whichway(location
[position
]);
235 puts("The wooden door splinters.");
236 location
[30].west
= 25;
237 whichway(location
[position
]);
240 puts("The laser blast has no effect on the door.");
243 puts("The blast hits the door and it explodes into flame. The magnesium burns");
244 puts("so rapidly that we have no chance to escape.");
247 puts("Nothing happens.");
252 if (testbit(location
[position
].objects
,BATHGOD
)){
253 puts("The goddess is hit in the chest and splashes back against the rocks.");
254 puts("Dark blood oozes from the charred blast hole. Her naked body floats in the");
255 puts("pools and then off downstream.");
256 clearbit(location
[position
].objects
,BATHGOD
);
257 setbit(location
[180].objects
,DEADGOD
);
261 } else if (testbit(location
[position
].objects
,NORMGOD
)){
262 puts("The blast catches the goddess in the stomach, knocking her to the ground.");
263 puts("She writhes in the dirt as the agony of death taunts her.");
264 puts("She has stopped moving.");
265 clearbit(location
[position
].objects
,NORMGOD
);
266 setbit(location
[position
].objects
,DEADGOD
);
274 puts("I don't see any goddess around here.");
278 if (testbit(location
[position
].objects
,TIMER
)){
279 puts("The old man slumps over the bar.");
283 clearbit(location
[position
].objects
,TIMER
);
284 setbit(location
[position
].objects
,DEADTIME
);
286 else puts("What old timer?");
289 if (testbit(location
[position
].objects
,MAN
)){
290 puts("The man falls to the ground with blood pouring all over his white suit.");
291 puts("Your fantasy is over.");
294 else puts("What man?");
297 if (testbit(location
[position
].objects
,NATIVE
)){
298 puts("The girl is blown backwards several feet and lies in a pool of blood.");
299 clearbit(location
[position
].objects
,NATIVE
);
300 setbit(location
[position
].objects
,DEADNATIVE
);
304 } else puts("There is no girl here.");
311 printf("You can't shoot the %s.\n",objsht
[wordvalue
[wordnumber
]]);
314 else puts("You must be a looney.");