]> git.cameronkatri.com Git - bsdgames-darwin.git/blob - battlestar/com2.c
specify man pages the new way.
[bsdgames-darwin.git] / battlestar / com2.c
1 /*
2 * Copyright (c) 1983 Regents of the University of California.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
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.
20 *
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
31 * SUCH DAMAGE.
32 */
33
34 #ifndef lint
35 /*static char sccsid[] = "from: @(#)com2.c 5.3 (Berkeley) 6/1/90";*/
36 static char rcsid[] = "$Id: com2.c,v 1.2 1993/08/01 18:56:12 mycroft Exp $";
37 #endif /* not lint */
38
39 #include "externs.h"
40
41 wearit() /* synonyms = {sheathe, sheath} */
42 {
43 register int n;
44 int firstnumber, value;
45
46 firstnumber = wordnumber;
47 while(wordtype[++wordnumber] == ADJS);
48 while(wordnumber <= wordcount){
49 value = wordvalue[wordnumber];
50 for (n=0; objsht[value][n]; n++);
51 switch(value){
52
53 case -1:
54 puts("Wear what?");
55 return(firstnumber);
56
57 default:
58 printf("You can't wear%s%s!\n",(objsht[value][n-1] == 's' ? " " : " a "),objsht[value]);
59 return(firstnumber);
60
61 case KNIFE:
62 /* case SHIRT: */
63 case ROBE:
64 case LEVIS: /* wearable things */
65 case SWORD:
66 case MAIL:
67 case HELM:
68 case SHOES:
69 case PAJAMAS:
70 case COMPASS:
71 case LASER:
72 case AMULET:
73 case TALISMAN:
74 case MEDALION:
75 case ROPE:
76 case RING:
77 case BRACELET:
78 case GRENADE:
79
80 if (testbit(inven,value)){
81 clearbit(inven,value);
82 setbit(wear,value);
83 carrying -= objwt[value];
84 encumber -= objcumber[value];
85 time++;
86 printf("You are now wearing %s %s.\n",(objsht[value][n-1] == 's' ? "the" : "a"), objsht[value]);
87 }
88 else if (testbit(wear,value))
89 printf("You are already wearing the %s.\n", objsht[value]);
90 else
91 printf("You aren't holding the %s.\n", objsht[value]);
92 if (wordnumber < wordcount - 1 && wordvalue[++wordnumber] == AND)
93 wordnumber++;
94 else
95 return(firstnumber);
96 } /* end switch */
97 } /* end while */
98 puts("Don't be ridiculous.");
99 return(firstnumber);
100 }
101
102 put() /* synonyms = {buckle, strap, tie} */
103 {
104 if (wordvalue[wordnumber + 1] == ON){
105 wordvalue[++wordnumber] = PUTON;
106 return(cypher());
107 }
108 if (wordvalue[wordnumber + 1] == DOWN){
109 wordvalue[++wordnumber] = DROP;
110 return(cypher());
111 }
112 puts("I don't understand what you want to put.");
113 return(-1);
114
115 }
116
117 draw() /* synonyms = {pull, carry} */
118 {
119 return(take(wear));
120 }
121
122 use()
123 {
124 while (wordtype[++wordnumber] == ADJS && wordnumber < wordcount);
125 if (wordvalue[wordnumber] == AMULET && testbit(inven,AMULET) && position != FINAL){
126 puts("The amulet begins to glow.");
127 if (testbit(inven,MEDALION)){
128 puts("The medallion comes to life too.");
129 if (position == 114){
130 location[position].down = 160;
131 whichway(location[position]);
132 puts("The waves subside and it is possible to descend to the sea cave now.");
133 time++;
134 return(-1);
135 }
136 }
137 puts("A light mist falls over your eyes and the sound of purling water trickles in");
138 puts("your ears. When the mist lifts you are standing beside a cool stream.");
139 if (position == 229)
140 position = 224;
141 else
142 position = 229;
143 time++;
144 return(0);
145 }
146 else if (position == FINAL)
147 puts("The amulet won't work in here.");
148 else if (wordvalue[wordnumber] == COMPASS && testbit(inven,COMPASS))
149 printf("Your compass points %s.\n",truedirec(NORTH,'-'));
150 else if (wordvalue[wordnumber] == COMPASS)
151 puts("You aren't holding the compass.");
152 else if (wordvalue[wordnumber] == AMULET)
153 puts("You aren't holding the amulet.");
154 else
155 puts("There is no apparent use.");
156 return(-1);
157 }
158
159 murder()
160 {
161 register int n;
162
163 for (n=0; !((n == SWORD || n == KNIFE || n == TWO_HANDED || n == MACE || n == CLEAVER || n == BROAD || n == CHAIN || n == SHOVEL || n == HALBERD) && testbit(inven,n)) && n < NUMOFOBJECTS; n++);
164 if (n == NUMOFOBJECTS)
165 puts("You don't have suitable weapons to kill.");
166 else {
167 printf("Your %s should do the trick.\n",objsht[n]);
168 while (wordtype[++wordnumber] == ADJS);
169 switch(wordvalue[wordnumber]){
170
171 case NORMGOD:
172 if (testbit(location[position].objects,BATHGOD)){
173 puts("The goddess's head slices off. Her corpse floats in the water.");
174 clearbit(location[position].objects,BATHGOD);
175 setbit(location[position].objects,DEADGOD);
176 power += 5;
177 notes[JINXED]++;
178 } else if (testbit(location[position].objects,NORMGOD)){
179 puts("The goddess pleads but you strike her mercilessly. Her broken body lies in a\npool of blood.");
180 clearbit(location[position].objects,NORMGOD);
181 setbit(location[position].objects,DEADGOD);
182 power += 5;
183 notes[JINXED]++;
184 if (wintime)
185 live();
186 } else puts("I dont see her anywhere.");
187 break;
188 case TIMER:
189 if (testbit(location[position].objects,TIMER)){
190 puts("The old man offers no resistance.");
191 clearbit(location[position].objects,TIMER);
192 setbit(location[position].objects,DEADTIME);
193 power++;
194 notes[JINXED]++;
195 } else puts("Who?");
196 break;
197 case NATIVE:
198 if (testbit(location[position].objects,NATIVE)){
199 puts("The girl screams as you cut her body to shreds. She is dead.");
200 clearbit(location[position].objects,NATIVE);
201 setbit(location[position].objects,DEADNATIVE);
202 power += 5;
203 notes[JINXED]++;
204 } else puts("What girl?");
205 break;
206 case MAN:
207 if (testbit(location[position].objects,MAN)){
208 puts("You strike him to the ground, and he coughs up blood.");
209 puts("Your fantasy is over.");
210 die();
211 }
212 case -1:
213 puts("Kill what?");
214 break;
215
216 default:
217 if (wordtype[wordnumber] != NOUNS)
218 puts("Kill what?");
219 else
220 printf("You can't kill the %s!\n",objsht[wordvalue[wordnumber]]);
221 }
222 }
223 }
224
225 ravage()
226 {
227 while (wordtype[++wordnumber] != NOUNS && wordnumber <= wordcount);
228 if (wordtype[wordnumber] == NOUNS && testbit(location[position].objects,wordvalue[wordnumber])){
229 time++;
230 switch(wordvalue[wordnumber]){
231 case NORMGOD:
232 puts("You attack the goddess, and she screams as you beat her. She falls down");
233 puts("crying and tries to hold her torn and bloodied dress around her.");
234 power += 5;
235 pleasure += 8;
236 ego -= 10;
237 wordnumber--;
238 godready = -30000;
239 murder();
240 win = -30000;
241 break;
242 case NATIVE:
243 puts("The girl tries to run, but you catch her and throw her down. Her face is");
244 puts("bleeding, and she screams as you tear off her clothes.");
245 power += 3;
246 pleasure += 5;
247 ego -= 10;
248 wordnumber--;
249 murder();
250 if (rnd(100) < 50){
251 puts("Her screams have attracted attention. I think we are surrounded.");
252 setbit(location[ahead].objects,WOODSMAN);
253 setbit(location[ahead].objects,DEADWOOD);
254 setbit(location[ahead].objects,MALLET);
255 setbit(location[back].objects,WOODSMAN);
256 setbit(location[back].objects,DEADWOOD);
257 setbit(location[back].objects,MALLET);
258 setbit(location[left].objects,WOODSMAN);
259 setbit(location[left].objects,DEADWOOD);
260 setbit(location[left].objects,MALLET);
261 setbit(location[right].objects,WOODSMAN);
262 setbit(location[right].objects,DEADWOOD);
263 setbit(location[right].objects,MALLET);
264 }
265 break;
266 default:
267 puts("You are perverted.");
268 }
269 }
270 else
271 puts("Who?");
272 }
273
274 follow()
275 {
276 if (followfight == time){
277 puts("The Dark Lord leaps away and runs down secret tunnels and corridoors.");
278 puts("You chase him through the darkness and splash in pools of water.");
279 puts("You have cornered him. His laser sword extends as he steps forward.");
280 position = FINAL;
281 fight(DARK,75);
282 setbit(location[position].objects,TALISMAN);
283 setbit(location[position].objects,AMULET);
284 return(0);
285 }
286 else if (followgod == time){
287 puts("The goddess leads you down a steamy tunnel and into a high, wide chamber.");
288 puts("She sits down on a throne.");
289 position = 268;
290 setbit(location[position].objects,NORMGOD);
291 notes[CANTSEE] = 1;
292 return(0);
293 }
294 else
295 puts("There is no one to follow.");
296 return(-1);
297 }