-#include "sst.h"\r
-\r
-static char classes[4][2]={"","M","N","O"};\r
-static int height;\r
-\r
-static int consumeTime(void) {\r
-/* I think most of this avoidance was caused by overlay scheme.\r
- Let's see what happens if all events can occur here */\r
-\r
-// double asave;\r
- ididit = 1;\r
-#if 0\r
- /* Don't wory about this */\r
- if (future[FTBEAM] <= game.state.date+Time && game.state.remcom != 0 && condit != IHDOCKED) {\r
- /* We are about to be tractor beamed -- operation fails */\r
- return 1;\r
- }\r
-#endif\r
-// asave = future[FSNOVA];\r
-// future[FSNOVA] = 1e30; /* defer supernovas */\r
- events(); /* Used to avoid if future[FSCMOVE] within time */\r
-// future[FSNOVA] = asave;\r
- /*fails if game over, quadrant super-novas or we've moved to new quadrant*/\r
- if (alldone || game.state.galaxy[quadx][quady] == 1000 || justin != 0) return 1;\r
- return 0;\r
-}\r
-\r
-void preport(void) {\r
- int iknow = 0, i;\r
- skip(1);\r
- chew();\r
- prout("Spock- \"Planet report follows, Captain.\"");\r
- skip(1);\r
- for (i = 1; i <= inplan; i++) {\r
- if (game.state.plnets[i].known != unknown\r
-#ifdef DEBUG\r
- || ( idebug && game.state.plnets[i].x !=0)\r
-#endif\r
- ) {\r
- iknow = 1;\r
-#ifdef DEBUG\r
- if (idebug && game.state.plnets[i].known==unknown) proutn("(Unknown) ");\r
-#endif\r
- cramlc(1, game.state.plnets[i].x, game.state.plnets[i].y);\r
- proutn(" class ");\r
- proutn(classes[game.state.plnets[i].pclass]);\r
- proutn(" ");\r
- if (game.state.plnets[i].crystals == 0) proutn("no ");\r
- prout("dilithium crystals present.");\r
- if (game.state.plnets[i].known==shuttle_down) \r
- prout(" Shuttle Craft Galileo on surface.");\r
- }\r
- }\r
- if (iknow==0) prout("No information available.");\r
-}\r
-\r
-void orbit(void) {\r
- double asave;\r
-\r
- skip(1);\r
- chew();\r
- ididit=0;\r
- if (inorbit!=0) {\r
- prout("Already in standard orbit.");\r
- return;\r
- }\r
- if (game.damage[DWARPEN] != 0 && game.damage[DIMPULS] != 0) {\r
- prout("Both warp and impulse engines damaged.");\r
- return;\r
- }\r
- if (plnetx == 0 || abs(sectx-plnetx) > 1 || abs(secty-plnety) > 1) {\r
- crmshp();\r
- prout(" not adjacient to planet.\n");\r
- return;\r
- }\r
- Time = 0.02+0.03*Rand();\r
- prout("Helmsman Sulu- \"Entering standard orbit, Sir.\"");\r
- newcnd();\r
- if (consumeTime()) return;\r
- proutn("Sulu- \"Entered orbit at altitude ");\r
- cramf(height = (1400.+7200.*Rand()), 0, 2);\r
- prout(" kilometers.\"");\r
- inorbit = 1;\r
- return;\r
-}\r
-\r
-void sensor(void) {\r
- skip(1);\r
- chew();\r
- if (game.damage[DSRSENS] != 0.0) {\r
- prout("Short range sensors damaged.");\r
- return;\r
- }\r
- if (plnetx == 0) {\r
- prout("No planet in this quadrant.");\r
- return;\r
- }\r
- proutn("Spock- \"Sensor scan for");\r
- cramlc(1, quadx, quady);\r
- prout("-");\r
- skip(1);\r
- proutn(" Planet at");\r
- cramlc(2, plnetx, plnety);\r
- proutn(" is of class ");\r
- proutn(classes[game.state.plnets[iplnet].pclass]);\r
- prout(".");\r
- if (game.state.plnets[iplnet].known==shuttle_down) \r
- prout(" Sensors show Galileo still on surface.");\r
- proutn(" Readings indicate");\r
- if (game.state.plnets[iplnet].crystals == 0) proutn(" no");\r
- prout(" dilithium crystals present.\"");\r
- if (game.state.plnets[iplnet].known == unknown) game.state.plnets[iplnet].known = known;\r
- return;\r
-}\r
-\r
-void beam(void) {\r
- chew();\r
- skip(1);\r
- if (game.damage[DTRANSP] != 0) {\r
- prout("Transporter damaged.");\r
- if (game.damage[DSHUTTL]==0 && (game.state.plnets[iplnet].known==shuttle_down || iscraft == 1)) {\r
- skip(1);\r
- prout("Spock- \"May I suggest the shuttle craft, Sir?\" ");\r
- if (ja() != 0) shuttle();\r
- }\r
- return;\r
- }\r
- if (inorbit==0) {\r
- crmshp();\r
- prout(" not in standard orbit.");\r
- return;\r
- }\r
- if (shldup!=0) {\r
- prout("Impossible to transport through shields.");\r
- return;\r
- }\r
- if (game.state.plnets[iplnet].known==unknown) {\r
- prout("Spock- \"Captain, we have no information on this planet");\r
- prout(" and Starfleet Regulations clearly state that in this situation");\r
- prout(" you may not go down.\"");\r
- return;\r
- }\r
- if (landed==1) {\r
- /* Coming from planet */\r
- if (game.state.plnets[iplnet].known==shuttle_down) {\r
- proutn("Spock- \"Wouldn't you rather take the Galileo?\" ");\r
- if (ja() != 0) {\r
- chew();\r
- return;\r
- }\r
- prout("Your crew hides the Galileo to prevent capture by aliens.");\r
- }\r
- prout("Landing party assembled, ready to beam up.");\r
- skip(1);\r
- prout("Kirk whips out communicator...");\r
- prouts("BEEP BEEP BEEP");\r
- skip(2);\r
- prout("\"Kirk to enterprise- Lock on coordinates...energize.\"");\r
- }\r
- else {\r
- /* Going to planet */\r
- if (game.state.plnets[iplnet].crystals==0) {\r
- prout("Spock- \"Captain, I fail to see the logic in");\r
- prout(" exploring a planet with no dilithium crystals.");\r
- proutn(" Are you sure this is wise?\" ");\r
- if (ja()==0) {\r
- chew();\r
- return;\r
- }\r
- }\r
- prout("Scotty- \"Transporter room ready, Sir.\"");\r
- skip(1);\r
- prout("Kirk, and landing party prepare to beam down to planet surface.");\r
- skip(1);\r
- prout("Kirk- \"Energize.\"");\r
- }\r
- skip(1);\r
- prouts("WWHOOOIIIIIRRRRREEEE.E.E. . . . . . .");\r
- skip(2);\r
- if (Rand() > 0.98) {\r
- prouts("BOOOIIIOOOIIOOOOIIIOIING . . .");\r
- skip(2);\r
- prout("Scotty- \"Oh my God! I've lost them.\"");\r
- finish(FLOST);\r
- return;\r
- }\r
- prouts(". . . . . . .E.E.EEEERRRRRIIIIIOOOHWW");\r
- skip(2);\r
- prout("Transport complete.");\r
- landed = -landed;\r
- if (landed==1 && game.state.plnets[iplnet].known==shuttle_down) {\r
- prout("The shuttle craft Galileo is here!");\r
- }\r
- if (landed!=1 && imine==1) {\r
- icrystl = 1;\r
- cryprob = 0.05;\r
- }\r
- imine = 0;\r
- return;\r
-}\r
-\r
-void mine(void) {\r
-\r
- ididit = 0;\r
- skip(1);\r
- chew();\r
- if (landed!= 1) {\r
- prout("Mining party not on planet.");\r
- return;\r
- }\r
- if (game.state.plnets[iplnet].crystals == 0) {\r
- prout("No dilithium crystals on this planet.");\r
- return;\r
- }\r
- if (imine == 1) {\r
- prout("You've already mined enough crystals for this trip.");\r
- return;\r
- }\r
- if (icrystl == 1 && cryprob == 0.05) {\r
- proutn("With all those fresh crystals aboard the ");\r
- crmshp();\r
- skip(1);\r
- prout("there's no reason to mine more at this time.");\r
- return;\r
- }\r
- Time = (0.1+0.2*Rand())*game.state.plnets[iplnet].pclass;\r
- if (consumeTime()) return;\r
- prout("Mining operation complete.");\r
- imine = 1;\r
- return;\r
-}\r
-\r
-void usecrystals(void) {\r
-\r
- skip(1);\r
- chew();\r
- if (icrystl!=1) {\r
- prout("No dilithium crystals available.");\r
- return;\r
- }\r
- if (energy >= 1000) {\r
- prout("Spock- \"Captain, Starfleet Regulations prohibit such an operation");\r
- prout(" except when condition Yellow exists.");\r
- return;\r
- }\r
- prout("Spock- \"Captain, I must warn you that loading");\r
- prout(" raw dilithium crystals into the ship's power");\r
- prout(" system may risk a severe explosion.");\r
- proutn(" Are you sure this is wise?\" ");\r
- if (ja()==0) {\r
- chew();\r
- return;\r
- }\r
- skip(1);\r
- prout("Engineering Officer Scott- \"(GULP) Aye Sir.");\r
- prout(" Mr. Spock and I will try it.\"");\r
- skip(1);\r
- prout("Spock- \"Crystals in place, Sir.");\r
- prout(" Ready to activate circuit.\"");\r
- skip(1);\r
- prouts("Scotty- \"Keep your fingers crossed, Sir!\"");\r
- skip(1);\r
- if (Rand() <= cryprob) {\r
- prouts(" \"Activating now! - - No good! It's***");\r
- skip(2);\r
- prouts("***RED ALERT! RED A*L********************************");\r
- skip(1);\r
- stars();\r
- prouts("****************** KA-BOOM!!!! *******************");\r
- skip(1);\r
- kaboom();\r
- return;\r
- }\r
- energy += 5000.0*(1.0 + 0.9*Rand());\r
- prouts(" \"Activating now! - - ");\r
- prout("The instruments");\r
- prout(" are going crazy, but I think it's");\r
- prout(" going to work!! Congratulations, Sir!\"");\r
- cryprob *= 2.0;\r
- return;\r
-}\r
-\r
-void shuttle(void) {\r
-\r
- chew();\r
- skip(1);\r
- ididit = 0;\r
- if(game.damage[DSHUTTL] != 0.0) {\r
- if (game.damage[DSHUTTL] == -1.0) {\r
- if (inorbit && game.state.plnets[iplnet].known == shuttle_down)\r
- prout("Ye Faerie Queene has no shuttle craft bay to dock it at.");\r
- else\r
- prout("Ye Faerie Queene had no shuttle craft.");\r
- }\r
- else if (game.damage[DSHUTTL] > 0)\r
- prout("The Galileo is damaged.");\r
- else prout("Shuttle craft is now serving Big Macs.");\r
- return;\r
- }\r
- if (inorbit==0) {\r
- crmshp();\r
- prout(" not in standard orbit.");\r
- return;\r
- }\r
- if ((game.state.plnets[iplnet].known != shuttle_down) && iscraft != 1) {\r
- prout("Shuttle craft not currently available.");\r
- return;\r
- }\r
- if (landed==-1 && game.state.plnets[iplnet].known==shuttle_down) {\r
- prout("You will have to beam down to retrieve the shuttle craft.");\r
- return;\r
- }\r
- if (shldup!=0 || condit == IHDOCKED) {\r
- prout("Shuttle craft cannot pass through shields.");\r
- return;\r
- }\r
- if (game.state.plnets[iplnet].known==unknown) {\r
- prout("Spock- \"Captain, we have no information on this planet");\r
- prout(" and Starfleet Regulations clearly state that in this situation");\r
- prout(" you may not fly down.\"");\r
- return;\r
- }\r
- Time = 3.0e-5*height;\r
- if (Time >= 0.8*game.state.remtime) {\r
- prout("First Officer Spock- \"Captain, I compute that such");\r
- prout(" a maneuver would require approximately ");\r
- cramf(100*Time/game.state.remtime,0,4);\r
- prout("% of our");\r
- prout("remaining time.");\r
- prout("Are you sure this is wise?\" ");\r
- if (ja()==0) {\r
- Time = 0.0;\r
- return;\r
- }\r
- }\r
- if (landed == 1) {\r
- /* Kirk on planet */\r
- if (iscraft==1) {\r
- /* Galileo on ship! */\r
- if (game.damage[DTRANSP]==0) {\r
- proutn("Spock- \"Would you rather use the transporter?\" ");\r
- if (ja() != 0) {\r
- beam();\r
- return;\r
- }\r
- proutn("Shuttle crew");\r
- }\r
- else\r
- proutn("Rescue party");\r
- prout(" boards Galileo and swoops toward planet surface.");\r
- iscraft = 0;\r
- skip(1);\r
- if (consumeTime()) return;\r
- game.state.plnets[iplnet].known=shuttle_down;\r
- prout("Trip complete.");\r
- return;\r
- }\r
- else {\r
- /* Ready to go back to ship */\r
- prout("You and your mining party board the");\r
- prout("shuttle craft for the trip back to the Enterprise.");\r
- skip(1);\r
- prout("The short hop begins . . .");\r
- game.state.plnets[iplnet].known=known;\r
- icraft = 1;\r
- skip(1);\r
- landed = -1;\r
- if (consumeTime()) return;\r
- iscraft = 1;\r
- icraft = 0;\r
- if (imine!=0) {\r
- icrystl = 1;\r
- cryprob = 0.05;\r
- }\r
- imine = 0;\r
- prout("Trip complete.");\r
- return;\r
- }\r
- }\r
- else {\r
- /* Kirk on ship */\r
- /* and so is Galileo */\r
- prout("Mining party assembles in the hangar deck,");\r
- prout("ready to board the shuttle craft \"Galileo\".");\r
- skip(1);\r
- prouts("The hangar doors open; the trip begins.");\r
- skip(1);\r
- icraft = 1;\r
- iscraft = 0;\r
- if (consumeTime()) return;\r
- game.state.plnets[iplnet].known = shuttle_down;\r
- landed = 1;\r
- icraft = 0;\r
- prout("Trip complete");\r
- return;\r
- }\r
-}\r
- \r
-\r
-void deathray(void) {\r
- double r = Rand();\r
- \r
- ididit = 0;\r
- skip(1);\r
- chew();\r
- if (ship != IHE) {\r
- prout("Ye Faerie Queene has no death ray.");\r
- return;\r
- }\r
- if (nenhere==0) {\r
- prout("Sulu- \"But Sir, there are no enemies in this quadrant.\"");\r
- return;\r
- }\r
- if (game.damage[DDRAY] > 0.0) {\r
- prout("Death Ray is damaged.");\r
- return;\r
- }\r
- prout("Spock- \"Captain, the 'Experimental Death Ray'");\r
- prout(" is highly unpredictible. Considering the alternatives,");\r
- prout(" are you sure this is wise?\" ");\r
- if (ja()==0) return;\r
- prout("Spock- \"Acknowledged.\"");\r
- skip(1);\r
- ididit=1;\r
- prouts("WHOOEE ... WHOOEE ... WHOOEE ... WHOOEE");\r
- skip(1);\r
- prout("Crew scrambles in emergency preparation.");\r
- prout("Spock and Scotty ready the death ray and");\r
- prout("prepare to channel all ship's power to the device.");\r
- skip(1);\r
- prout("Spock- \"Preparations complete, sir.\"");\r
- prout("Kirk- \"Engage!\"");\r
- skip(1);\r
- prouts("WHIRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR");\r
- skip(1);\r
- if (r > .30) {\r
- prouts("Sulu- \"Captain! It's working!\"");\r
- skip(2);\r
- while (nenhere > 0)\r
- deadkl(game.kx[1],game.ky[1],game.quad[game.kx[1]][game.ky[1]],game.kx[1],game.ky[1]);\r
- prout("Ensign Chekov- \"Congratulations, Captain!\"");\r
- if (game.state.remkl == 0) finish(FWON);\r
- prout("Spock- \"Captain, I believe the `Experimental Death Ray'");\r
- if (Rand() <= 0.05) {\r
- prout(" is still operational.\"");\r
- }\r
- else {\r
- prout(" has been rendered disfunctional.\"");\r
- game.damage[DDRAY] = 39.95;\r
- }\r
- return;\r
- }\r
- r = Rand(); // Pick failure method \r
- if (r <= .30) {\r
- prouts("Sulu- \"Captain! It's working!\"");\r
- skip(1);\r
- prouts("***RED ALERT! RED ALERT!");\r
- skip(1);\r
- prout("***MATTER-ANTIMATTER IMPLOSION IMMINENT!");\r
- skip(1);\r
- prouts("***RED ALERT! RED A*L********************************");\r
- skip(1);\r
- stars();\r
- prouts("****************** KA-BOOM!!!! *******************");\r
- skip(1);\r
- kaboom();\r
- return;\r
- }\r
- if (r <= .55) {\r
- prouts("Sulu- \"Captain! Yagabandaghangrapl, brachriigringlanbla!\"");\r
- skip(1);\r
- prout("Lt. Uhura- \"Graaeek! Graaeek!\"");\r
- skip(1);\r
- prout("Spock- \"Facinating! . . . All humans aboard");\r
- prout(" have apparently been transformed into strange mutations.");\r
- prout(" Vulcans do not seem to be affected.");\r
- skip(1);\r
- prout("Kirk- \"Raauch! Raauch!\"");\r
- finish(FDRAY);\r
- return;\r
- }\r
- if (r <= 0.75) {\r
- int i,j;\r
- prouts("Sulu- \"Captain! It's --WHAT?!?!\"");\r
- skip(2);\r
- proutn("Spock- \"I believe the word is");\r
- prouts(" *ASTONISHING*");\r
- prout(" Mr. Sulu.");\r
- for (i=1; i<=10; i++)\r
- for (j=1; j<=10; j++)\r
- if (game.quad[i][j] == IHDOT) game.quad[i][j] = IHQUEST;\r
- prout(" Captain, our quadrant is now infested with");\r
- prouts(" - - - - - - *THINGS*.");\r
- skip(1);\r
- prout(" I have no logical explanation.\"");\r
- return;\r
- }\r
- prouts("Sulu- \"Captain! The Death Ray is creating tribbles!\"");\r
- skip(1);\r
- prout("Scotty- \"There are so many tribbles down here");\r
- prout(" in Engineering, we can't move for 'em, Captain.\"");\r
- finish(FTRIBBLE);\r
- return;\r
-}\r
+#include "sst.h"
+
+static char *classes[] = {"M","N","O"};
+
+static int consumeTime(void)
+{
+/* I think most of this avoidance was caused by overlay scheme.
+ Let's see what happens if all events can occur here */
+
+// double asave;
+ ididit = 1;
+#if 0
+ /* Don't wory about this */
+ if (future[FTBEAM] <= game.state.date+Time && game.state.remcom != 0 && condit != IHDOCKED) {
+ /* We are about to be tractor beamed -- operation fails */
+ return 1;
+ }
+#endif
+// asave = future[FSNOVA];
+// future[FSNOVA] = 1e30; /* defer supernovas */
+ events(); /* Used to avoid if future[FSCMOVE] within time */
+// future[FSNOVA] = asave;
+ /*fails if game over, quadrant super-novas or we've moved to new quadrant*/
+ if (alldone || game.state.galaxy[quadx][quady].supernova || justin != 0) return 1;
+ return 0;
+}
+
+void preport(void)
+{
+ int iknow = 0, i;
+ skip(1);
+ chew();
+ prout("Spock- \"Planet report follows, Captain.\"");
+ skip(1);
+ for (i = 0; i < inplan; i++) {
+ if (game.state.plnets[i].known != unknown
+#ifdef DEBUG
+ || ( idebug && game.state.plnets[i].x !=0)
+#endif
+ ) {
+ iknow = 1;
+#ifdef DEBUG
+ if (idebug && game.state.plnets[i].known==unknown) proutn("(Unknown) ");
+#endif
+ proutn(cramlc(quadrant, game.state.plnets[i].x, game.state.plnets[i].y));
+ proutn(" class ");
+ proutn(classes[game.state.plnets[i].pclass]);
+ proutn(" ");
+ if (game.state.plnets[i].crystals == 0) proutn("no ");
+ prout("dilithium crystals present.");
+ if (game.state.plnets[i].known==shuttle_down)
+ prout(" Shuttle Craft Galileo on surface.");
+ }
+ }
+ if (iknow==0) prout("No information available.");
+}
+
+void orbit(void)
+{
+ skip(1);
+ chew();
+ if (inorbit!=0) {
+ prout("Already in standard orbit.");
+ return;
+ }
+ if (game.damage[DWARPEN] != 0 && game.damage[DIMPULS] != 0) {
+ prout("Both warp and impulse engines damaged.");
+ return;
+ }
+ if (plnetx == 0 || abs(sectx-plnetx) > 1 || abs(secty-plnety) > 1) {
+ crmshp();
+ prout(" not adjacent to planet.\n");
+ return;
+ }
+ Time = 0.02+0.03*Rand();
+ prout("Helmsman Sulu- \"Entering standard orbit, Sir.\"");
+ newcnd();
+ if (consumeTime()) return;
+ game.height = (1400.0+7200.0*Rand());
+ prout("Sulu- \"Entered orbit at altitude %.2f kilometers.\"", game.height);
+ inorbit = 1;
+ ididit=1;
+}
+
+void sensor(void)
+{
+ skip(1);
+ chew();
+ if (game.damage[DSRSENS] != 0.0) {
+ prout("Short range sensors damaged.");
+ return;
+ }
+ if (!plnetx && (game.options & OPTION_TTY)) {
+ prout("Spock- \"No planet in this quadrant, Captain.\"");
+ return;
+ }
+ if ((plnetx != 0)&& (game.state.plnets[iplnet].known == unknown)) {
+ prout("Spock- \"Sensor scan for %s-", cramlc(quadrant, quadx, quady));
+ skip(1);
+ prout(" Planet at %s is of class %s.",
+ cramlc(sector, plnetx, plnety),
+ classes[game.state.plnets[iplnet].pclass]);
+ if (game.state.plnets[iplnet].known==shuttle_down)
+ prout(" Sensors show Galileo still on surface.");
+ proutn(" Readings indicate");
+ if (game.state.plnets[iplnet].crystals == 0) proutn(" no");
+ prout(" dilithium crystals present.\"");
+ if (game.state.plnets[iplnet].known == unknown) game.state.plnets[iplnet].known = known;
+ }
+}
+
+void beam(void)
+{
+ chew();
+ skip(1);
+ if (game.damage[DTRANSP] != 0) {
+ prout("Transporter damaged.");
+ if (game.damage[DSHUTTL]==0 && (game.state.plnets[iplnet].known==shuttle_down || iscraft == 1)) {
+ skip(1);
+ proutn("Spock- \"May I suggest the shuttle craft, Sir?\" ");
+ if (ja() != 0) shuttle();
+ }
+ return;
+ }
+ if (inorbit==0) {
+ crmshp();
+ prout(" not in standard orbit.");
+ return;
+ }
+ if (shldup!=0) {
+ prout("Impossible to transport through shields.");
+ return;
+ }
+ if (game.state.plnets[iplnet].known==unknown) {
+ prout("Spock- \"Captain, we have no information on this planet");
+ prout(" and Starfleet Regulations clearly state that in this situation");
+ prout(" you may not go down.\"");
+ return;
+ }
+ if (landed==1) {
+ /* Coming from planet */
+ if (game.state.plnets[iplnet].known==shuttle_down) {
+ proutn("Spock- \"Wouldn't you rather take the Galileo?\" ");
+ if (ja() != 0) {
+ chew();
+ return;
+ }
+ prout("Your crew hides the Galileo to prevent capture by aliens.");
+ }
+ prout("Landing party assembled, ready to beam up.");
+ skip(1);
+ prout("Kirk whips out communicator...");
+ prouts("BEEP BEEP BEEP");
+ skip(2);
+ prout("\"Kirk to enterprise- Lock on coordinates...energize.\"");
+ }
+ else {
+ /* Going to planet */
+ if (game.state.plnets[iplnet].crystals==0) {
+ prout("Spock- \"Captain, I fail to see the logic in");
+ prout(" exploring a planet with no dilithium crystals.");
+ proutn(" Are you sure this is wise?\" ");
+ if (ja()==0) {
+ chew();
+ return;
+ }
+ }
+ prout("Scotty- \"Transporter room ready, Sir.\"");
+ skip(1);
+ prout("Kirk, and landing party prepare to beam down to planet surface.");
+ skip(1);
+ prout("Kirk- \"Energize.\"");
+ }
+ ididit=1;
+ skip(1);
+ prouts("WWHOOOIIIIIRRRRREEEE.E.E. . . . . . .");
+ skip(2);
+ if (Rand() > 0.98) {
+ prouts("BOOOIIIOOOIIOOOOIIIOIING . . .");
+ skip(2);
+ prout("Scotty- \"Oh my God! I've lost them.\"");
+ finish(FLOST);
+ return;
+ }
+ prouts(". . . . . . .E.E.EEEERRRRRIIIIIOOOHWW");
+ skip(2);
+ prout("Transport complete.");
+ landed = -landed;
+ if (landed==1 && game.state.plnets[iplnet].known==shuttle_down) {
+ prout("The shuttle craft Galileo is here!");
+ }
+ if (landed!=1 && imine==1) {
+ icrystl = 1;
+ cryprob = 0.05;
+ }
+ imine = 0;
+ return;
+}
+
+void mine(void)
+{
+ skip(1);
+ chew();
+ if (landed!= 1) {
+ prout("Mining party not on planet.");
+ return;
+ }
+ if (game.state.plnets[iplnet].crystals == 0) {
+ prout("No dilithium crystals on this planet.");
+ return;
+ }
+ if (imine == 1) {
+ prout("You've already mined enough crystals for this trip.");
+ return;
+ }
+ if (icrystl == 1 && cryprob == 0.05) {
+ proutn("With all those fresh crystals aboard the ");
+ crmshp();
+ skip(1);
+ prout("there's no reason to mine more at this time.");
+ return;
+ }
+ Time = (0.1+0.2*Rand())*game.state.plnets[iplnet].pclass;
+ if (consumeTime()) return;
+ prout("Mining operation complete.");
+ imine = 1;
+ ididit=1;
+}
+
+void usecrystals(void)
+{
+ ididit=0;
+ skip(1);
+ chew();
+ if (icrystl!=1) {
+ prout("No dilithium crystals available.");
+ return;
+ }
+ if (energy >= 1000) {
+ prout("Spock- \"Captain, Starfleet Regulations prohibit such an operation");
+ prout(" except when condition Yellow exists.");
+ return;
+ }
+ prout("Spock- \"Captain, I must warn you that loading");
+ prout(" raw dilithium crystals into the ship's power");
+ prout(" system may risk a severe explosion.");
+ proutn(" Are you sure this is wise?\" ");
+ if (ja()==0) {
+ chew();
+ return;
+ }
+ skip(1);
+ prout("Engineering Officer Scott- \"(GULP) Aye Sir.");
+ prout(" Mr. Spock and I will try it.\"");
+ skip(1);
+ prout("Spock- \"Crystals in place, Sir.");
+ prout(" Ready to activate circuit.\"");
+ skip(1);
+ prouts("Scotty- \"Keep your fingers crossed, Sir!\"");
+ skip(1);
+ if (Rand() <= cryprob) {
+ prouts(" \"Activating now! - - No good! It's***");
+ skip(2);
+ prouts("***RED ALERT! RED A*L********************************");
+ skip(1);
+ stars();
+ prouts("****************** KA-BOOM!!!! *******************");
+ skip(1);
+ kaboom();
+ return;
+ }
+ energy += 5000.0*(1.0 + 0.9*Rand());
+ prouts(" \"Activating now! - - ");
+ prout("The instruments");
+ prout(" are going crazy, but I think it's");
+ prout(" going to work!! Congratulations, Sir!\"");
+ cryprob *= 2.0;
+ ididit=1;
+}
+
+void shuttle(void)
+{
+ chew();
+ skip(1);
+ if(game.damage[DSHUTTL] != 0.0) {
+ if (game.damage[DSHUTTL] == -1.0) {
+ if (inorbit && game.state.plnets[iplnet].known == shuttle_down)
+ prout("Ye Faerie Queene has no shuttle craft bay to dock it at.");
+ else
+ prout("Ye Faerie Queene had no shuttle craft.");
+ }
+ else if (game.damage[DSHUTTL] > 0)
+ prout("The Galileo is damaged.");
+ else prout("Shuttle craft is now serving Big Macs.");
+ return;
+ }
+ if (inorbit==0) {
+ crmshp();
+ prout(" not in standard orbit.");
+ return;
+ }
+ if ((game.state.plnets[iplnet].known != shuttle_down) && iscraft != 1) {
+ prout("Shuttle craft not currently available.");
+ return;
+ }
+ if (landed==-1 && game.state.plnets[iplnet].known==shuttle_down) {
+ prout("You will have to beam down to retrieve the shuttle craft.");
+ return;
+ }
+ if (shldup!=0 || condit == IHDOCKED) {
+ prout("Shuttle craft cannot pass through shields.");
+ return;
+ }
+ if (game.state.plnets[iplnet].known==unknown) {
+ prout("Spock- \"Captain, we have no information on this planet");
+ prout(" and Starfleet Regulations clearly state that in this situation");
+ prout(" you may not fly down.\"");
+ return;
+ }
+ Time = 3.0e-5*game.height;
+ if (Time >= 0.8*game.state.remtime) {
+ prout("First Officer Spock- \"Captain, I compute that such");
+ proutn(" a maneuver would require approximately 2d%% of our",
+ (int)(100*Time/game.state.remtime));
+ prout("remaining time.");
+ proutn("Are you sure this is wise?\" ");
+ if (ja()==0) {
+ Time = 0.0;
+ return;
+ }
+ }
+ if (landed == 1) {
+ /* Kirk on planet */
+ if (iscraft==1) {
+ /* Galileo on ship! */
+ if (game.damage[DTRANSP]==0) {
+ proutn("Spock- \"Would you rather use the transporter?\" ");
+ if (ja() != 0) {
+ beam();
+ return;
+ }
+ proutn("Shuttle crew");
+ }
+ else
+ proutn("Rescue party");
+ prout(" boards Galileo and swoops toward planet surface.");
+ iscraft = 0;
+ skip(1);
+ if (consumeTime()) return;
+ game.state.plnets[iplnet].known=shuttle_down;
+ prout("Trip complete.");
+ return;
+ }
+ else {
+ /* Ready to go back to ship */
+ prout("You and your mining party board the");
+ prout("shuttle craft for the trip back to the Enterprise.");
+ skip(1);
+ prout("The short hop begins . . .");
+ game.state.plnets[iplnet].known=known;
+ icraft = 1;
+ skip(1);
+ landed = -1;
+ if (consumeTime()) return;
+ iscraft = 1;
+ icraft = 0;
+ if (imine!=0) {
+ icrystl = 1;
+ cryprob = 0.05;
+ }
+ imine = 0;
+ prout("Trip complete.");
+ return;
+ }
+ }
+ else {
+ /* Kirk on ship */
+ /* and so is Galileo */
+ prout("Mining party assembles in the hangar deck,");
+ prout("ready to board the shuttle craft \"Galileo\".");
+ skip(1);
+ prouts("The hangar doors open; the trip begins.");
+ skip(1);
+ icraft = 1;
+ iscraft = 0;
+ if (consumeTime()) return;
+ game.state.plnets[iplnet].known = shuttle_down;
+ landed = 1;
+ icraft = 0;
+ prout("Trip complete");
+ return;
+ }
+}
+
+void deathray(void)
+{
+ double r = Rand();
+
+ ididit = 0;
+ skip(1);
+ chew();
+ if (ship != IHE) {
+ prout("Ye Faerie Queene has no death ray.");
+ return;
+ }
+ if (nenhere==0) {
+ prout("Sulu- \"But Sir, there are no enemies in this quadrant.\"");
+ return;
+ }
+ if (game.damage[DDRAY] > 0.0) {
+ prout("Death Ray is damaged.");
+ return;
+ }
+ prout("Spock- \"Captain, the 'Experimental Death Ray'");
+ prout(" is highly unpredictible. Considering the alternatives,");
+ proutn(" are you sure this is wise?\" ");
+ if (ja()==0) return;
+ prout("Spock- \"Acknowledged.\"");
+ skip(1);
+ ididit=1;
+ prouts("WHOOEE ... WHOOEE ... WHOOEE ... WHOOEE");
+ skip(1);
+ prout("Crew scrambles in emergency preparation.");
+ prout("Spock and Scotty ready the death ray and");
+ prout("prepare to channel all ship's power to the device.");
+ skip(1);
+ prout("Spock- \"Preparations complete, sir.\"");
+ prout("Kirk- \"Engage!\"");
+ skip(1);
+ prouts("WHIRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR");
+ skip(1);
+ if (r > .30) {
+ prouts("Sulu- \"Captain! It's working!\"");
+ skip(2);
+ while (nenhere > 0)
+ deadkl(game.kx[1],game.ky[1],game.quad[game.kx[1]][game.ky[1]],game.kx[1],game.ky[1]);
+ prout("Ensign Chekov- \"Congratulations, Captain!\"");
+ if (game.state.remkl == 0) finish(FWON);
+ prout("Spock- \"Captain, I believe the `Experimental Death Ray'");
+ if (Rand() <= 0.05) {
+ prout(" is still operational.\"");
+ }
+ else {
+ prout(" has been rendered nonfunctional.\"");
+ game.damage[DDRAY] = 39.95;
+ }
+ return;
+ }
+ r = Rand(); // Pick failure method
+ if (r <= .30) {
+ prouts("Sulu- \"Captain! It's working!\"");
+ skip(1);
+ prouts("***RED ALERT! RED ALERT!");
+ skip(1);
+ prout("***MATTER-ANTIMATTER IMPLOSION IMMINENT!");
+ skip(1);
+ prouts("***RED ALERT! RED A*L********************************");
+ skip(1);
+ stars();
+ prouts("****************** KA-BOOM!!!! *******************");
+ skip(1);
+ kaboom();
+ return;
+ }
+ if (r <= .55) {
+ prouts("Sulu- \"Captain! Yagabandaghangrapl, brachriigringlanbla!\"");
+ skip(1);
+ prout("Lt. Uhura- \"Graaeek! Graaeek!\"");
+ skip(1);
+ prout("Spock- \"Fascinating! . . . All humans aboard");
+ prout(" have apparently been transformed into strange mutations.");
+ prout(" Vulcans do not seem to be affected.");
+ skip(1);
+ prout("Kirk- \"Raauch! Raauch!\"");
+ finish(FDRAY);
+ return;
+ }
+ if (r <= 0.75) {
+ int i,j;
+ prouts("Sulu- \"Captain! It's --WHAT?!?!\"");
+ skip(2);
+ proutn("Spock- \"I believe the word is");
+ prouts(" *ASTONISHING*");
+ prout(" Mr. Sulu.");
+ for_sectors(i)
+ for_sectors(j)
+ if (game.quad[i][j] == IHDOT) game.quad[i][j] = IHQUEST;
+ prout(" Captain, our quadrant is now infested with");
+ prouts(" - - - - - - *THINGS*.");
+ skip(1);
+ prout(" I have no logical explanation.\"");
+ return;
+ }
+ prouts("Sulu- \"Captain! The Death Ray is creating tribbles!\"");
+ skip(1);
+ prout("Scotty- \"There are so many tribbles down here");
+ prout(" in Engineering, we can't move for 'em, Captain.\"");
+ finish(FTRIBBLE);
+ return;
+}