5 void selfdestruct(void)
6 /* self-destruct maneuver */
8 /* Finish with a BANG! */
10 if (damaged(DCOMPTR)) {
11 prout(_("Computer damaged; cannot execute destruct sequence."));
14 prouts(_("---WORKING---")); skip(1);
15 prouts(_("SELF-DESTRUCT-SEQUENCE-ACTIVATED")); skip(1);
16 prouts(" 10"); skip(1);
17 prouts(" 9"); skip(1);
18 prouts(" 8"); skip(1);
19 prouts(" 7"); skip(1);
20 prouts(" 6"); skip(1);
22 prout(_("ENTER-CORRECT-PASSWORD-TO-CONTINUE-"));
24 prout(_("SELF-DESTRUCT-SEQUENCE-OTHERWISE-"));
26 prout(_("SELF-DESTRUCT-SEQUENCE-WILL-BE-ABORTED"));
30 if (strcmp(game.passwd, citem) != 0) {
31 prouts(_("PASSWORD-REJECTED;"));
33 prouts(_("CONTINUITY-EFFECTED"));
37 prouts(_("PASSWORD-ACCEPTED")); skip(1);
38 prouts(" 5"); skip(1);
39 prouts(" 4"); skip(1);
40 prouts(" 3"); skip(1);
41 prouts(" 2"); skip(1);
42 prouts(" 1"); skip(1);
44 prouts(_("GOODBYE-CRUEL-WORLD"));
55 prouts(_("********* Entropy of "));
57 prouts(_(" maximized *********"));
61 if (game.nenhere != 0) {
62 double whammo = 25.0 * game.energy;
64 while (l <= game.nenhere) {
65 if (game.kpower[l]*game.kdist[l] <= whammo)
66 deadkl(game.ks[l], game.quad[game.ks[l].x][game.ks[l].y], game.ks[l]);
74 void finish(FINTYPE ifin)
75 /* end the game, with appropriate notfications */
80 prout(_("It is stardate %.1f."), game.state.date);
83 case FWON: // Game has been won
84 if (game.state.nromrem != 0)
85 prout(_("The remaining %d Romulans surrender to Starfleet Command."),
88 prout(_("You have smashed the Klingon invasion fleet and saved"));
89 prout(_("the Federation."));
93 badpt = 5.0*game.state.starkl \
95 + 10.0*game.state.nplankl \
96 + 300.0*game.state.nworldkl \
98 + 100.0*game.state.basekl \
100 if (game.ship == IHF)
102 else if (game.ship == 0)
105 badpt = 0.0; // Close enough!
106 if (game.state.date-game.indate < 5.0 ||
107 // killsPerDate >= RateMax
108 ((game.inkling + game.incom + game.inscom) - (game.state.remkl + game.state.remcom + game.state.nscrem))/(game.state.date-game.indate) >=
109 0.1*game.skill*(game.skill+1.0) + 0.1 + 0.008*badpt) {
111 prout(_("In fact, you have done so well that Starfleet Command"));
112 switch (game.skill) {
114 break; /* quiet gcc warning */
116 prout(_("promotes you one step in rank from \"Novice\" to \"Fair\"."));
119 prout(_("promotes you one step in rank from \"Fair\" to \"Good\"."));
122 prout(_("promotes you one step in rank from \"Good\" to \"Expert\"."));
125 prout(_("promotes you to Commodore Emeritus."));
127 prout(_("Now that you think you're really good, try playing"));
128 prout(_("the \"Emeritus\" game. It will splatter your ego."));
132 proutn(_("Computer- "));
133 prouts(_("ERROR-ERROR-ERROR-ERROR"));
135 prouts(_(" YOUR-SKILL-HAS-EXCEEDED-THE-CAPACITY-OF-THIS-PROGRAM"));
137 prouts(_(" THIS-PROGRAM-MUST-SURVIVE"));
139 prouts(_(" THIS-PROGRAM-MUST-SURVIVE"));
141 prouts(_(" THIS-PROGRAM-MUST-SURVIVE"));
143 prouts(_(" THIS-PROGRAM-MUST?- MUST ? - SUR? ? -? VI"));
145 prout(_("Now you can retire and write your own Star Trek game!"));
149 if (game.skill >= SKILL_EXPERT) {
150 if (game.thawed && !idebug)
151 prout(_("You cannot get a citation, so..."));
153 proutn(_("Do you want your Commodore Emeritus Citation printed? "));
161 // Only grant long life if alive (original didn't!)
163 prout(_("LIVE LONG AND PROSPER."));
169 case FDEPLETE: // Federation Resources Depleted
170 prout(_("Your time has run out and the Federation has been"));
171 prout(_("conquered. Your starship is now Klingon property,"));
172 prout(_("and you are put on trial as a war criminal. On the"));
173 proutn(_("basis of your record, you are "));
174 if ((game.state.remkl + game.state.remcom + game.state.nscrem)*3.0 > (game.inkling + game.incom + game.inscom)) {
175 prout(_("acquitted."));
177 prout(_("LIVE LONG AND PROSPER."));
180 prout(_("found guilty and"));
181 prout(_("sentenced to death by slow torture."));
187 prout(_("Your life support reserves have run out, and"));
188 prout(_("you die of thirst, starvation, and asphyxiation."));
189 prout(_("Your starship is a derelict in space."));
192 prout(_("Your energy supply is exhausted."));
194 prout(_("Your starship is a derelict in space."));
199 prout(_("has been destroyed in battle."));
201 prout(_("Dulce et decorum est pro patria mori."));
204 prout(_("You have made three attempts to cross the negative energy"));
205 prout(_("barrier which surrounds the galaxy."));
207 prout(_("Your navigation is abominable."));
211 prout(_("Your starship has been destroyed by a nova."));
212 prout(_("That was a great shot."));
218 prout(_(" has been fried by a supernova."));
219 prout(_("...Not even cinders remain..."));
222 prout(_("You have been captured by the Klingons. If you still"));
223 prout(_("had a starbase to be returned to, you would have been"));
224 prout(_("repatriated and given another chance. Since you have"));
225 prout(_("no starbases, you will be mercilessly tortured to death."));
228 prout(_("Your starship is now an expanding cloud of subatomic particles"));
231 prout(_("Starbase was unable to re-materialize your starship."));
232 prout(_("Sic transit gloria mundi"));
237 prout(_(" has been cremated by its own phasers."));
240 prout(_("You and your landing party have been"));
241 prout(_("converted to energy, disipating through space."));
244 prout(_("You are left with your landing party on"));
245 prout(_("a wild jungle planet inhabited by primitive cannibals."));
247 prout(_("They are very fond of \"Captain Kirk\" soup."));
249 proutn(_("Without your leadership, the "));
251 prout(_(" is destroyed."));
254 prout(_("You and your mining party perish."));
256 prout(_("That was a great shot."));
260 prout(_("The Galileo is instantly annihilated by the supernova."));
263 prout(_("You and your mining party are atomized."));
265 proutn(_("Mr. Spock takes command of the "));
268 prout(_("joins the Romulans, reigning terror on the Federation."));
271 prout(_("The shuttle craft Galileo is also caught,"));
272 prout(_("and breaks up under the strain."));
274 prout(_("Your debris is scattered for millions of miles."));
275 proutn(_("Without your leadership, the "));
277 prout(_(" is destroyed."));
280 prout(_("The mutants attack and kill Spock."));
281 prout(_("Your ship is captured by Klingons, and"));
282 prout(_("your crew is put on display in a Klingon zoo."));
285 prout(_("Tribbles consume all remaining water,"));
286 prout(_("food, and oxygen on your ship."));
288 prout(_("You die of thirst, starvation, and asphyxiation."));
289 prout(_("Your starship is a derelict in space."));
292 prout(_("Your ship is drawn to the center of the black hole."));
293 prout(_("You are crushed into extremely dense matter."));
296 prout(_("Your last crew member has died."));
301 else if (game.ship == IHE)
304 if ((game.state.remkl + game.state.remcom + game.state.nscrem) != 0) {
305 double goodies = game.state.remres/game.inresor;
306 double baddies = (game.state.remkl + 2.0*game.state.remcom)/(game.inkling+2.0*game.incom);
307 if (goodies/baddies >= 1.0+0.5*Rand()) {
308 prout(_("As a result of your actions, a treaty with the Klingon"));
309 prout(_("Empire has been signed. The terms of the treaty are"));
310 if (goodies/baddies >= 3.0+Rand()) {
311 prout(_("favorable to the Federation."));
313 prout(_("Congratulations!"));
316 prout(_("highly unfavorable to the Federation."));
319 prout(_("The Federation will be destroyed."));
322 prout(_("Since you took the last Klingon with you, you are a"));
323 prout(_("martyr and a hero. Someday maybe they'll erect a"));
324 prout(_("statue in your memory. Rest in peace, and try not"));
325 prout(_("to think about pigeons."));
332 /* compute player's score */
334 double timused = game.state.date - game.indate;
335 int ithperd, iwon, klship;
338 if ((timused == 0 || (game.state.remkl + game.state.remcom + game.state.nscrem) != 0) && timused < 5.0)
340 perdate = ((game.inkling + game.incom + game.inscom) - (game.state.remkl + game.state.remcom + game.state.nscrem))/timused;
341 ithperd = 500*perdate + 0.5;
344 iwon = 100*game.skill;
345 if (game.ship == IHE)
347 else if (game.ship == IHF)
352 game.state.nromrem = 0; // None captured if no win
353 iscore = 10*(game.inkling - game.state.remkl) + 50*(game.incom - game.state.remcom) + ithperd + iwon
354 - 100*game.state.basekl - 100*klship - 45*game.nhelp -5*game.state.starkl - game.casual
355 + 20*(game.inrom - game.state.nromrem) + 200*(game.inscom - game.state.nscrem) - 10*game.state.nplankl - 300*game.state.nworldkl + game.state.nromrem;
359 prout(_("Your score --"));
360 if (game.inrom - game.state.nromrem)
361 prout(_("%6d Romulans destroyed %5d"),
362 game.inrom - game.state.nromrem, 20*(game.inrom - game.state.nromrem));
363 if (game.state.nromrem)
364 prout(_("%6d Romulans captured %5d"),
365 game.state.nromrem, game.state.nromrem);
366 if (game.inkling - game.state.remkl)
367 prout(_("%6d ordinary Klingons destroyed %5d"),
368 game.inkling - game.state.remkl, 10*(game.inkling - game.state.remkl));
369 if (game.incom - game.state.remcom)
370 prout(_("%6d Klingon commanders destroyed %5d"),
371 game.incom - game.state.remcom, 50*(game.incom - game.state.remcom));
372 if (game.inscom - game.state.nscrem)
373 prout(_("%6d Super-Commander destroyed %5d"),
374 game.inscom - game.state.nscrem, 200*(game.inscom - game.state.nscrem));
376 prout(_("%6.2f Klingons per stardate %5d"),
378 if (game.state.starkl)
379 prout(_("%6d stars destroyed by your action %5d"),
380 game.state.starkl, -5*game.state.starkl);
381 if (game.state.nplankl)
382 prout(_("%6d planets destroyed by your action %5d"),
383 game.state.nplankl, -10*game.state.nplankl);
384 if ((game.options & OPTION_WORLDS) && game.state.nworldkl)
385 prout(_("%6d inhabited planets destroyed by your action %5d"),
386 game.state.nplankl, -300*game.state.nworldkl);
387 if (game.state.basekl)
388 prout(_("%6d bases destroyed by your action %5d"),
389 game.state.basekl, -100*game.state.basekl);
391 prout(_("%6d calls for help from starbase %5d"),
392 game.nhelp, -45*game.nhelp);
394 prout(_("%6d casualties incurred %5d"),
395 game.casual, -game.casual);
397 prout(_("%6d crew abandoned in space %5d"),
398 game.abandoned, -3*game.abandoned);
400 prout(_("%6d ship(s) lost or destroyed %5d"),
401 klship, -100*klship);
403 prout(_("Penalty for getting yourself killed -200"));
405 proutn(_("Bonus for winning "));
406 switch (game.skill) {
407 case SKILL_NONE: break; /* quiet gcc warning */
408 case SKILL_NOVICE: proutn(_("Novice game ")); break;
409 case SKILL_FAIR: proutn(_("Fair game ")); break;
410 case SKILL_GOOD: proutn(_("Good game ")); break;
411 case SKILL_EXPERT: proutn(_("Expert game ")); break;
412 case SKILL_EMERITUS: proutn(_("Emeritus game")); break;
417 prout(_("TOTAL SCORE %5d"), iscore);
421 /* emit winner's commemmorative plaque */
431 proutn(_("File or device name for your plaque: "));
432 cgetline(winner, sizeof(winner));
433 fp = fopen(winner, "w");
435 prout(_("Invalid name."));
439 proutn(_("Enter name to go on plaque (up to 30 characters): "));
440 cgetline(winner, sizeof(winner));
441 /* The 38 below must be 64 for 132-column paper */
442 nskip = 38 - strlen(winner)/2;
444 fprintf(fp,"\n\n\n\n");
445 /* --------DRAW ENTERPRISE PICTURE. */
446 fprintf(fp, " EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE\n" );
447 fprintf(fp, " EEE E : : : E\n" );
448 fprintf(fp, " EE EEE E : : NCC-1701 : E\n");
449 fprintf(fp, "EEEEEEEEEEEEEEEE EEEEEEEEEEEEEEE : : : E\n");
450 fprintf(fp, " E EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE\n");
451 fprintf(fp, " EEEEEEEEE EEEEEEEEEEEEE E E\n");
452 fprintf(fp, " EEEEEEE EEEEE E E E E\n");
453 fprintf(fp, " EEE E E E E\n");
454 fprintf(fp, " E E E E\n");
455 fprintf(fp, " EEEEEEEEEEEEE E E\n");
456 fprintf(fp, " EEE : EEEEEEE EEEEEEEE\n");
457 fprintf(fp, " :E : EEEE E\n");
458 fprintf(fp, " .-E -:----- E\n");
459 fprintf(fp, " :E : E\n");
460 fprintf(fp, " EE : EEEEEEEE\n");
461 fprintf(fp, " EEEEEEEEEEEEEEEEEEEEEEE\n");
462 fprintf(fp, "\n\n\n");
463 fprintf(fp, _(" U. S. S. ENTERPRISE\n"));
464 fprintf(fp, "\n\n\n\n");
465 fprintf(fp, _(" For demonstrating outstanding ability as a starship captain\n"));
467 fprintf(fp, _(" Starfleet Command bestows to you\n"));
469 fprintf(fp,"%*s%s\n\n", nskip, "", winner);
470 fprintf(fp, _(" the rank of\n\n"));
471 fprintf(fp, _(" \"Commodore Emeritus\"\n\n"));
474 case SKILL_EXPERT: fprintf(fp,_(" Expert level\n\n")); break;
475 case SKILL_EMERITUS: fprintf(fp,_("Emeritus level\n\n")); break;
476 default: fprintf(fp,_(" Cheat level\n\n")); break;
479 timestring = ctime(&t);
480 fprintf(fp, _(" This day of %.6s %.4s, %.8s\n\n"),
481 timestring+4, timestring+20, timestring+11);
482 fprintf(fp,_(" Your score: %d\n\n"), iscore);
483 fprintf(fp,_(" Klingons per stardate: %.2f\n"), perdate);