5 static char *classes[] = {"M","N","O"};
7 static int consumeTime(void)
9 /* I think most of this avoidance was caused by overlay scheme.
10 Let's see what happens if all events can occur here */
15 /* Don't wory about this */
16 if (future[FTBEAM] <= game.state.date+Time && game.state.remcom != 0 && condit != IHDOCKED) {
17 /* We are about to be tractor beamed -- operation fails */
21 // asave = future[FSNOVA];
22 // future[FSNOVA] = 1e30; /* defer supernovas */
23 events(); /* Used to avoid if future[FSCMOVE] within time */
24 // future[FSNOVA] = asave;
25 /*fails if game over, quadrant super-novas or we've moved to new quadrant*/
26 if (alldone || game.state.galaxy[quadx][quady].supernova || justin != 0) return 1;
35 prout("Spock- \"Planet report follows, Captain.\"");
37 for (i = 0; i < inplan; i++) {
38 if (game.state.plnets[i].known != unknown
40 || ( idebug && game.state.plnets[i].x !=0)
45 if (idebug && game.state.plnets[i].known==unknown) proutn("(Unknown) ");
47 proutn(cramlc(quadrant, game.state.plnets[i].x, game.state.plnets[i].y));
49 proutn(classes[game.state.plnets[i].pclass]);
51 if (game.state.plnets[i].crystals == 0) proutn("no ");
52 prout("dilithium crystals present.");
53 if (game.state.plnets[i].known==shuttle_down)
54 prout(" Shuttle Craft Galileo on surface.");
57 if (iknow==0) prout("No information available.");
65 prout("Already in standard orbit.");
68 if (game.damage[DWARPEN] != 0 && game.damage[DIMPULS] != 0) {
69 prout("Both warp and impulse engines damaged.");
72 if (plnetx == 0 || abs(sectx-plnetx) > 1 || abs(secty-plnety) > 1) {
74 prout(" not adjacient to planet.\n");
77 Time = 0.02+0.03*Rand();
78 prout("Helmsman Sulu- \"Entering standard orbit, Sir.\"");
80 if (consumeTime()) return;
81 height = (1400.+7200.*Rand());
82 prout("Sulu- \"Entered orbit at altitude %.2f kilometers.\"", height);
87 void sensor(int force)
91 if (game.damage[DSRSENS] != 0.0) {
92 prout("Short range sensors damaged.");
95 if (!plnetx && ((game.state.plnets[iplnet].known == unknown || force))) {
96 prout("Spock- \"No planet in this quadrant, Captain.\"");
99 if ((plnetx != 0)&&(game.state.plnets[iplnet].known == unknown)) {
100 prout("Spock- \"Sensor scan for %s-", cramlc(quadrant, quadx, quady));
102 prout(" Planet at %s is of class %s.",
103 cramlc(sector, plnetx, plnety),
104 classes[game.state.plnets[iplnet].pclass]);
105 if (game.state.plnets[iplnet].known==shuttle_down)
106 prout(" Sensors show Galileo still on surface.");
107 proutn(" Readings indicate");
108 if (game.state.plnets[iplnet].crystals == 0) proutn(" no");
109 prout(" dilithium crystals present.\"");
110 if (game.state.plnets[iplnet].known == unknown) game.state.plnets[iplnet].known = known;
118 if (game.damage[DTRANSP] != 0) {
119 prout("Transporter damaged.");
120 if (game.damage[DSHUTTL]==0 && (game.state.plnets[iplnet].known==shuttle_down || iscraft == 1)) {
122 proutn("Spock- \"May I suggest the shuttle craft, Sir?\" ");
123 if (ja() != 0) shuttle();
129 prout(" not in standard orbit.");
133 prout("Impossible to transport through shields.");
136 if (game.state.plnets[iplnet].known==unknown) {
137 prout("Spock- \"Captain, we have no information on this planet");
138 prout(" and Starfleet Regulations clearly state that in this situation");
139 prout(" you may not go down.\"");
143 /* Coming from planet */
144 if (game.state.plnets[iplnet].known==shuttle_down) {
145 proutn("Spock- \"Wouldn't you rather take the Galileo?\" ");
150 prout("Your crew hides the Galileo to prevent capture by aliens.");
152 prout("Landing party assembled, ready to beam up.");
154 prout("Kirk whips out communicator...");
155 prouts("BEEP BEEP BEEP");
157 prout("\"Kirk to enterprise- Lock on coordinates...energize.\"");
160 /* Going to planet */
161 if (game.state.plnets[iplnet].crystals==0) {
162 prout("Spock- \"Captain, I fail to see the logic in");
163 prout(" exploring a planet with no dilithium crystals.");
164 proutn(" Are you sure this is wise?\" ");
170 prout("Scotty- \"Transporter room ready, Sir.\"");
172 prout("Kirk, and landing party prepare to beam down to planet surface.");
174 prout("Kirk- \"Energize.\"");
178 prouts("WWHOOOIIIIIRRRRREEEE.E.E. . . . . . .");
181 prouts("BOOOIIIOOOIIOOOOIIIOIING . . .");
183 prout("Scotty- \"Oh my God! I've lost them.\"");
187 prouts(". . . . . . .E.E.EEEERRRRRIIIIIOOOHWW");
189 prout("Transport complete.");
191 if (landed==1 && game.state.plnets[iplnet].known==shuttle_down) {
192 prout("The shuttle craft Galileo is here!");
194 if (landed!=1 && imine==1) {
207 prout("Mining party not on planet.");
210 if (game.state.plnets[iplnet].crystals == 0) {
211 prout("No dilithium crystals on this planet.");
215 prout("You've already mined enough crystals for this trip.");
218 if (icrystl == 1 && cryprob == 0.05) {
219 proutn("With all those fresh crystals aboard the ");
222 prout("there's no reason to mine more at this time.");
225 Time = (0.1+0.2*Rand())*game.state.plnets[iplnet].pclass;
226 if (consumeTime()) return;
227 prout("Mining operation complete.");
232 void usecrystals(void)
238 prout("No dilithium crystals available.");
241 if (energy >= 1000) {
242 prout("Spock- \"Captain, Starfleet Regulations prohibit such an operation");
243 prout(" except when condition Yellow exists.");
246 prout("Spock- \"Captain, I must warn you that loading");
247 prout(" raw dilithium crystals into the ship's power");
248 prout(" system may risk a severe explosion.");
249 proutn(" Are you sure this is wise?\" ");
255 prout("Engineering Officer Scott- \"(GULP) Aye Sir.");
256 prout(" Mr. Spock and I will try it.\"");
258 prout("Spock- \"Crystals in place, Sir.");
259 prout(" Ready to activate circuit.\"");
261 prouts("Scotty- \"Keep your fingers crossed, Sir!\"");
263 if (Rand() <= cryprob) {
264 prouts(" \"Activating now! - - No good! It's***");
266 prouts("***RED ALERT! RED A*L********************************");
269 prouts("****************** KA-BOOM!!!! *******************");
274 energy += 5000.0*(1.0 + 0.9*Rand());
275 prouts(" \"Activating now! - - ");
276 prout("The instruments");
277 prout(" are going crazy, but I think it's");
278 prout(" going to work!! Congratulations, Sir!\"");
287 if(game.damage[DSHUTTL] != 0.0) {
288 if (game.damage[DSHUTTL] == -1.0) {
289 if (inorbit && game.state.plnets[iplnet].known == shuttle_down)
290 prout("Ye Faerie Queene has no shuttle craft bay to dock it at.");
292 prout("Ye Faerie Queene had no shuttle craft.");
294 else if (game.damage[DSHUTTL] > 0)
295 prout("The Galileo is damaged.");
296 else prout("Shuttle craft is now serving Big Macs.");
301 prout(" not in standard orbit.");
304 if ((game.state.plnets[iplnet].known != shuttle_down) && iscraft != 1) {
305 prout("Shuttle craft not currently available.");
308 if (landed==-1 && game.state.plnets[iplnet].known==shuttle_down) {
309 prout("You will have to beam down to retrieve the shuttle craft.");
312 if (shldup!=0 || condit == IHDOCKED) {
313 prout("Shuttle craft cannot pass through shields.");
316 if (game.state.plnets[iplnet].known==unknown) {
317 prout("Spock- \"Captain, we have no information on this planet");
318 prout(" and Starfleet Regulations clearly state that in this situation");
319 prout(" you may not fly down.\"");
322 Time = 3.0e-5*height;
323 if (Time >= 0.8*game.state.remtime) {
324 prout("First Officer Spock- \"Captain, I compute that such");
325 proutn(" a maneuver would require approximately 2d%% of our",
326 (int)(100*Time/game.state.remtime));
327 prout("remaining time.");
328 proutn("Are you sure this is wise?\" ");
337 /* Galileo on ship! */
338 if (game.damage[DTRANSP]==0) {
339 proutn("Spock- \"Would you rather use the transporter?\" ");
344 proutn("Shuttle crew");
347 proutn("Rescue party");
348 prout(" boards Galileo and swoops toward planet surface.");
351 if (consumeTime()) return;
352 game.state.plnets[iplnet].known=shuttle_down;
353 prout("Trip complete.");
357 /* Ready to go back to ship */
358 prout("You and your mining party board the");
359 prout("shuttle craft for the trip back to the Enterprise.");
361 prout("The short hop begins . . .");
362 game.state.plnets[iplnet].known=known;
366 if (consumeTime()) return;
374 prout("Trip complete.");
380 /* and so is Galileo */
381 prout("Mining party assembles in the hangar deck,");
382 prout("ready to board the shuttle craft \"Galileo\".");
384 prouts("The hangar doors open; the trip begins.");
388 if (consumeTime()) return;
389 game.state.plnets[iplnet].known = shuttle_down;
392 prout("Trip complete");
405 prout("Ye Faerie Queene has no death ray.");
409 prout("Sulu- \"But Sir, there are no enemies in this quadrant.\"");
412 if (game.damage[DDRAY] > 0.0) {
413 prout("Death Ray is damaged.");
416 prout("Spock- \"Captain, the 'Experimental Death Ray'");
417 prout(" is highly unpredictible. Considering the alternatives,");
418 proutn(" are you sure this is wise?\" ");
420 prout("Spock- \"Acknowledged.\"");
423 prouts("WHOOEE ... WHOOEE ... WHOOEE ... WHOOEE");
425 prout("Crew scrambles in emergency preparation.");
426 prout("Spock and Scotty ready the death ray and");
427 prout("prepare to channel all ship's power to the device.");
429 prout("Spock- \"Preparations complete, sir.\"");
430 prout("Kirk- \"Engage!\"");
432 prouts("WHIRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR");
435 prouts("Sulu- \"Captain! It's working!\"");
438 deadkl(game.kx[1],game.ky[1],game.quad[game.kx[1]][game.ky[1]],game.kx[1],game.ky[1]);
439 prout("Ensign Chekov- \"Congratulations, Captain!\"");
440 if (game.state.remkl == 0) finish(FWON);
441 prout("Spock- \"Captain, I believe the `Experimental Death Ray'");
442 if (Rand() <= 0.05) {
443 prout(" is still operational.\"");
446 prout(" has been rendered nonfunctional.\"");
447 game.damage[DDRAY] = 39.95;
451 r = Rand(); // Pick failure method
453 prouts("Sulu- \"Captain! It's working!\"");
455 prouts("***RED ALERT! RED ALERT!");
457 prout("***MATTER-ANTIMATTER IMPLOSION IMMINENT!");
459 prouts("***RED ALERT! RED A*L********************************");
462 prouts("****************** KA-BOOM!!!! *******************");
468 prouts("Sulu- \"Captain! Yagabandaghangrapl, brachriigringlanbla!\"");
470 prout("Lt. Uhura- \"Graaeek! Graaeek!\"");
472 prout("Spock- \"Fascinating! . . . All humans aboard");
473 prout(" have apparently been transformed into strange mutations.");
474 prout(" Vulcans do not seem to be affected.");
476 prout("Kirk- \"Raauch! Raauch!\"");
482 prouts("Sulu- \"Captain! It's --WHAT?!?!\"");
484 proutn("Spock- \"I believe the word is");
485 prouts(" *ASTONISHING*");
487 for (i=1; i<=QUADSIZE; i++)
488 for (j=1; j<=QUADSIZE; j++)
489 if (game.quad[i][j] == IHDOT) game.quad[i][j] = IHQUEST;
490 prout(" Captain, our quadrant is now infested with");
491 prouts(" - - - - - - *THINGS*.");
493 prout(" I have no logical explanation.\"");
496 prouts("Sulu- \"Captain! The Death Ray is creating tribbles!\"");
498 prout("Scotty- \"There are so many tribbles down here");
499 prout(" in Engineering, we can't move for 'em, Captain.\"");