]>
git.cameronkatri.com Git - bsdgames-darwin.git/blob - battlestar/command2.c
1 /* $NetBSD: command2.c,v 1.5 2021/05/02 12:50:43 rillig 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
[] = "@(#)com2.c 8.2 (Berkeley) 4/28/95";
37 __RCSID("$NetBSD: command2.c,v 1.5 2021/05/02 12:50:43 rillig Exp $");
45 { /* synonyms = {sheathe, sheath} */
46 int firstnumber
, value
;
48 firstnumber
= wordnumber
;
50 while (wordnumber
<= wordcount
&& (wordtype
[wordnumber
] == OBJECT
||
51 wordtype
[wordnumber
] == NOUNS
) && wordvalue
[wordnumber
] != DOOR
) {
52 value
= wordvalue
[wordnumber
];
53 if (value
>= 0 && objsht
[value
] == NULL
)
62 printf("You can't wear %s%s!\n",
63 A_OR_AN_OR_BLANK(value
), objsht
[value
]);
69 case LEVIS
: /* wearable things */
85 if (testbit(inven
, value
)) {
86 clearbit(inven
, value
);
88 carrying
-= objwt
[value
];
89 encumber
-= objcumber
[value
];
91 printf("You are now wearing %s%s.\n",
92 A_OR_AN_OR_THE(value
), objsht
[value
]);
94 if (testbit(wear
, value
)) {
95 printf("You are already wearing the %s",
99 printf("You aren't holding the %s.\n",
101 if (wordnumber
< wordcount
- 1 &&
102 wordvalue
[++wordnumber
] == AND
)
105 return (firstnumber
);
108 puts("Don't be ridiculous.");
109 return (firstnumber
);
114 { /* synonyms = {buckle, strap, tie} */
115 if (wordvalue
[wordnumber
+ 1] == ON
) {
116 wordvalue
[++wordnumber
] = PUTON
;
117 wordtype
[wordnumber
] = VERB
;
120 if (wordvalue
[wordnumber
+ 1] == DOWN
) {
121 wordvalue
[++wordnumber
] = DROP
;
122 wordtype
[wordnumber
] = VERB
;
125 puts("I don't understand what you want to put.");
132 { /* synonyms = {pull, carry} */
140 if (wordvalue
[wordnumber
] == AMULET
&& testbit(inven
, AMULET
) &&
142 puts("The amulet begins to glow.");
143 if (testbit(inven
, MEDALION
)) {
144 puts("The medallion comes to life too.");
145 if (position
== 114) {
146 location
[position
].down
= 160;
147 whichway(location
[position
]);
148 printf("The waves subside and it is possible ");
149 puts("to descend to the sea cave now.");
154 printf("A light mist falls over your eyes and the sound of ");
155 puts("purling water trickles in");
156 printf("your ears. When the mist lifts you are standing ");
157 puts("beside a cool stream.");
165 } else if (position
== FINAL
)
166 puts("The amulet won't work in here.");
167 else if (wordvalue
[wordnumber
] == COMPASS
&& testbit(inven
, COMPASS
))
168 printf("Your compass points %s.\n", truedirec(NORTH
, '-'));
169 else if (wordvalue
[wordnumber
] == COMPASS
)
170 puts("You aren't holding the compass.");
171 else if (wordvalue
[wordnumber
] == AMULET
)
172 puts("You aren't holding the amulet.");
174 puts("There is no apparent use.");
184 !((n
== SWORD
|| n
== KNIFE
|| n
== TWO_HANDED
|| n
== MACE
||
185 n
== CLEAVER
|| n
== BROAD
|| n
== CHAIN
|| n
== SHOVEL
||
186 n
== HALBERD
) && testbit(inven
, n
)) && n
< NUMOFOBJECTS
;
188 if (n
== NUMOFOBJECTS
) {
189 if (testbit(inven
, LASER
)) {
190 printf("Your laser should do the trick.\n");
192 switch(wordvalue
[wordnumber
]) {
197 wordvalue
[--wordnumber
] = SHOOT
;
204 if (wordtype
[wordnumber
] != OBJECT
||
205 wordvalue
[wordnumber
] == EVERYTHING
)
206 puts("You can't kill that!");
208 printf("You can't kill %s%s!\n",
209 A_OR_AN_OR_BLANK(wordvalue
[wordnumber
]),
210 objsht
[wordvalue
[wordnumber
]]);
214 puts("You don't have suitable weapons to kill.");
216 printf("Your %s should do the trick.\n", objsht
[n
]);
218 switch (wordvalue
[wordnumber
]) {
221 if (testbit(location
[position
].objects
, BATHGOD
)) {
222 printf("The goddess's head slices off. Her ");
223 puts("corpse floats in the water.");
224 clearbit(location
[position
].objects
, BATHGOD
);
225 setbit(location
[position
].objects
, DEADGOD
);
229 if (testbit(location
[position
].objects
,
231 printf("The goddess pleads but you ");
232 printf("strike her mercilessly. Her ");
233 printf("broken body lies in a\n");
234 puts("pool of blood.");
235 clearbit(location
[position
].objects
,
237 setbit(location
[position
].objects
,
244 puts("I don't see her anywhere.");
247 if (testbit(location
[position
].objects
, TIMER
)) {
248 puts("The old man offers no resistance.");
249 clearbit(location
[position
].objects
, TIMER
);
250 setbit(location
[position
].objects
, DEADTIME
);
257 if (testbit(location
[position
].objects
, NATIVE
)) {
258 printf("The girl screams as you cut her ");
259 puts("body to shreds. She is dead.");
260 clearbit(location
[position
].objects
, NATIVE
);
261 setbit(location
[position
].objects
, DEADNATIVE
);
268 if (testbit(location
[position
].objects
, MAN
)) {
269 printf("You strike him to the ground, and ");
270 puts("he coughs up blood.");
271 puts("Your fantasy is over.");
280 if (wordtype
[wordnumber
] != OBJECT
||
281 wordvalue
[wordnumber
] == EVERYTHING
)
282 puts("You can't kill that!");
284 printf("You can't kill the %s!\n",
285 objsht
[wordvalue
[wordnumber
]]);
293 while (wordtype
[++wordnumber
] != NOUNS
&& wordnumber
<= wordcount
)
295 if (wordtype
[wordnumber
] == NOUNS
&&
296 (testbit(location
[position
].objects
, wordvalue
[wordnumber
])
297 || (wordvalue
[wordnumber
] == NORMGOD
&&
298 testbit(location
[position
].objects
, BATHGOD
)))) {
300 switch (wordvalue
[wordnumber
]) {
302 printf("You attack the goddess, and she screams as ");
303 puts("you beat her. She falls down");
304 if (testbit(location
[position
].objects
, BATHGOD
)) {
305 printf("crying and tries to cover her ");
308 printf("crying and tries to hold her torn ");
309 puts("and bloodied dress around her.");
320 printf("The girl tries to run, but you catch her and ");
321 puts("throw her down. Her face is");
322 printf("bleeding, and she screams as you tear off ");
323 puts("her clothes.");
330 printf("Her screams have attracted ");
331 puts("attention. I think we are surrounded.");
332 setbit(location
[ahead
].objects
, WOODSMAN
);
333 setbit(location
[ahead
].objects
, DEADWOOD
);
334 setbit(location
[ahead
].objects
, MALLET
);
335 setbit(location
[back
].objects
, WOODSMAN
);
336 setbit(location
[back
].objects
, DEADWOOD
);
337 setbit(location
[back
].objects
, MALLET
);
338 setbit(location
[left
].objects
, WOODSMAN
);
339 setbit(location
[left
].objects
, DEADWOOD
);
340 setbit(location
[left
].objects
, MALLET
);
341 setbit(location
[right
].objects
, WOODSMAN
);
342 setbit(location
[right
].objects
, DEADWOOD
);
343 setbit(location
[right
].objects
, MALLET
);
347 puts("You are perverted.");
356 if (followfight
== ourtime
) {
357 printf("The Dark Lord leaps away and runs down secret ");
358 puts("tunnels and corridors.");
359 printf("You chase him through the darkness and splash in ");
360 puts("pools of water.");
361 printf("You have cornered him. His laser sword extends ");
362 puts("as he steps forward.");
365 setbit(location
[position
].objects
, TALISMAN
);
366 setbit(location
[position
].objects
, AMULET
);
369 if (followgod
== ourtime
) {
370 printf("The goddess leads you down a steamy tunnel ");
371 puts("and into a high, wide chamber.");
372 puts("She sits down on a throne.");
374 setbit(location
[position
].objects
, NORMGOD
);
378 puts("There is no one to follow.");