date and time created 85/04/22 15:41:53 by edward
[unix-history] / usr / src / games / battlestar / com2.c
CommitLineData
354f3094 1#ifndef lint
a7c71d1e 2static char sccsid[] = "@(#)com2.c 1.2 %G%";
354f3094
EW
3#endif
4
5#include "externs.h"
6
7wearit() /* synonyms = {sheathe, sheath} */
8{
9 register int n;
10 int firstnumber, value;
11
12 firstnumber = wordnumber;
13 while(wordtype[++wordnumber] == ADJS);
14 while(wordnumber <= wordcount){
15 value = wordvalue[wordnumber];
16 for (n=0; objsht[value][n]; n++);
17 switch(value){
18
19 case -1:
20 puts("Wear what?");
21 return(firstnumber);
22
23 default:
24 printf("You can't wear%s%s!\n",(objsht[value][n-1] == 's' ? " " : " a "),objsht[value]);
25 return(firstnumber);
26
27 case KNIFE:
28 /* case SHIRT: */
29 case ROBE:
30 case LEVIS: /* wearable things */
31 case SWORD:
32 case MAIL:
33 case HELM:
34 case SHOES:
35 case PAJAMAS:
36 case COMPASS:
37 case LASER:
38 case AMULET:
39 case TALISMAN:
40 case MEDALION:
41 case ROPE:
42 case RING:
43 case BRACELET:
44 case GRENADE:
45
46 if (testbit(inven,value)){
47 clearbit(inven,value);
48 setbit(wear,value);
49 carrying -= objwt[value];
50 encumber -= objcumber[value];
51 time++;
52 printf("You are now wearing %s %s.\n",(objsht[value][n-1] == 's' ? "the" : "a"), objsht[value]);
53 }
54 else if (testbit(wear,value))
55 printf("You are already wearing the %s.\n", objsht[value]);
56 else
57 printf("You aren't holding the %s.\n", objsht[value]);
58 if (wordnumber < wordcount - 1 && wordvalue[++wordnumber] == AND)
59 wordnumber++;
60 else
61 return(firstnumber);
62 } /* end switch */
63 } /* end while */
64 puts("Don't be ridiculous.");
65 return(firstnumber);
66}
67
68put() /* synonyms = {buckle, strap, tie} */
69{
70 if (wordvalue[wordnumber + 1] == ON){
71 wordvalue[++wordnumber] = PUTON;
72 return(cypher());
73 }
74 if (wordvalue[wordnumber + 1] == DOWN){
75 wordvalue[++wordnumber] = DROP;
76 return(cypher());
77 }
78 puts("I don't understand what you want to put.");
79 return(-1);
80
81}
82
83draw() /* synonyms = {pull, carry} */
84{
85 return(take(wear));
86}
87
88use()
89{
90 while (wordtype[++wordnumber] == ADJS && wordnumber < wordcount);
91 if (wordvalue[wordnumber] == AMULET && testbit(inven,AMULET) && position != FINAL){
92 puts("The amulet begins to glow.");
93 if (testbit(inven,MEDALION)){
94 puts("The medallion comes to life too.");
95 if (position == 114){
96 location[position].down = 160;
97 whichway(location[position]);
98 puts("The waves subside and it is possible to descend to the sea cave now.");
99 time++;
100 return(-1);
101 }
102 }
103 puts("A light mist falls over your eyes and the sound of purling water trickles in");
104 puts("your ears. When the mist lifts you are standing beside a cool stream.");
105 if (position == 229)
106 position = 224;
107 else
108 position = 229;
109 time++;
110 return(0);
111 }
112 else if (position == FINAL)
113 puts("The amulet won't work in here.");
114 else if (wordvalue[wordnumber] == COMPASS && testbit(inven,COMPASS))
115 printf("Your compass points %s.\n",truedirec(NORTH,'-'));
116 else if (wordvalue[wordnumber] == COMPASS)
117 puts("You aren't holding the compass.");
118 else if (wordvalue[wordnumber] == AMULET)
119 puts("You aren't holding the amulet.");
120 else
121 puts("There is no apparent use.");
122 return(-1);
123}
124
125murder()
126{
127 register int n;
128
129 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++);
130 if (n == NUMOFOBJECTS)
131 puts("You don't have suitable weapons to kill.");
132 else {
133 printf("Your %s should do the trick.\n",objsht[n]);
134 while (wordtype[++wordnumber] == ADJS);
135 switch(wordvalue[wordnumber]){
136
137 case NORMGOD:
138 if (testbit(location[position].objects,BATHGOD)){
139 puts("The goddess's head slices off. Her corpse floats in the water.");
140 clearbit(location[position].objects,BATHGOD);
141 setbit(location[position].objects,DEADGOD);
142 power += 5;
143 notes[JINXED]++;
144 } else if (testbit(location[position].objects,NORMGOD)){
145 puts("The goddess pleads but you strike her mercilessly. Her broken body lies in a\npool of blood.");
146 clearbit(location[position].objects,NORMGOD);
147 setbit(location[position].objects,DEADGOD);
148 power += 5;
149 notes[JINXED]++;
150 if (wintime)
151 live();
152 } else puts("I dont see her anywhere.");
153 break;
154 case TIMER:
155 if (testbit(location[position].objects,TIMER)){
156 puts("The old man offers no resistance.");
157 clearbit(location[position].objects,TIMER);
158 setbit(location[position].objects,DEADTIME);
159 power++;
160 notes[JINXED]++;
161 } else puts("Who?");
162 break;
163 case NATIVE:
164 if (testbit(location[position].objects,NATIVE)){
165 puts("The girl screams as you cut her body to shreds. She is dead.");
166 clearbit(location[position].objects,NATIVE);
167 setbit(location[position].objects,DEADNATIVE);
168 power += 5;
169 notes[JINXED]++;
170 } else puts("What girl?");
171 break;
172 case MAN:
173 if (testbit(location[position].objects,MAN)){
a7c71d1e 174 puts("You strike him to the ground, and he coughs up blood.");
354f3094
EW
175 puts("Your fantasy is over.");
176 die();
177 }
178 case -1:
179 puts("Kill what?");
180 break;
181
182 default:
183 if (wordtype[wordnumber] != NOUNS)
184 puts("Kill what?");
185 else
186 printf("You can't kill the %s!\n",objsht[wordvalue[wordnumber]]);
187 }
188 }
189}
190
191ravage()
192{
193 while (wordtype[++wordnumber] != NOUNS && wordnumber <= wordcount);
194 if (wordtype[wordnumber] == NOUNS && testbit(location[position].objects,wordvalue[wordnumber])){
195 time++;
196 switch(wordvalue[wordnumber]){
197 case NORMGOD:
a7c71d1e 198 puts("You attack the goddess, and she screams as you beat her. She falls down");
354f3094
EW
199 puts("crying and tries to hold her torn and bloodied dress around her.");
200 power += 5;
201 pleasure += 8;
202 ego -= 10;
203 wordnumber--;
204 godready = -30000;
205 murder();
206 win = -30000;
207 break;
208 case NATIVE:
a7c71d1e
EW
209 puts("The girl tries to run, but you catch her and throw her down. Her face is");
210 puts("bleeding, and she screams as you tear off her clothes.");
354f3094
EW
211 power += 3;
212 pleasure += 5;
213 ego -= 10;
214 wordnumber--;
215 murder();
a7c71d1e 216 if (rnd(100) < 50){
354f3094
EW
217 puts("Her screams have attracted attention. I think we are surrounded.");
218 setbit(location[ahead].objects,WOODSMAN);
219 setbit(location[ahead].objects,DEADWOOD);
220 setbit(location[ahead].objects,MALLET);
221 setbit(location[back].objects,WOODSMAN);
222 setbit(location[back].objects,DEADWOOD);
223 setbit(location[back].objects,MALLET);
224 setbit(location[left].objects,WOODSMAN);
225 setbit(location[left].objects,DEADWOOD);
226 setbit(location[left].objects,MALLET);
227 setbit(location[right].objects,WOODSMAN);
228 setbit(location[right].objects,DEADWOOD);
229 setbit(location[right].objects,MALLET);
230 }
231 break;
232 default:
233 puts("You are perverted.");
234 }
235 }
236 else
237 puts("Who?");
238}
239
240follow()
241{
242 if (followfight == time){
a7c71d1e
EW
243 puts("The Dark Lord leaps away and runs down secret tunnels and corridoors.");
244 puts("You chase him through the darkness and splash in pools of water.");
245 puts("You have cornered him. His laser sword extends as he steps forward.");
354f3094
EW
246 position = FINAL;
247 fight(DARK,75);
248 setbit(location[position].objects,TALISMAN);
249 setbit(location[position].objects,AMULET);
250 return(0);
251 }
252 else if (followgod == time){
253 puts("The goddess leads you down a steamy tunnel and into a high, wide chamber.");
254 puts("She sits down on a throne.");
255 position = 268;
256 setbit(location[position].objects,NORMGOD);
257 notes[CANTSEE] = 1;
258 return(0);
259 }
260 else
261 puts("There is no one to follow.");
262 return(-1);
263}