]>
git.cameronkatri.com Git - bsdgames-darwin.git/blob - battlestar/command5.c
1 /* $NetBSD: command5.c,v 1.1 2001/10/19 03:06:11 tv 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
[] = "@(#)com5.c 8.2 (Berkeley) 4/28/95" ;
41 __RCSID ( "$NetBSD: command5.c,v 1.1 2001/10/19 03:06:11 tv Exp $" );
50 while ( wordtype
[++ wordnumber
] != NOUNS
&& wordnumber
<= wordcount
)
52 /* The goddess must be "taken" first if bathing. */
53 if ( wordtype
[ wordnumber
] == NOUNS
&& wordvalue
[ wordnumber
] == NORMGOD
54 && testbit ( location
[ position
]. objects
, BATHGOD
)) {
55 wordvalue
[-- wordnumber
] = TAKE
;
59 if ( wordtype
[ wordnumber
] == NOUNS
) {
60 if ( testbit ( location
[ position
]. objects
, wordvalue
[ wordnumber
])) {
63 switch ( wordvalue
[ wordnumber
]) {
67 puts ( "She squirms and avoids your advances." );
70 puts ( "She is coming around; she didn't fight it as much." );
73 puts ( "She's beginning to like it." );
76 puts ( "She's gone limp." );
81 puts ( "Her lips are warm and her body robust. She pulls you down to the ground." );
84 puts ( "The old man blushes." );
87 puts ( "The dwarf punches you in the kneecap." );
93 puts ( "I see nothing like that here." );
95 puts ( "I'd prefer not to." );
103 while ( wordtype
[++ wordnumber
] != NOUNS
&& wordnumber
<= wordcount
)
105 if ( wordtype
[ wordnumber
] == NOUNS
) {
106 if (( testbit ( location
[ position
]. objects
, BATHGOD
) ||
107 testbit ( location
[ position
]. objects
, NORMGOD
)) &&
108 wordvalue
[ wordnumber
] == NORMGOD
) {
114 puts ( "She cuddles up to you, and her mouth starts to work: \n 'That was my sister's amulet. The lovely goddess, Purl, was she. The Empire \n captured her just after the Darkness came. My other sister, Vert, was killed \n by the Dark Lord himself. He took her amulet and warped its power. \n Your quest was foretold by my father before he died, but to get the Dark Lord's \n amulet you must use cunning and skill. I will leave you my amulet," );
115 puts ( "which you may use as you wish. As for me, I am the last goddess of the \n waters. My father was the Island King, and the rule is rightfully mine.' \n\n She pulls the throne out into a large bed." );
119 if ( card ( injuries
, NUMOFINJURIES
)) {
120 puts ( "Her kisses revive you; your wounds are healed. \n " );
121 for ( n
= 0 ; n
< NUMOFINJURIES
; n
++)
126 printf ( "Goddess: \n " );
128 setbit ( location
[ position
]. objects
, MEDALION
);
139 if ( testbit ( location
[ position
]. objects
, wordvalue
[ wordnumber
])) {
140 if ( wordvalue
[ wordnumber
] == NATIVE
) {
141 puts ( "The girl is easy prey. She peels off her sarong and indulges you." );
149 if ( wordvalue
[ wordnumber
] == MAN
||
150 wordvalue
[ wordnumber
] == BODY
||
151 wordvalue
[ wordnumber
] == ELF
||
152 wordvalue
[ wordnumber
] == TIMER
)
155 puts ( "It doesn't seem to work." );
157 puts ( "Where's your lover?" );
159 puts ( "It doesn't seem to work." );
169 if (( snooze
- ourtime
) < ( 0.75 * CYCLE
)) {
170 ourtime
+= 0.75 * CYCLE
- ( snooze
- ourtime
);
172 for ( n
= 0 ; n
< ourtime
- oldtime
; n
++)
175 snooze
+= 3 * ( ourtime
- oldtime
);
176 if ( notes
[ LAUNCHED
]) {
177 fuel
-= ( ourtime
- oldtime
);
178 if ( location
[ position
]. down
) {
179 position
= location
[ position
]. down
;
184 if ( OUTSIDE
&& rnd ( 100 ) < 50 ) {
185 puts ( "You are awakened abruptly by the sound of someone nearby." );
189 n
= rnd ( NUMOFOBJECTS
);
190 while (! testbit ( inven
, n
))
191 n
= rnd ( NUMOFOBJECTS
);
193 if ( n
!= AMULET
&& n
!= MEDALION
&& n
!= TALISMAN
)
194 setbit ( location
[ position
]. objects
, n
);
195 carrying
-= objwt
[ n
];
196 encumber
-= objcumber
[ n
];
198 puts ( "A fiendish little Elf is stealing your treasures!" );
202 setbit ( location
[ position
]. objects
, DEADWOOD
);
205 setbit ( location
[ position
]. objects
, HALBERD
);
219 if (( ourtime
/ CYCLE
+ 1 ) % 2 && OUTSIDE
)
220 switch (( ourtime
% CYCLE
) / ( CYCLE
/ 7 )) {
222 puts ( "It is just after sunrise." );
225 puts ( "It is early morning." );
228 puts ( "It is late morning." );
231 puts ( "It is near noon." );
234 puts ( "It is early afternoon." );
237 puts ( "It is late afternoon." );
240 puts ( "It is near sunset." );
244 switch (( ourtime
% CYCLE
) / ( CYCLE
/ 7 )) {
246 puts ( "It is just after sunset." );
249 puts ( "It is early evening." );
252 puts ( "The evening is getting old." );
255 puts ( "It is near midnight." );
258 puts ( "These are the wee hours of the morning." );
261 puts ( "The night is waning." );
264 puts ( "It is almost morning." );
268 puts ( "I can't tell the time in here." );
274 int obj
= - 1 , result
= - 1 , person
= 0 , firstnumber
, last1
, last2
;
277 firstnumber
= wordnumber
;
278 while ( wordtype
[++ wordnumber
] != OBJECT
&& wordvalue
[ wordnumber
] != AMULET
&& wordvalue
[ wordnumber
] != MEDALION
&& wordvalue
[ wordnumber
] != TALISMAN
&& wordnumber
<= wordcount
)
280 if ( wordnumber
<= wordcount
) {
281 obj
= wordvalue
[ wordnumber
];
282 if ( obj
== EVERYTHING
)
283 wordtype
[ wordnumber
] = - 1 ;
286 wordnumber
= firstnumber
;
287 while (( wordtype
[++ wordnumber
] != NOUNS
|| wordvalue
[ wordnumber
] == obj
) && wordnumber
<= wordcount
);
288 if ( wordtype
[ wordnumber
] == NOUNS
) {
289 person
= wordvalue
[ wordnumber
];
292 /* Setting wordnumber to last1 - 1 looks wrong if last1 is 0, e.g.,
293 * plain `give'. However, detecting this case is liable to detect
294 * `give foo' as well, which would give a confusing error. We
295 * need to make sure the -1 value can cause no problems if it arises.
296 * If in the below we get to the drop("Given") then drop will look
297 * at word 0 for an object to give, and fail, which is OK; then
298 * result will be -1 and we get to the end, where wordnumber gets
299 * set to something more sensible. If we get to "I don't think
300 * that is possible" then again wordnumber is set to something
301 * sensible. The wordnumber we leave with still isn't right if
302 * you include words the game doesn't know in your command, but
303 * that's no worse than what other commands than give do in
305 wordnumber
= last1
- 1 ;
306 if ( person
&& testbit ( location
[ position
]. objects
, person
)) {
307 if ( person
== NORMGOD
&& godready
< 2 && !( obj
== RING
|| obj
== BRACELET
))
308 puts ( "The goddess won't look at you." );
310 result
= drop ( "Given" );
312 puts ( "I don't think that is possible." );
313 wordnumber
= max ( last1
, last2
) + 1 ;
316 if ( result
!= - 1 && ( testbit ( location
[ position
]. objects
, obj
) || obj
== AMULET
|| obj
== MEDALION
|| obj
== TALISMAN
)) {
317 clearbit ( location
[ position
]. objects
, obj
);
322 puts ( "She accepts it shyly." );
326 if ( obj
== RING
|| obj
== BRACELET
) {
327 puts ( "She takes the charm and puts it on. A little kiss on the cheek is" );
328 puts ( "your reward." );
332 if ( obj
== AMULET
|| obj
== MEDALION
|| obj
== TALISMAN
) {
337 puts ( "The powers of the earth are now legitimate. You have destroyed the Darkness" );
338 puts ( "and restored the goddess to her throne. The entire island celebrates with" );
339 puts ( "dancing and spring feasts. As a measure of her gratitude, the goddess weds you" );
340 puts ( "in the late summer and crowns you Prince Liverwort, Lord of Fungus." );
341 puts ( " \n But, as the year wears on and autumn comes along, you become restless and" );
342 puts ( "yearn for adventure. The goddess, too, realizes that the marriage can't last." );
343 puts ( "She becomes bored and takes several more natives as husbands. One evening," );
344 puts ( "after having been out drinking with the girls, she kicks the throne particularly" );
345 puts ( "hard and wakes you up. (If you want to win this game, you're going to have to \n shoot her!)" );
346 clearbit ( location
[ position
]. objects
, MEDALION
);
353 puts ( "He fingers the coins for a moment and then looks up agape. `Kind you are and" );
354 puts ( "I mean to repay you as best I can.' Grabbing a pencil and cocktail napkin... \n " );
355 printf ( "+-----------------------------------------------------------------------------+ \n " );
356 printf ( "| xxxxxxxx \\ | \n " );
357 printf ( "| xxxxx \\ CLIFFS | \n " );
358 printf ( "| FOREST xxx \\ | \n " );
359 printf ( "| \\\\ x \\ OCEAN | \n " );
360 printf ( "| || x \\ | \n " );
361 printf ( "| || ROAD x \\ | \n " );
362 printf ( "| || x \\ | \n " );
363 printf ( "| SECRET || ......... | \n " );
364 printf ( "| - + - || ........ | \n " );
365 printf ( "| ENTRANCE || ... BEACH | \n " );
366 printf ( "| || ... E | \n " );
367 printf ( "| || ... | | \n " );
368 printf ( "| // ... N <-- + --- S | \n " );
369 printf ( "| PALM GROVE // ... | | \n " );
370 printf ( "| // ... W | \n " );
371 printf ( "+-----------------------------------------------------------------------------+ \n " );
372 puts ( " \n `This map shows a secret entrance to the catacombs." );
373 puts ( "You will know when you arrive because I left an old pair of shoes there.'" );
378 wordnumber
= max ( last1
, last2
) + 1 ;
379 return ( firstnumber
);