5 static char *classes[] = {"M","N","O"};
7 static int consumeTime(void) {
8 /* I think most of this avoidance was caused by overlay scheme.
9 Let's see what happens if all events can occur here */
14 /* Don't wory about this */
15 if (future[FTBEAM] <= game.state.date+Time && game.state.remcom != 0 && condit != IHDOCKED) {
16 /* We are about to be tractor beamed -- operation fails */
20 // asave = future[FSNOVA];
21 // future[FSNOVA] = 1e30; /* defer supernovas */
22 events(); /* Used to avoid if future[FSCMOVE] within time */
23 // future[FSNOVA] = asave;
24 /*fails if game over, quadrant super-novas or we've moved to new quadrant*/
25 if (alldone || game.state.galaxy[quadx][quady] == 1000 || justin != 0) return 1;
33 prout("Spock- \"Planet report follows, Captain.\"");
35 for (i = 0; i < inplan; i++) {
36 if (game.state.plnets[i].known != unknown
38 || ( idebug && game.state.plnets[i].x !=0)
43 if (idebug && game.state.plnets[i].known==unknown) proutn("(Unknown) ");
45 proutn(cramlc(quadrant, game.state.plnets[i].x, game.state.plnets[i].y));
47 proutn(classes[game.state.plnets[i].pclass]);
49 if (game.state.plnets[i].crystals == 0) proutn("no ");
50 prout("dilithium crystals present.");
51 if (game.state.plnets[i].known==shuttle_down)
52 prout(" Shuttle Craft Galileo on surface.");
55 if (iknow==0) prout("No information available.");
62 prout("Already in standard orbit.");
65 if (game.damage[DWARPEN] != 0 && game.damage[DIMPULS] != 0) {
66 prout("Both warp and impulse engines damaged.");
69 if (plnetx == 0 || abs(sectx-plnetx) > 1 || abs(secty-plnety) > 1) {
71 prout(" not adjacient to planet.\n");
74 Time = 0.02+0.03*Rand();
75 prout("Helmsman Sulu- \"Entering standard orbit, Sir.\"");
77 if (consumeTime()) return;
78 height = (1400.+7200.*Rand());
79 prout("Sulu- \"Entered orbit at altitude %.2f kilometers.\"", height);
88 if (game.damage[DSRSENS] != 0.0) return;
89 if ((plnetx != 0)&&(game.state.plnets[iplnet].known == 0)) {
93 if (game.damage[DSRSENS] != 0.0) {
94 prout("Short range sensors damaged.");
98 prout("No planet in this quadrant.");
102 prout("Spock- \"Sensor scan for %s-", cramlc(quadrant, quadx, quady));
104 prout(" Planet at %s is of class %s.",
105 cramlc(sector, plnetx, plnety),
106 classes[game.state.plnets[iplnet].pclass]);
107 if (game.state.plnets[iplnet].known==shuttle_down)
108 prout(" Sensors show Galileo still on surface.");
109 proutn(" Readings indicate");
110 if (game.state.plnets[iplnet].crystals == 0) proutn(" no");
111 prout(" dilithium crystals present.\"");
112 if (game.state.plnets[iplnet].known == unknown) game.state.plnets[iplnet].known = known;
121 if (game.damage[DTRANSP] != 0) {
122 prout("Transporter damaged.");
123 if (game.damage[DSHUTTL]==0 && (game.state.plnets[iplnet].known==shuttle_down || iscraft == 1)) {
125 proutn("Spock- \"May I suggest the shuttle craft, Sir?\" ");
126 if (ja() != 0) shuttle();
132 prout(" not in standard orbit.");
136 prout("Impossible to transport through shields.");
139 if (game.state.plnets[iplnet].known==unknown) {
140 prout("Spock- \"Captain, we have no information on this planet");
141 prout(" and Starfleet Regulations clearly state that in this situation");
142 prout(" you may not go down.\"");
146 /* Coming from planet */
147 if (game.state.plnets[iplnet].known==shuttle_down) {
148 proutn("Spock- \"Wouldn't you rather take the Galileo?\" ");
153 prout("Your crew hides the Galileo to prevent capture by aliens.");
155 prout("Landing party assembled, ready to beam up.");
157 prout("Kirk whips out communicator...");
158 prouts("BEEP BEEP BEEP");
160 prout("\"Kirk to enterprise- Lock on coordinates...energize.\"");
163 /* Going to planet */
164 if (game.state.plnets[iplnet].crystals==0) {
165 prout("Spock- \"Captain, I fail to see the logic in");
166 prout(" exploring a planet with no dilithium crystals.");
167 proutn(" Are you sure this is wise?\" ");
173 prout("Scotty- \"Transporter room ready, Sir.\"");
175 prout("Kirk, and landing party prepare to beam down to planet surface.");
177 prout("Kirk- \"Energize.\"");
183 prouts("WWHOOOIIIIIRRRRREEEE.E.E. . . . . . .");
186 prouts("BOOOIIIOOOIIOOOOIIIOIING . . .");
188 prout("Scotty- \"Oh my God! I've lost them.\"");
192 prouts(". . . . . . .E.E.EEEERRRRRIIIIIOOOHWW");
194 prout("Transport complete.");
196 if (landed==1 && game.state.plnets[iplnet].known==shuttle_down) {
197 prout("The shuttle craft Galileo is here!");
199 if (landed!=1 && imine==1) {
211 prout("Mining party not on planet.");
214 if (game.state.plnets[iplnet].crystals == 0) {
215 prout("No dilithium crystals on this planet.");
219 prout("You've already mined enough crystals for this trip.");
222 if (icrystl == 1 && cryprob == 0.05) {
223 proutn("With all those fresh crystals aboard the ");
226 prout("there's no reason to mine more at this time.");
229 Time = (0.1+0.2*Rand())*game.state.plnets[iplnet].pclass;
230 if (consumeTime()) return;
231 prout("Mining operation complete.");
238 void usecrystals(void) {
243 prout("No dilithium crystals available.");
246 if (energy >= 1000) {
247 prout("Spock- \"Captain, Starfleet Regulations prohibit such an operation");
248 prout(" except when condition Yellow exists.");
251 prout("Spock- \"Captain, I must warn you that loading");
252 prout(" raw dilithium crystals into the ship's power");
253 prout(" system may risk a severe explosion.");
254 proutn(" Are you sure this is wise?\" ");
260 prout("Engineering Officer Scott- \"(GULP) Aye Sir.");
261 prout(" Mr. Spock and I will try it.\"");
263 prout("Spock- \"Crystals in place, Sir.");
264 prout(" Ready to activate circuit.\"");
266 prouts("Scotty- \"Keep your fingers crossed, Sir!\"");
268 if (Rand() <= cryprob) {
269 prouts(" \"Activating now! - - No good! It's***");
271 prouts("***RED ALERT! RED A*L********************************");
274 prouts("****************** KA-BOOM!!!! *******************");
279 energy += 5000.0*(1.0 + 0.9*Rand());
280 prouts(" \"Activating now! - - ");
281 prout("The instruments");
282 prout(" are going crazy, but I think it's");
283 prout(" going to work!! Congratulations, Sir!\"");
294 if(game.damage[DSHUTTL] != 0.0) {
295 if (game.damage[DSHUTTL] == -1.0) {
296 if (inorbit && game.state.plnets[iplnet].known == shuttle_down)
297 prout("Ye Faerie Queene has no shuttle craft bay to dock it at.");
299 prout("Ye Faerie Queene had no shuttle craft.");
301 else if (game.damage[DSHUTTL] > 0)
302 prout("The Galileo is damaged.");
303 else prout("Shuttle craft is now serving Big Macs.");
308 prout(" not in standard orbit.");
311 if ((game.state.plnets[iplnet].known != shuttle_down) && iscraft != 1) {
312 prout("Shuttle craft not currently available.");
315 if (landed==-1 && game.state.plnets[iplnet].known==shuttle_down) {
316 prout("You will have to beam down to retrieve the shuttle craft.");
319 if (shldup!=0 || condit == IHDOCKED) {
320 prout("Shuttle craft cannot pass through shields.");
323 if (game.state.plnets[iplnet].known==unknown) {
324 prout("Spock- \"Captain, we have no information on this planet");
325 prout(" and Starfleet Regulations clearly state that in this situation");
326 prout(" you may not fly down.\"");
329 Time = 3.0e-5*height;
330 if (Time >= 0.8*game.state.remtime) {
331 prout("First Officer Spock- \"Captain, I compute that such");
332 proutn(" a maneuver would require approximately 2d%% of our",
333 (int)(100*Time/game.state.remtime));
334 prout("remaining time.");
335 proutn("Are you sure this is wise?\" ");
344 /* Galileo on ship! */
345 if (game.damage[DTRANSP]==0) {
346 proutn("Spock- \"Would you rather use the transporter?\" ");
351 proutn("Shuttle crew");
354 proutn("Rescue party");
355 prout(" boards Galileo and swoops toward planet surface.");
358 if (consumeTime()) return;
359 game.state.plnets[iplnet].known=shuttle_down;
360 prout("Trip complete.");
364 /* Ready to go back to ship */
365 prout("You and your mining party board the");
366 prout("shuttle craft for the trip back to the Enterprise.");
368 prout("The short hop begins . . .");
369 game.state.plnets[iplnet].known=known;
373 if (consumeTime()) return;
381 prout("Trip complete.");
387 /* and so is Galileo */
388 prout("Mining party assembles in the hangar deck,");
389 prout("ready to board the shuttle craft \"Galileo\".");
391 prouts("The hangar doors open; the trip begins.");
395 if (consumeTime()) return;
396 game.state.plnets[iplnet].known = shuttle_down;
399 prout("Trip complete");
404 void deathray(void) {
411 prout("Ye Faerie Queene has no death ray.");
415 prout("Sulu- \"But Sir, there are no enemies in this quadrant.\"");
418 if (game.damage[DDRAY] > 0.0) {
419 prout("Death Ray is damaged.");
422 prout("Spock- \"Captain, the 'Experimental Death Ray'");
423 prout(" is highly unpredictible. Considering the alternatives,");
424 proutn(" are you sure this is wise?\" ");
426 prout("Spock- \"Acknowledged.\"");
429 prouts("WHOOEE ... WHOOEE ... WHOOEE ... WHOOEE");
431 prout("Crew scrambles in emergency preparation.");
432 prout("Spock and Scotty ready the death ray and");
433 prout("prepare to channel all ship's power to the device.");
435 prout("Spock- \"Preparations complete, sir.\"");
436 prout("Kirk- \"Engage!\"");
438 prouts("WHIRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR");
441 prouts("Sulu- \"Captain! It's working!\"");
444 deadkl(game.kx[1],game.ky[1],game.quad[game.kx[1]][game.ky[1]],game.kx[1],game.ky[1]);
445 prout("Ensign Chekov- \"Congratulations, Captain!\"");
446 if (game.state.remkl == 0) finish(FWON);
447 prout("Spock- \"Captain, I believe the `Experimental Death Ray'");
448 if (Rand() <= 0.05) {
449 prout(" is still operational.\"");
452 prout(" has been rendered nonfunctional.\"");
453 game.damage[DDRAY] = 39.95;
457 r = Rand(); // Pick failure method
459 prouts("Sulu- \"Captain! It's working!\"");
461 prouts("***RED ALERT! RED ALERT!");
463 prout("***MATTER-ANTIMATTER IMPLOSION IMMINENT!");
465 prouts("***RED ALERT! RED A*L********************************");
468 prouts("****************** KA-BOOM!!!! *******************");
474 prouts("Sulu- \"Captain! Yagabandaghangrapl, brachriigringlanbla!\"");
476 prout("Lt. Uhura- \"Graaeek! Graaeek!\"");
478 prout("Spock- \"Facinating! . . . All humans aboard");
479 prout(" have apparently been transformed into strange mutations.");
480 prout(" Vulcans do not seem to be affected.");
482 prout("Kirk- \"Raauch! Raauch!\"");
488 prouts("Sulu- \"Captain! It's --WHAT?!?!\"");
490 proutn("Spock- \"I believe the word is");
491 prouts(" *ASTONISHING*");
493 for (i=1; i<=10; i++)
494 for (j=1; j<=10; j++)
495 if (game.quad[i][j] == IHDOT) game.quad[i][j] = IHQUEST;
496 prout(" Captain, our quadrant is now infested with");
497 prouts(" - - - - - - *THINGS*.");
499 prout(" I have no logical explanation.\"");
502 prouts("Sulu- \"Captain! The Death Ray is creating tribbles!\"");
504 prout("Scotty- \"There are so many tribbles down here");
505 prout(" in Engineering, we can't move for 'em, Captain.\"");