]>
git.cameronkatri.com Git - bsdgames-darwin.git/blob - battlestar/command2.c
1 /* $NetBSD: command2.c,v 1.2 2003/08/07 09:37:00 agc 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.2 2003/08/07 09:37:00 agc 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 . \n " ,
98 printf ( "You aren't holding the %s . \n " ,
100 if ( wordnumber
< wordcount
- 1 &&
101 wordvalue
[++ wordnumber
] == AND
)
104 return ( firstnumber
);
107 puts ( "Don't be ridiculous." );
108 return ( firstnumber
);
113 { /* synonyms = {buckle, strap, tie} */
114 if ( wordvalue
[ wordnumber
+ 1 ] == ON
) {
115 wordvalue
[++ wordnumber
] = PUTON
;
116 wordtype
[ wordnumber
] = VERB
;
119 if ( wordvalue
[ wordnumber
+ 1 ] == DOWN
) {
120 wordvalue
[++ wordnumber
] = DROP
;
121 wordtype
[ wordnumber
] = VERB
;
124 puts ( "I don't understand what you want to put." );
131 { /* synonyms = {pull, carry} */
139 if ( wordvalue
[ wordnumber
] == AMULET
&& testbit ( inven
, AMULET
) &&
141 puts ( "The amulet begins to glow." );
142 if ( testbit ( inven
, MEDALION
)) {
143 puts ( "The medallion comes to life too." );
144 if ( position
== 114 ) {
145 location
[ position
]. down
= 160 ;
146 whichway ( location
[ position
]);
147 puts ( "The waves subside and it is possible to descend to the sea cave now." );
152 puts ( "A light mist falls over your eyes and the sound of purling water trickles in" );
153 puts ( "your ears. When the mist lifts you are standing beside a cool stream." );
161 } else if ( position
== FINAL
)
162 puts ( "The amulet won't work in here." );
163 else if ( wordvalue
[ wordnumber
] == COMPASS
&& testbit ( inven
, COMPASS
))
164 printf ( "Your compass points %s . \n " , truedirec ( NORTH
, '-' ));
165 else if ( wordvalue
[ wordnumber
] == COMPASS
)
166 puts ( "You aren't holding the compass." );
167 else if ( wordvalue
[ wordnumber
] == AMULET
)
168 puts ( "You aren't holding the amulet." );
170 puts ( "There is no apparent use." );
179 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
++);
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 puts ( "The goddess's head slices off. Her corpse floats in the water." );
215 clearbit ( location
[ position
]. objects
, BATHGOD
);
216 setbit ( location
[ position
]. objects
, DEADGOD
);
220 if ( testbit ( location
[ position
]. objects
, NORMGOD
)) {
221 puts ( "The goddess pleads but you strike her mercilessly. Her broken body lies in a \n pool of blood." );
222 clearbit ( location
[ position
]. objects
, NORMGOD
);
223 setbit ( location
[ position
]. objects
, DEADGOD
);
229 puts ( "I don't see her anywhere." );
232 if ( testbit ( location
[ position
]. objects
, TIMER
)) {
233 puts ( "The old man offers no resistance." );
234 clearbit ( location
[ position
]. objects
, TIMER
);
235 setbit ( location
[ position
]. objects
, DEADTIME
);
242 if ( testbit ( location
[ position
]. objects
, NATIVE
)) {
243 puts ( "The girl screams as you cut her body to shreds. She is dead." );
244 clearbit ( location
[ position
]. objects
, NATIVE
);
245 setbit ( location
[ position
]. objects
, DEADNATIVE
);
252 if ( testbit ( location
[ position
]. objects
, MAN
)) {
253 puts ( "You strike him to the ground, and he coughs up blood." );
254 puts ( "Your fantasy is over." );
262 if ( wordtype
[ wordnumber
] != OBJECT
||
263 wordvalue
[ wordnumber
] == EVERYTHING
)
264 puts ( "You can't kill that!" );
266 printf ( "You can't kill the %s ! \n " ,
267 objsht
[ wordvalue
[ wordnumber
]]);
275 while ( wordtype
[++ wordnumber
] != NOUNS
&& wordnumber
<= wordcount
)
277 if ( wordtype
[ wordnumber
] == NOUNS
&& ( testbit ( location
[ position
]. objects
, wordvalue
[ wordnumber
])
278 || ( wordvalue
[ wordnumber
] == NORMGOD
&& testbit ( location
[ position
]. objects
, BATHGOD
)))) {
280 switch ( wordvalue
[ wordnumber
]) {
282 puts ( "You attack the goddess, and she screams as you beat her. She falls down" );
283 if ( testbit ( location
[ position
]. objects
, BATHGOD
))
284 puts ( "crying and tries to cover her nakedness." );
286 puts ( "crying and tries to hold her torn and bloodied dress around her." );
296 puts ( "The girl tries to run, but you catch her and throw her down. Her face is" );
297 puts ( "bleeding, and she screams as you tear off her clothes." );
304 puts ( "Her screams have attracted attention. I think we are surrounded." );
305 setbit ( location
[ ahead
]. objects
, WOODSMAN
);
306 setbit ( location
[ ahead
]. objects
, DEADWOOD
);
307 setbit ( location
[ ahead
]. objects
, MALLET
);
308 setbit ( location
[ back
]. objects
, WOODSMAN
);
309 setbit ( location
[ back
]. objects
, DEADWOOD
);
310 setbit ( location
[ back
]. objects
, MALLET
);
311 setbit ( location
[ left
]. objects
, WOODSMAN
);
312 setbit ( location
[ left
]. objects
, DEADWOOD
);
313 setbit ( location
[ left
]. objects
, MALLET
);
314 setbit ( location
[ right
]. objects
, WOODSMAN
);
315 setbit ( location
[ right
]. objects
, DEADWOOD
);
316 setbit ( location
[ right
]. objects
, MALLET
);
320 puts ( "You are perverted." );
329 if ( followfight
== ourtime
) {
330 puts ( "The Dark Lord leaps away and runs down secret tunnels and corridors." );
331 puts ( "You chase him through the darkness and splash in pools of water." );
332 puts ( "You have cornered him. His laser sword extends as he steps forward." );
335 setbit ( location
[ position
]. objects
, TALISMAN
);
336 setbit ( location
[ position
]. objects
, AMULET
);
339 if ( followgod
== ourtime
) {
340 puts ( "The goddess leads you down a steamy tunnel and into a high, wide chamber." );
341 puts ( "She sits down on a throne." );
343 setbit ( location
[ position
]. objects
, NORMGOD
);
347 puts ( "There is no one to follow." );