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