]>
git.cameronkatri.com Git - bsdgames-darwin.git/blob - battlestar/com2.c
1 /* $NetBSD: com2.c,v 1.9 2000/09/10 10:51:16 jsm 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. All advertising materials mentioning features or use of this software
16 * must display the following acknowledgement:
17 * This product includes software developed by the University of
18 * California, Berkeley and its contributors.
19 * 4. Neither the name of the University nor the names of its contributors
20 * may be used to endorse or promote products derived from this software
21 * without specific prior written permission.
23 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 #include <sys/cdefs.h>
39 static char sccsid
[] = "@(#)com2.c 8.2 (Berkeley) 4/28/95" ;
41 __RCSID ( "$NetBSD: com2.c,v 1.9 2000/09/10 10:51:16 jsm Exp $" );
49 { /* synonyms = {sheathe, sheath} */
51 int firstnumber
, value
;
53 firstnumber
= wordnumber
;
54 while ( wordtype
[++ wordnumber
] == ADJS
);
55 while ( wordnumber
<= wordcount
) {
56 value
= wordvalue
[ wordnumber
];
57 for ( n
= 0 ; objsht
[ value
][ n
]; n
++);
65 printf ( "You can't wear %s%s ! \n " , ( objsht
[ value
][ n
- 1 ] == 's' ? " " : " a " ), objsht
[ value
]);
71 case LEVIS
: /* wearable things */
87 if ( testbit ( inven
, value
)) {
88 clearbit ( inven
, value
);
90 carrying
-= objwt
[ value
];
91 encumber
-= objcumber
[ value
];
93 printf ( "You are now wearing %s %s . \n " ,
94 ( objsht
[ value
][ n
- 1 ] == 's' ? "the"
95 : "a" ), objsht
[ value
]);
97 if ( testbit ( wear
, value
))
98 printf ( "You are already wearing the %s . \n " ,
101 printf ( "You aren't holding the %s . \n " ,
103 if ( wordnumber
< wordcount
- 1 &&
104 wordvalue
[++ wordnumber
] == AND
)
107 return ( firstnumber
);
110 puts ( "Don't be ridiculous." );
111 return ( firstnumber
);
116 { /* synonyms = {buckle, strap, tie} */
117 if ( wordvalue
[ wordnumber
+ 1 ] == ON
) {
118 wordvalue
[++ wordnumber
] = PUTON
;
121 if ( wordvalue
[ wordnumber
+ 1 ] == DOWN
) {
122 wordvalue
[++ wordnumber
] = DROP
;
125 puts ( "I don't understand what you want to put." );
132 { /* synonyms = {pull, carry} */
139 while ( wordtype
[++ wordnumber
] == ADJS
&& wordnumber
< wordcount
);
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 puts ( "The waves subside and it is possible to descend to the sea cave now." );
153 puts ( "A light mist falls over your eyes and the sound of purling water trickles in" );
154 puts ( "your ears. When the mist lifts you are standing beside a cool stream." );
163 if ( position
== FINAL
)
164 puts ( "The amulet won't work in here." );
166 if ( wordvalue
[ wordnumber
] == COMPASS
&& testbit ( inven
, COMPASS
))
167 printf ( "Your compass points %s . \n " , truedirec ( NORTH
, '-' ));
169 if ( wordvalue
[ wordnumber
] == COMPASS
)
170 puts ( "You aren't holding the compass." );
172 if ( wordvalue
[ wordnumber
] == AMULET
)
173 puts ( "You aren't holding the amulet." );
175 puts ( "There is no apparent use." );
184 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
++);
185 if ( n
== NUMOFOBJECTS
)
186 puts ( "You don't have suitable weapons to kill." );
188 printf ( "Your %s should do the trick. \n " , objsht
[ n
]);
189 while ( wordtype
[++ wordnumber
] == ADJS
);
190 switch ( wordvalue
[ wordnumber
]) {
193 if ( testbit ( location
[ position
]. objects
, BATHGOD
)) {
194 puts ( "The goddess's head slices off. Her corpse floats in the water." );
195 clearbit ( location
[ position
]. objects
, BATHGOD
);
196 setbit ( location
[ position
]. objects
, DEADGOD
);
200 if ( testbit ( location
[ position
]. objects
, NORMGOD
)) {
201 puts ( "The goddess pleads but you strike her mercilessly. Her broken body lies in a \n pool of blood." );
202 clearbit ( location
[ position
]. objects
, NORMGOD
);
203 setbit ( location
[ position
]. objects
, DEADGOD
);
209 puts ( "I dont see her anywhere." );
212 if ( testbit ( location
[ position
]. objects
, TIMER
)) {
213 puts ( "The old man offers no resistance." );
214 clearbit ( location
[ position
]. objects
, TIMER
);
215 setbit ( location
[ position
]. objects
, DEADTIME
);
222 if ( testbit ( location
[ position
]. objects
, NATIVE
)) {
223 puts ( "The girl screams as you cut her body to shreds. She is dead." );
224 clearbit ( location
[ position
]. objects
, NATIVE
);
225 setbit ( location
[ position
]. objects
, DEADNATIVE
);
232 if ( testbit ( location
[ position
]. objects
, MAN
)) {
233 puts ( "You strike him to the ground, and he coughs up blood." );
234 puts ( "Your fantasy is over." );
242 if ( wordtype
[ wordnumber
] != OBJECT
)
243 puts ( "You can't kill that!" );
245 printf ( "You can't kill the %s ! \n " ,
246 objsht
[ wordvalue
[ wordnumber
]]);
254 while ( wordtype
[++ wordnumber
] != NOUNS
&& wordnumber
<= wordcount
);
255 if ( wordtype
[ wordnumber
] == NOUNS
&& testbit ( location
[ position
]. objects
, wordvalue
[ wordnumber
])) {
257 switch ( wordvalue
[ wordnumber
]) {
259 puts ( "You attack the goddess, and she screams as you beat her. She falls down" );
260 puts ( "crying and tries to hold her torn and bloodied dress around her." );
270 puts ( "The girl tries to run, but you catch her and throw her down. Her face is" );
271 puts ( "bleeding, and she screams as you tear off her clothes." );
278 puts ( "Her screams have attracted attention. I think we are surrounded." );
279 setbit ( location
[ ahead
]. objects
, WOODSMAN
);
280 setbit ( location
[ ahead
]. objects
, DEADWOOD
);
281 setbit ( location
[ ahead
]. objects
, MALLET
);
282 setbit ( location
[ back
]. objects
, WOODSMAN
);
283 setbit ( location
[ back
]. objects
, DEADWOOD
);
284 setbit ( location
[ back
]. objects
, MALLET
);
285 setbit ( location
[ left
]. objects
, WOODSMAN
);
286 setbit ( location
[ left
]. objects
, DEADWOOD
);
287 setbit ( location
[ left
]. objects
, MALLET
);
288 setbit ( location
[ right
]. objects
, WOODSMAN
);
289 setbit ( location
[ right
]. objects
, DEADWOOD
);
290 setbit ( location
[ right
]. objects
, MALLET
);
294 puts ( "You are perverted." );
303 if ( followfight
== ourtime
) {
304 puts ( "The Dark Lord leaps away and runs down secret tunnels and corridors." );
305 puts ( "You chase him through the darkness and splash in pools of water." );
306 puts ( "You have cornered him. His laser sword extends as he steps forward." );
309 setbit ( location
[ position
]. objects
, TALISMAN
);
310 setbit ( location
[ position
]. objects
, AMULET
);
313 if ( followgod
== ourtime
) {
314 puts ( "The goddess leads you down a steamy tunnel and into a high, wide chamber." );
315 puts ( "She sits down on a throne." );
317 setbit ( location
[ position
]. objects
, NORMGOD
);
321 puts ( "There is no one to follow." );