1 /* @(#)com2.c 8.2 (Berkeley) 4/28/95 */
2 /* $NetBSD: command2.c,v 1.4 2019/02/03 03:19:25 mrg Exp $ */
5 * Copyright (c) 1983, 1993
6 * The Regents of the University of California. All rights reserved.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. Neither the name of the University nor the names of its contributors
17 * may be used to endorse or promote products derived from this software
18 * without specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 { /* synonyms = {sheathe, sheath} */
38 int firstnumber, value;
40 firstnumber = wordnumber;
42 while (wordnumber <= wordcount && (wordtype[wordnumber] == OBJECT ||
43 wordtype[wordnumber] == NOUNS) && wordvalue[wordnumber] != DOOR) {
44 value = wordvalue[wordnumber];
45 if (value >= 0 && objsht[value] == NULL)
54 printf("You can't wear %s%s!\n",
55 A_OR_AN_OR_BLANK(value), objsht[value]);
61 case LEVIS: /* wearable things */
77 if (testbit(inven, value)) {
78 clearbit(inven, value);
80 carrying -= objwt[value];
81 encumber -= objcumber[value];
83 printf("You are now wearing %s%s.\n",
84 A_OR_AN_OR_THE(value), objsht[value]);
86 if (testbit(wear, value)) {
87 printf("You are already wearing the %s",
91 printf("You aren't holding the %s.\n",
93 if (wordnumber < wordcount - 1 &&
94 wordvalue[++wordnumber] == AND)
100 puts("Don't be ridiculous.");
101 return (firstnumber);
106 { /* synonyms = {buckle, strap, tie} */
107 if (wordvalue[wordnumber + 1] == ON) {
108 wordvalue[++wordnumber] = PUTON;
109 wordtype[wordnumber] = VERB;
112 if (wordvalue[wordnumber + 1] == DOWN) {
113 wordvalue[++wordnumber] = DROP;
114 wordtype[wordnumber] = VERB;
117 puts("I don't understand what you want to put.");
124 { /* synonyms = {pull, carry} */
132 if (wordvalue[wordnumber] == AMULET && testbit(inven, AMULET) &&
134 puts("The amulet begins to glow.");
135 if (testbit(inven, MEDALION)) {
136 puts("The medallion comes to life too.");
137 if (position == 114) {
138 location[position].down = 160;
139 whichway(location[position]);
140 printf("The waves subside and it is possible ");
141 puts("to descend to the sea cave now.");
146 printf("A light mist falls over your eyes and the sound of ");
147 puts("purling water trickles in");
148 printf("your ears. When the mist lifts you are standing ");
149 puts("beside a cool stream.");
157 } else if (position == FINAL)
158 puts("The amulet won't work in here.");
159 else if (wordvalue[wordnumber] == COMPASS && testbit(inven, COMPASS))
160 printf("Your compass points %s.\n", truedirec(NORTH, '-'));
161 else if (wordvalue[wordnumber] == COMPASS)
162 puts("You aren't holding the compass.");
163 else if (wordvalue[wordnumber] == AMULET)
164 puts("You aren't holding the amulet.");
166 puts("There is no apparent use.");
176 !((n == SWORD || n == KNIFE || n == TWO_HANDED || n == MACE ||
177 n == CLEAVER || n == BROAD || n == CHAIN || n == SHOVEL ||
178 n == HALBERD) && testbit(inven, n)) && n < NUMOFOBJECTS;
180 if (n == NUMOFOBJECTS) {
181 if (testbit(inven, LASER)) {
182 printf("Your laser should do the trick.\n");
184 switch(wordvalue[wordnumber]) {
189 wordvalue[--wordnumber] = SHOOT;
196 if (wordtype[wordnumber] != OBJECT ||
197 wordvalue[wordnumber] == EVERYTHING)
198 puts("You can't kill that!");
200 printf("You can't kill %s%s!\n",
201 A_OR_AN_OR_BLANK(wordvalue[wordnumber]),
202 objsht[wordvalue[wordnumber]]);
206 puts("You don't have suitable weapons to kill.");
208 printf("Your %s should do the trick.\n", objsht[n]);
210 switch (wordvalue[wordnumber]) {
213 if (testbit(location[position].objects, BATHGOD)) {
214 printf("The goddess's head slices off. Her ");
215 puts("corpse floats in the water.");
216 clearbit(location[position].objects, BATHGOD);
217 setbit(location[position].objects, DEADGOD);
221 if (testbit(location[position].objects,
223 printf("The goddess pleads but you ");
224 printf("strike her mercilessly. Her ");
225 printf("broken body lies in a\n");
226 puts("pool of blood.");
227 clearbit(location[position].objects,
229 setbit(location[position].objects,
236 puts("I don't see her anywhere.");
239 if (testbit(location[position].objects, TIMER)) {
240 puts("The old man offers no resistance.");
241 clearbit(location[position].objects, TIMER);
242 setbit(location[position].objects, DEADTIME);
249 if (testbit(location[position].objects, NATIVE)) {
250 printf("The girl screams as you cut her ");
251 puts("body to shreds. She is dead.");
252 clearbit(location[position].objects, NATIVE);
253 setbit(location[position].objects, DEADNATIVE);
260 if (testbit(location[position].objects, MAN)) {
261 printf("You strike him to the ground, and ");
262 puts("he coughs up blood.");
263 puts("Your fantasy is over.");
272 if (wordtype[wordnumber] != OBJECT ||
273 wordvalue[wordnumber] == EVERYTHING)
274 puts("You can't kill that!");
276 printf("You can't kill the %s!\n",
277 objsht[wordvalue[wordnumber]]);
285 while (wordtype[++wordnumber] != NOUNS && wordnumber <= wordcount)
287 if (wordtype[wordnumber] == NOUNS &&
288 (testbit(location[position].objects, wordvalue[wordnumber])
289 || (wordvalue[wordnumber] == NORMGOD &&
290 testbit(location[position].objects, BATHGOD)))) {
292 switch (wordvalue[wordnumber]) {
294 printf("You attack the goddess, and she screams as ");
295 puts("you beat her. She falls down");
296 if (testbit(location[position].objects, BATHGOD)) {
297 printf("crying and tries to cover her ");
300 printf("crying and tries to hold her torn ");
301 puts("and bloodied dress around her.");
312 printf("The girl tries to run, but you catch her and ");
313 puts("throw her down. Her face is");
314 printf("bleeding, and she screams as you tear off ");
315 puts("her clothes.");
322 printf("Her screams have attracted ");
323 puts("attention. I think we are surrounded.");
324 setbit(location[ahead].objects, WOODSMAN);
325 setbit(location[ahead].objects, DEADWOOD);
326 setbit(location[ahead].objects, MALLET);
327 setbit(location[back].objects, WOODSMAN);
328 setbit(location[back].objects, DEADWOOD);
329 setbit(location[back].objects, MALLET);
330 setbit(location[left].objects, WOODSMAN);
331 setbit(location[left].objects, DEADWOOD);
332 setbit(location[left].objects, MALLET);
333 setbit(location[right].objects, WOODSMAN);
334 setbit(location[right].objects, DEADWOOD);
335 setbit(location[right].objects, MALLET);
339 puts("You are perverted.");
348 if (followfight == ourtime) {
349 printf("The Dark Lord leaps away and runs down secret ");
350 puts("tunnels and corridors.");
351 printf("You chase him through the darkness and splash in ");
352 puts("pools of water.");
353 printf("You have cornered him. His laser sword extends ");
354 puts("as he steps forward.");
357 setbit(location[position].objects, TALISMAN);
358 setbit(location[position].objects, AMULET);
361 if (followgod == ourtime) {
362 printf("The goddess leads you down a steamy tunnel ");
363 puts("and into a high, wide chamber.");
364 puts("She sits down on a throne.");
366 setbit(location[position].objects, NORMGOD);
370 puts("There is no one to follow.");