6 /* Finish with a BANG! */
\r
8 if (game.damage[DCOMPTR] != 0.0) {
\r
9 prout("Computer damaged; cannot execute destruct sequence.");
\r
13 prouts("---WORKING---"); skip(1);
\r
14 prout("SELF-DESTRUCT-SEQUENCE-ACTIVATED");
\r
15 prouts(" 10"); skip(1);
\r
16 prouts(" 9"); skip(1);
\r
17 prouts(" 8"); skip(1);
\r
18 prouts(" 7"); skip(1);
\r
19 prouts(" 6"); skip(1);
\r
20 prout("ENTER-CORRECT-PASSWORD-TO-CONTINUE-");
\r
21 prout("SELF-DESTRUCT-SEQUENCE-OTHERWISE-");
\r
22 prout("SELF-DESTRUCT-SEQUENCE-WILL-BE-ABORTED");
\r
25 if (strcmp(game.passwd, citem) != 0) {
\r
26 prouts("PASSWORD-REJECTED;"); skip(1);
\r
27 prout("CONTINUITY-EFFECTED");
\r
31 prouts("PASSWORD-ACCEPTED"); skip(1);
\r
32 prouts(" 5"); skip(1);
\r
33 prouts(" 4"); skip(1);
\r
34 prouts(" 3"); skip(1);
\r
35 prouts(" 2"); skip(1);
\r
36 prouts(" 1"); skip(1);
\r
37 if (Rand() < 0.15) {
\r
38 prouts("GOODBYE-CRUEL-WORLD");
\r
47 if (ship==IHE) prouts("***");
\r
48 prouts("********* Entropy of ");
\r
50 prouts(" maximized *********");
\r
55 double whammo = 25.0 * energy;
\r
57 while (l <= nenhere) {
\r
58 if (game.kpower[l]*game.kdist[l] <= whammo)
\r
59 deadkl(game.kx[l],game.ky[l], game.quad[game.kx[l]][game.ky[l]], game.kx[l], game.ky[l]);
\r
67 void finish(FINTYPE ifin) {
\r
71 prout("It is stardate %.1f.", game.state.date);
\r
74 case FWON: // Game has been won
\r
75 if (game.state.nromrem != 0)
\r
76 prout("The remaining %d Romulans surrender to Starfleet Command.",
\r
77 game.state.nromrem);
\r
79 prout("You have smashed the Klingon invasion fleet and saved");
\r
80 prout("the Federation.");
\r
84 badpt = 5.*game.state.starkl + casual + 10.*game.state.nplankl +
\r
85 45.*nhelp+100.*game.state.basekl;
\r
86 if (ship == IHF) badpt += 100.0;
\r
87 else if (ship == 0) badpt += 200.0;
\r
88 if (badpt < 100.0) badpt = 0.0; // Close enough!
\r
89 if (game.state.date-indate < 5.0 ||
\r
90 // killsPerDate >= RateMax
\r
91 (game.state.killk+game.state.killc+game.state.nsckill)/(game.state.date-indate) >=
\r
92 0.1*skill*(skill+1.0) + 0.1 + 0.008*badpt) {
\r
94 prout("In fact, you have done so well that Starfleet Command");
\r
97 prout("promotes you one step in rank from \"Novice\" to \"Fair\".");
\r
100 prout("promotes you one step in rank from \"Fair\" to \"Good\".");
\r
103 prout("promotes you one step in rank from \"Good\" to \"Expert\".");
\r
106 prout("promotes you to Commodore Emeritus.");
\r
108 prout("Now that you think you're really good, try playing");
\r
109 prout("the \"Emeritus\" game. It will splatter your ego.");
\r
113 prout("Computer- ERROR-ERROR-ERROR-ERROR");
\r
115 prout(" YOUR-SKILL-HAS-EXCEEDED-THE-CAPACITY-OF-THIS-PROGRAM");
\r
116 prout(" THIS-PROGRAM-MUST-SURVIVE");
\r
117 prout(" THIS-PROGRAM-MUST-SURVIVE");
\r
118 prout(" THIS-PROGRAM-MUST-SURVIVE");
\r
119 prout(" THIS-PROGRAM-MUST?- MUST ? - SUR? ? -? VI");
\r
121 prout("Now you can retire and write your own Star Trek game!");
\r
131 prout("You cannot get a citation, so...");
\r
133 prout("Do you want your Commodore Emeritus Citation printed?");
\r
134 proutn("(You need a 132 column printer.)");
\r
142 // Only grant long life if alive (original didn't!)
\r
144 prout("LIVE LONG AND PROSPER.");
\r
147 if (igotit != 0) plaque();
\r
149 case FDEPLETE: // Federation Resources Depleted
\r
150 prout("Your time has run out and the Federation has been");
\r
151 prout("conquered. Your starship is now Klingon property,");
\r
152 prout("and you are put on trial as a war criminal. On the");
\r
153 proutn("basis of your record, you are ");
\r
154 if (game.state.remkl*3.0 > inkling) {
\r
155 prout("aquitted.");
\r
157 prout("LIVE LONG AND PROSPER.");
\r
160 prout("found guilty and");
\r
161 prout("sentenced to death by slow torture.");
\r
167 prout("Your life support reserves have run out, and");
\r
168 prout("you die of thirst, starvation, and asphyxiation.");
\r
169 prout("Your starship is a derelict in space.");
\r
172 prout("Your energy supply is exhausted.");
\r
174 prout("Your starship is a derelict in space.");
\r
179 prout("has been destroyed in battle.");
\r
181 prout("Dulce et decorum est pro patria mori.");
\r
184 prout("You have made three attempts to cross the negative energy");
\r
185 prout("barrier which surrounds the galaxy.");
\r
187 prout("Your navigation is abominable.");
\r
191 prout("Your starship has been destroyed by a nova.");
\r
192 prout("That was a great shot.");
\r
198 prout(" has been fried by a supernova.");
\r
199 prout("...Not even cinders remain...");
\r
202 prout("You have been captured by the Klingons. If you still");
\r
203 prout("had a starbase to be returned to, you would have been");
\r
204 prout("repatriated and given another chance. Since you have");
\r
205 prout("no starbases, you will be mercilessly tortured to death.");
\r
208 prout("Your starship is now an expanding cloud of subatomic particles");
\r
211 prout("Starbase was unable to re-materialize your starship.");
\r
212 prout("Sic transit gloria muntdi");
\r
217 prout(" has been cremated by its own phasers.");
\r
220 prout("You and your landing party have been");
\r
221 prout("converted to energy, disipating through space.");
\r
224 prout("You are left with your landing party on");
\r
225 prout("a wild jungle planet inhabited by primitive cannibals.");
\r
227 prout("They are very fond of \"Captain Kirk\" soup.");
\r
229 proutn("Without your leadership, the ");
\r
231 prout(" is destroyed.");
\r
234 prout("You and your mining party perish.");
\r
236 prout("That was a great shot.");
\r
240 prout("The Galileo is instantly annihilated by the supernova.");
\r
243 prout("You and your mining party are atomized.");
\r
245 proutn("Mr. Spock takes command of the ");
\r
248 prout("joins the Romulans, reigning terror on the Federation.");
\r
251 prout("The shuttle craft Galileo is also caught,");
\r
252 prout("and breaks up under the strain.");
\r
254 prout("Your debris is scattered for millions of miles.");
\r
255 proutn("Without your leadership, the ");
\r
257 prout(" is destroyed.");
\r
260 prout("The mutants attack and kill Spock.");
\r
261 prout("Your ship is captured by Klingons, and");
\r
262 prout("your crew is put on display in a Klingon zoo.");
\r
265 prout("Tribbles consume all remaining water,");
\r
266 prout("food, and oxygen on your ship.");
\r
268 prout("You die of thirst, starvation, and asphyxiation.");
\r
269 prout("Your starship is a derelict in space.");
\r
272 prout("Your ship is drawn to the center of the black hole.");
\r
273 prout("You are crushed into extremely dense matter.");
\r
276 if (ship==IHF) ship= 0;
\r
277 else if (ship == IHE) ship = IHF;
\r
279 if (game.state.remkl != 0) {
\r
280 double goodies = game.state.remres/inresor;
\r
281 double baddies = (game.state.remkl + 2.0*game.state.remcom)/(inkling+2.0*incom);
\r
282 if (goodies/baddies >= 1.0+0.5*Rand()) {
\r
283 prout("As a result of your actions, a treaty with the Klingon");
\r
284 prout("Empire has been signed. The terms of the treaty are");
\r
285 if (goodies/baddies >= 3.0+Rand()) {
\r
286 prout("favorable to the Federation.");
\r
288 prout("Congratulations!");
\r
291 prout("highly unfavorable to the Federation.");
\r
294 prout("The Federation will be destroyed.");
\r
297 prout("Since you took the last Klingon with you, you are a");
\r
298 prout("martyr and a hero. Someday maybe they'll erect a");
\r
299 prout("statue in your memory. Rest in peace, and try not");
\r
300 prout("to think about pigeons.");
\r
307 double timused = game.state.date - indate;
\r
308 int ithperd, iwon, klship;
\r
313 if ((timused == 0 || game.state.remkl != 0) && timused < 5.0) timused = 5.0;
\r
314 perdate = (game.state.killc + game.state.killk + game.state.nsckill)/timused;
\r
315 ithperd = 500*perdate + 0.5;
\r
317 if (gamewon) iwon = 100*skill;
\r
318 if (ship == IHE) klship = 0;
\r
319 else if (ship == IHF) klship = 1;
\r
321 if (gamewon == 0) game.state.nromrem = 0; // None captured if no win
\r
322 iscore = 10*game.state.killk + 50*game.state.killc + ithperd + iwon
\r
323 - 100*game.state.basekl - 100*klship - 45*nhelp -5*game.state.starkl - casual
\r
324 + 20*game.state.nromkl + 200*game.state.nsckill - 10*game.state.nplankl + game.state.nromrem;
\r
325 if (alive == 0) iscore -= 200;
\r
327 prout("Your score --");
\r
328 if (game.state.nromkl)
\r
329 prout("%6d Romulans destroyed %5d",
\r
330 game.state.nromkl,20*game.state.nromkl);
\r
331 if (game.state.nromrem)
\r
332 prout("%6d Romulans captured %5d",
\r
333 game.state.nromrem, game.state.nromrem);
\r
334 if (game.state.killk)
\r
335 prout("%6d ordinary Klingons destroyed %5d",
\r
336 game.state.killk, 10*game.state.killk);
\r
337 if (game.state.killc)
\r
338 prout("%6d Klingon commanders destroyed %5d",
\r
339 game.state.killc, 50*game.state.killc);
\r
340 if (game.state.nsckill)
\r
341 prout("%6d Super-Commander destroyed %5d",
\r
342 game.state.nsckill, 200*game.state.nsckill);
\r
344 prout("%.2f Klingons per stardate %5d",
\r
346 if (game.state.starkl)
\r
347 prout("%6d stars destroyed by your action %5d",
\r
348 game.state.starkl, -5*game.state.starkl);
\r
349 if (game.state.nplankl)
\r
350 prout("%6d planets destroyed by your action %5d",
\r
351 game.state.nplankl, -10*game.state.nplankl);
\r
352 if (game.state.basekl)
\r
353 prout("%6d bases destroyed by your action %5d",
\r
354 game.state.basekl, -100*game.state.basekl);
\r
356 prout("%6d calls for help from starbase %5d",
\r
359 prout("%6d casualties incurred %5d",
\r
362 prout("%6d ship(s) lost or destroyed %5d",
\r
363 klship, -100*klship);
\r
365 prout("Penalty for getting yourself killed -200");
\r
368 proutn("Bonus for winning ");
\r
370 case 1: proutn("Novice game "); break;
\r
371 case 2: proutn("Fair game "); break;
\r
372 case 3: proutn("Good game "); break;
\r
373 case 4: proutn("Expert game "); break;
\r
374 case 5: proutn("Emeritus game"); break;
\r
376 prout(" %5d", iwon);
\r
379 prout("TOTAL SCORE %5d", iscore);
\r
382 void plaque(void) {
\r
391 while (fp == NULL) {
\r
392 proutn("File or device name for your plaque:");
\r
393 fgets(winner, 128, stdin);
\r
394 winner[strlen(winner)-1] = '\0';
\r
395 fp = fopen(winner, "w");
\r
397 prout("Invalid name.");
\r
401 proutn("Enter name to go on plaque (up to 30 characters):");
\r
402 fgets(winner, 128, stdin);
\r
403 winner[strlen(winner)-1] = '\0';
\r
405 nskip = 64 - strlen(winner)/2;
\r
407 fprintf(fp,"\n\n\n\n");
\r
408 /* --------DRAW ENTERPRISE PICTURE. */
\r
409 fprintf(fp, " EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE\n" );
\r
410 fprintf(fp, " EEE E : : : E\n" );
\r
411 fprintf(fp, " EE EEE E : : NCC-1701 : E\n");
\r
412 fprintf(fp, " EEEEEEEEEEEEEEEE EEEEEEEEEEEEEEE E : : : E\n");
\r
413 fprintf(fp, " E E EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE\n");
\r
414 fprintf(fp, " EEEEEEEEE EEEEEEEEEEEEE E E\n");
\r
415 fprintf(fp, " EEEEEEE EEEEE E E E E\n");
\r
416 fprintf(fp, " EEE E E E E\n");
\r
417 fprintf(fp, " E E E E\n");
\r
418 fprintf(fp, " EEEEEEEEEEEEE E E\n");
\r
419 fprintf(fp, " EEE : EEEEEEE EEEEEEEE\n");
\r
420 fprintf(fp, " :E : EEEE E\n");
\r
421 fprintf(fp, " .-E -:----- E\n");
\r
422 fprintf(fp, " :E : E\n");
\r
423 fprintf(fp, " EE : EEEEEEEE\n");
\r
424 fprintf(fp, " EEEEEEEEEEEEEEEEEEEEEEE\n");
\r
425 fprintf(fp, "\n\n\n");
\r
426 fprintf(fp, " U. S. S. ENTERPRISE\n");
\r
427 fprintf(fp, "\n\n\n\n");
\r
428 fprintf(fp, " For demonstrating outstanding ability as a starship captain\n");
\r
430 fprintf(fp, " Starfleet Command bestows to you\n");
\r
432 fprintf(fp,"%*s%s\n\n", nskip, "", winner);
\r
433 fprintf(fp, " the rank of\n\n");
\r
434 fprintf(fp, " \"Commodore Emeritus\"\n\n");
\r
437 case 4: fprintf(fp," Expert level\n\n"); break;
\r
438 case 5: fprintf(fp,"Emeritus level\n\n"); break;
\r
439 default: fprintf(fp," Cheat level\n\n"); break;
\r
442 timestring = ctime(&t);
\r
443 fprintf(fp, " This day of %.6s %.4s, %.8s\n\n",
\r
444 timestring+4, timestring+20, timestring+11);
\r
445 fprintf(fp," Your score: %d\n\n", iscore);
\r
446 fprintf(fp," Klingons per stardate: %.2f\n", perdate);
\r