6 void attakreport(int l) {
\r
8 if (game.future[FCDBAS] < 1e30) {
\r
9 prout("Starbase in %s is currently under Commander attack.",
\r
10 cramlc(quadrant, batx, baty));
\r
11 prout("It can hold out until Stardate %d.",
\r
12 (int)game.future[FCDBAS]);
\r
15 prout("Starbase in %s is under Super-commander attack.",
\r
16 cramlc(quadrant, game.state.isx, game.state.isy));
\r
17 prout("It can hold out until Stardate %d.",
\r
18 (int)game.future[FSCDBAS]);
\r
21 if (game.future[FCDBAS] < 1e30)
\r
22 proutn("Base in %i - %i attacked by C. Alive until %.1f", batx, baty, game.future[FCDBAS]);
\r
24 proutn("Base in %i - %i attacked by S. Alive until %.1f", game.state.isx, game.state.isy, game.future[FSCDBAS]);
\r
29 void report(int f) {
\r
33 s1 = (thawed?"thawed ":"");
\r
35 case 1: s2="short"; break;
\r
36 case 2: s2="medium"; break;
\r
37 case 4: s2="long"; break;
\r
38 default: s2="unknown length"; break;
\r
41 case 1: s3="novice"; break;
\r
42 case 2: s3="fair"; break;
\r
43 case 3: s3="good"; break;
\r
44 case 4: s3="expert"; break;
\r
45 case 5: s3="emeritus"; break;
\r
46 default: s3="skilled"; break;
\r
49 prout("You %s playing a %s%s %s game.",
\r
50 alldone? "were": "are now", s1, s2, s3);
\r
51 if (skill>3 && thawed && !alldone) prout("No plaque is allowed.");
\r
52 if (tourn) prout("This is tournament game %d.", tourn);
\r
53 if (f) prout("Your secret password is \"%s\"",game.passwd);
\r
54 proutn("%d of %d Klingons have been killed",
\r
55 game.state.killk+game.state.killc+game.state.nsckill, inkling);
\r
56 if (game.state.killc) prout(", including %d Commander%s.", game.state.killc, game.state.killc==1?"":"s");
\r
57 else if (game.state.killk+game.state.nsckill > 0) prout(", but no Commanders.");
\r
59 if (skill > 2) prout("The Super Commander has %sbeen destroyed.",
\r
60 game.state.nscrem?"not ":"");
\r
61 if (game.state.rembase != inbase) {
\r
63 if (inbase-game.state.rembase==1) proutn("has been 1 base");
\r
65 proutn("have been %d bases", inbase-game.state.rembase);
\r
67 prout(" destroyed, %d remaining.", game.state.rembase);
\r
69 else prout("There are %d bases.", inbase);
\r
70 if (game.damage[DRADIO] == 0.0 || condit == IHDOCKED || iseenit) {
\r
71 /* Don't report this if not seen and
\r
72 either the radio is dead or not at base! */
\r
76 if (casual) prout("%d casualt%s suffered so far.",
\r
77 casual, casual==1? "y" : "ies");
\r
78 if (nhelp) prout("There were %d call%s for help.",
\r
79 nhelp, nhelp==1 ? "" : "s");
\r
81 proutn("You have ");
\r
82 if (nprobes) proutn("%d", nprobes);
\r
84 proutn(" deep space probe");
\r
85 if (nprobes!=1) proutn("s");
\r
88 if ((game.damage[DRADIO] == 0.0 || condit == IHDOCKED)&&
\r
89 game.future[FDSPROB] != 1e30) {
\r
91 proutn("An armed deep space probe is in");
\r
93 proutn("A deep space probe is in");
\r
94 proutn(cramlc(quadrant, probecx, probecy));
\r
99 prout("Dilithium crystals aboard ship... not yet used.");
\r
103 while (cryprob > ai) {
\r
107 prout("Dilithium crystals have been used %d time%s.",
\r
108 i, i==1? "" : "s");
\r
114 void lrscan(void) {
\r
117 if (game.damage[DLRSENS] != 0.0) {
\r
118 /* Now allow base's sensors if docked */
\r
119 if (condit != IHDOCKED) {
\r
120 prout("LONG-RANGE SENSORS DAMAGED.");
\r
124 proutn("Starbase's long-range scan for");
\r
128 proutn("Long-range scan for ");
\r
130 prout(cramlc(quadrant, quadx, quady));
\r
131 for (x = quadx-1; x <= quadx+1; x++) {
\r
132 for (y = quady-1; y <= quady+1; y++) {
\r
133 if (x == 0 || x > 8 || y == 0 || y > 8)
\r
136 proutn("%5d", game.state.galaxy[x][y]);
\r
137 game.starch[x][y] = game.damage[DRADIO] > 0 ? game.state.galaxy[x][y]+1000 :1;
\r
145 void dreprt(void) {
\r
146 int jdam = FALSE, i;
\r
149 for (i = 1; i <= NDEVICES; i++) {
\r
150 if (game.damage[i] > 0.0) {
\r
153 prout("DEVICE -REPAIR TIMES-");
\r
154 prout(" IN FLIGHT DOCKED");
\r
157 prout(" %16s %8.2f %8.2f",
\r
159 game.damage[i]+0.05,
\r
160 docfac*game.damage[i]+0.005);
\r
163 if (!jdam) prout("All devices functional.");
\r
166 void chart(int nn) {
\r
171 if (stdamtim != 1e30 && stdamtim != game.state.date && condit == IHDOCKED) {
\r
172 prout("Spock- \"I revised the Star Chart from the");
\r
173 prout(" starbase's records.\"");
\r
176 if (nn == 0) prout("STAR CHART FOR THE KNOWN GALAXY");
\r
177 if (stdamtim != 1e30) {
\r
178 if (condit == IHDOCKED) {
\r
179 /* We are docked, so restore chart from base information */
\r
180 stdamtim = game.state.date;
\r
181 for (i=1; i <= 8 ; i++)
\r
182 for (j=1; j <= 8; j++)
\r
183 if (game.starch[i][j] == 1) game.starch[i][j] = game.state.galaxy[i][j]+1000;
\r
186 proutn("(Last surveillance update %d stardates ago.",
\r
187 (int)(game.state.date-stdamtim));
\r
190 if (nn ==0) skip(1);
\r
192 prout(" 1 2 3 4 5 6 7 8");
\r
193 prout(" ----------------------------------------");
\r
194 /* if (nn==0) prout(" -"); */
\r
195 for (i = 1; i <= 8; i++) {
\r
197 for (j = 1; j <= 8; j++) {
\r
198 if (game.starch[i][j] < 0)
\r
200 else if (game.starch[i][j] == 0)
\r
202 else if (game.starch[i][j] > 999)
\r
203 proutn("%5d", game.starch[i][j]-1000);
\r
205 proutn("%5d", game.state.galaxy[i][j]);
\r
212 prout(" is currently in %s", cramlc(quadrant, quadx, quady));
\r
217 void srscan(int l) {
\r
218 static char requests[][3] =
\r
219 {"","da","co","po","ls","wa","en","to","sh","kl","ti"};
\r
221 int leftside=TRUE, rightside=TRUE, i, j, k=0, nn=FALSE;
\r
225 if (game.damage[DSRSENS] != 0) {
\r
226 /* Allow base's sensors if docked */
\r
227 if (condit != IHDOCKED) {
\r
228 prout("SHORT-RANGE SENSORS DAMAGED");
\r
232 prout("[Using starbase's sensors]");
\r
235 game.starch[quadx][quady] = game.damage[DRADIO]>0.0 ?
\r
236 game.state.galaxy[quadx][quady]+1000:1;
\r
238 if (isit("chart")) nn = TRUE;
\r
239 if (isit("no")) rightside = FALSE;
\r
241 prout("\n 1 2 3 4 5 6 7 8 9 10");
\r
244 while (scan() == IHEOL)
\r
245 proutn("Information desired? ");
\r
247 for (k = 1; k <= 10; k++)
\r
248 if (strncmp(citem,requests[k],min(2,strlen(citem)))==0)
\r
251 prout("UNRECOGNIZED REQUEST. Legal requests are:\n"
\r
252 " date, condition, position, lsupport, warpfactor,\n"
\r
253 " energy, torpedoes, shields, klingons, time.");
\r
262 for (i = 1; i <= 10; i++) {
\r
263 int jj = (k!=0 ? k : i);
\r
266 for (j = 1; j <= 10; j++) {
\r
267 if (goodScan || (abs(i-sectx)<= 1 && abs(j-secty) <= 1))
\r
268 proutn("%c ",game.quad[i][j]);
\r
276 proutn(" Stardate %.1f", game.state.date);
\r
279 if (condit != IHDOCKED) newcnd();
\r
281 case IHRED: cp = "RED"; break;
\r
282 case IHGREEN: cp = "GREEN"; break;
\r
283 case IHYELLOW: cp = "YELLOW"; break;
\r
284 case IHDOCKED: cp = "DOCKED"; break;
\r
286 proutn(" Condition %s", cp);
\r
289 proutn(" Position ");
\r
290 proutn(cramlc(neither, quadx, quady));
\r
292 proutn(cramlc(neither, sectx, secty));
\r
295 proutn(" Life Support ");
\r
296 if (game.damage[DLIFSUP] != 0.0) {
\r
297 if (condit == IHDOCKED)
\r
298 proutn("DAMAGED, supported by starbase");
\r
300 proutn("DAMAGED, reserves=%.2f", lsupres);
\r
306 proutn(" Warp Factor %.1f", warpfac);
\r
309 proutn(" Energy %.2f", energy);
\r
312 proutn(" Torpedoes %d", torps);
\r
315 proutn(" Shields ");
\r
316 if (game.damage[DSHIELD] != 0)
\r
317 proutn("DAMAGED,");
\r
322 proutn(" %d%% %.1f units",
\r
323 (int)((100.0*shield)/inshld + 0.5), shield);
\r
326 proutn(" Klingons Left %d", game.state.remkl);
\r
342 int ix1, ix2, iy1, iy2, prompt=FALSE;
\r
344 double ttime, twarp, tpower;
\r
345 if (game.damage[DCOMPTR] != 0.0) {
\r
346 prout("COMPUTER DAMAGED, USE A POCKET CALCULATOR.");
\r
350 if (scan() != IHREAL) {
\r
353 proutn("Destination quadrant and/or sector? ");
\r
354 if (scan()!=IHREAL) {
\r
360 if (scan() != IHREAL) {
\r
364 ix1 = aaitem + 0.5;
\r
365 if (scan() == IHREAL) {
\r
366 iy2 = aaitem + 0.5;
\r
367 if (scan() != IHREAL) {
\r
371 ix2 = aaitem + 0.5;
\r
374 if (quady>ix1) ix2 = 1;
\r
376 if (quadx>iy1) iy2 = 1;
\r
380 if (ix1 > 8 || ix1 < 1 || iy1 > 8 || iy1 < 1 ||
\r
381 ix2 > 10 || ix2 < 1 || iy2 > 10 || iy2 < 1) {
\r
385 dist = sqrt(square(iy1-quadx+0.1*(iy2-sectx))+
\r
386 square(ix1-quady+0.1*(ix2-secty)));
\r
389 if (prompt) prout("Answer \"no\" if you don't know the value:");
\r
392 proutn("Time or arrival date? ");
\r
393 if (scan()==IHREAL) {
\r
395 if (ttime > game.state.date) ttime -= game.state.date; // Actually a star date
\r
396 if (ttime <= 1e-10 ||
\r
397 (twarp=(floor(sqrt((10.0*dist)/ttime)*10.0)+1.0)/10.0) > 10) {
\r
398 prout("We'll never make it, sir.");
\r
402 if (twarp < 1.0) twarp = 1.0;
\r
406 proutn("Warp factor? ");
\r
407 if (scan()== IHREAL) {
\r
410 if (twarp<1.0 || twarp > 10.0) {
\r
416 prout("Captain, certainly you can give me one of these.");
\r
420 ttime = (10.0*dist)/square(twarp);
\r
421 tpower = dist*twarp*twarp*twarp*(shldup+1);
\r
422 if (tpower >= energy) {
\r
423 prout("Insufficient energy, sir.");
\r
424 if (shldup==0 || tpower > energy*2.0) {
\r
426 proutn("New warp factor to try? ");
\r
427 if (scan() == IHREAL) {
\r
430 if (twarp<1.0 || twarp > 10.0) {
\r
442 prout("But if you lower your shields,");
\r
443 proutn("remaining");
\r
447 proutn("Remaining");
\r
448 prout(" energy will be %.2f.", energy-tpower);
\r
450 prout("And we will arrive at stardate %.2f.",
\r
451 game.state.date+ttime);
\r
453 else if (twarp==1.0)
\r
454 prout("Any warp speed is adequate.");
\r
456 prout("Minimum warp needed is %.2f,", twarp);
\r
457 prout("and we will arrive at stardate %.2f.",
\r
458 game.state.date+ttime);
\r
460 if (game.state.remtime < ttime)
\r
461 prout("Unfortunately, the Federation will be destroyed by then.");
\r
463 prout("You'll be taking risks at that speed, Captain");
\r
464 if ((isatb==1 && game.state.isy == ix1 && game.state.isx == iy1 &&
\r
465 game.future[FSCDBAS]< ttime+game.state.date)||
\r
466 (game.future[FCDBAS]<ttime+game.state.date && baty==ix1 && batx == iy1))
\r
467 prout("The starbase there will be destroyed by then.");
\r
468 proutn("New warp factor to try? ");
\r
469 if (scan() == IHREAL) {
\r
472 if (twarp<1.0 || twarp > 10.0) {
\r