9 #define c_printf proutn
12 void attakreport(int l) {
14 if (game.future[FCDBAS] < 1e30) {
15 prout("Starbase in %s is currently under Commander attack.",
16 cramlc(quadrant, batx, baty));
17 prout("It can hold out until Stardate %d.",
18 (int)game.future[FCDBAS]);
21 prout("Starbase in %s is under Super-commander attack.",
22 cramlc(quadrant, game.state.isx, game.state.isy));
23 prout("It can hold out until Stardate %d.",
24 (int)game.future[FSCDBAS]);
27 if (game.future[FCDBAS] < 1e30)
28 proutn("Base in %i - %i attacked by C. Alive until %.1f", batx, baty, game.future[FCDBAS]);
30 proutn("Base in %i - %i attacked by S. Alive until %.1f", game.state.isx, game.state.isy, game.future[FSCDBAS]);
42 s1 = (thawed?"thawed ":"");
44 case 1: s2="short"; break;
45 case 2: s2="medium"; break;
46 case 4: s2="long"; break;
47 default: s2="unknown length"; break;
50 case 1: s3="novice"; break;
51 case 2: s3="fair"; break;
52 case 3: s3="good"; break;
53 case 4: s3="expert"; break;
54 case 5: s3="emeritus"; break;
55 default: s3="skilled"; break;
58 prout("You %s playing a %s%s %s game.",
59 alldone? "were": "are now", s1, s2, s3);
60 if (skill>3 && thawed && !alldone) prout("No plaque is allowed.");
61 if (tourn) prout("This is tournament game %d.", tourn);
62 prout("Your secret password is \"%s\"",game.passwd);
63 proutn("%d of %d Klingons have been killed",
64 game.state.killk+game.state.killc+game.state.nsckill, inkling);
65 if (game.state.killc) prout(", including %d Commander%s.", game.state.killc, game.state.killc==1?"":"s");
66 else if (game.state.killk+game.state.nsckill > 0) prout(", but no Commanders.");
68 if (skill > 2) prout("The Super Commander has %sbeen destroyed.",
69 game.state.nscrem?"not ":"");
70 if (game.state.rembase != inbase) {
72 if (inbase-game.state.rembase==1) proutn("has been 1 base");
74 proutn("have been %d bases", inbase-game.state.rembase);
76 prout(" destroyed, %d remaining.", game.state.rembase);
78 else prout("There are %d bases.", inbase);
79 if (game.damage[DRADIO] == 0.0 || condit == IHDOCKED || iseenit) {
80 /* Don't report this if not seen and
81 either the radio is dead or not at base! */
85 if (casual) prout("%d casualt%s suffered so far.",
86 casual, casual==1? "y" : "ies");
87 if (nhelp) prout("There were %d call%s for help.",
88 nhelp, nhelp==1 ? "" : "s");
91 if (nprobes) proutn("%d", nprobes);
93 proutn(" deep space probe");
94 if (nprobes!=1) proutn("s");
97 if ((game.damage[DRADIO] == 0.0 || condit == IHDOCKED)&&
98 game.future[FDSPROB] != 1e30) {
100 proutn("An armed deep space probe is in");
102 proutn("A deep space probe is in");
103 proutn(cramlc(quadrant, probecx, probecy));
108 prout("Dilithium crystals aboard ship... not yet used.");
112 while (cryprob > ai) {
116 prout("Dilithium crystals have been used %d time%s.",
126 if (game.damage[DLRSENS] != 0.0) {
127 /* Now allow base's sensors if docked */
128 if (condit != IHDOCKED) {
129 prout("LONG-RANGE SENSORS DAMAGED.");
132 proutn("Starbase's long-range scan");
135 prout("Long-range scan");
137 for (x = quadx-1; x <= quadx+1; x++) {
139 for (y = quady-1; y <= quady+1; y++) {
140 if (x == 0 || x > 8 || y == 0 || y > 8)
143 if (game.state.galaxy[x][y]<1000) proutn(" %3d", game.state.galaxy[x][y]);
145 game.starch[x][y] = game.damage[DRADIO] > 0 ? game.state.galaxy[x][y]+1000 : 1;
156 for (i = 1; i <= NDEVICES; i++) {
157 if (game.damage[i] > 0.0) {
159 prout("DEVICE -REPAIR TIMES-");
160 prout(" IN FLIGHT DOCKED");
163 prout(" %16s %8.2f %8.2f",
166 docfac*game.damage[i]+0.005);
169 if (!jdam) prout("All devices functional.");
176 if (stdamtim != 1e30 && stdamtim != game.state.date && condit == IHDOCKED) {
177 c_printf("Spock- \"I revised the Star Chart from the starbase's records.\"\n\r");
179 if (nn == 0) c_printf(" STAR CHART FOR THE KNOWN GALAXY\n\r");
180 if (stdamtim != 1e30) {
181 if (condit == IHDOCKED) {
182 /* We are docked, so restore chart from base information */
183 stdamtim = game.state.date;
184 for (i=1; i <= 8 ; i++)
185 for (j=1; j <= 8; j++)
186 if (game.starch[i][j] == 1) game.starch[i][j] = game.state.galaxy[i][j]+1000;
189 proutn("(Last surveillance update %d stardates ago.",
190 (int)(game.state.date-stdamtim));
194 prout(" 1 2 3 4 5 6 7 8");
195 for (i = 1; i <= 8; i++) {
197 for (j = 1; j <= 8; j++) {
200 if (game.starch[i][j] < 0)
202 else if (game.starch[i][j] == 0)
204 else if (game.starch[i][j] > 999)
205 if ((i==quadx)&&(j==quady)){
207 gotoxy(wherex()-1,wherey());
209 if (game.starch[i][i]<2000)
210 sprintf(buf, "%03d", game.starch[i][j]-1000);
215 if (game.starch[i][j]<2000)
216 sprintf(buf, "%03d", game.starch[i][j]-1000);
219 else if ((i==quadx)&&(j==quady)){
221 gotoxy(wherex()-1,wherey());
223 sprintf(buf, "%03d", game.state.galaxy[i][j]);
225 else if (game.state.galaxy[i][j]>=1000)
228 sprintf(buf, "%03d", game.state.galaxy[i][j]);
229 for (cp = buf; cp < buf + sizeof(buf); cp++)
235 if (i<8) c_printf("\n\r");
238 proutn(""); /* flush output */
247 int leftside=TRUE, rightside=TRUE, i, j, jj, k=0, nn=FALSE, t, dam=0;
251 if (game.damage[DSRSENS] != 0) {
252 /* Allow base's sensors if docked */
253 if (condit != IHDOCKED) {
254 prout(" S.R. SENSORS DAMAGED!");
258 prout(" [Using Base's sensors]");
260 else c_printf(" Short-range scan\n\r");
261 if (goodScan) game.starch[quadx][quady] = game.damage[DRADIO]>0.0 ? game.state.galaxy[quadx][quady]+1000:1;
263 if (isit("chart")) nn = TRUE;
266 c_printf(" 1 2 3 4 5 6 7 8 9 10\n\r");
276 if (condit != IHDOCKED) newcnd();
277 for (i = 1; i <= 10; i++) {
281 for (j = 1; j <= 10; j++) {
282 if (goodScan || (abs(i-sectx)<= 1 && abs(j-secty) <= 1)){
283 if ((game.quad[i][j]==IHMATER0)||(game.quad[i][j]==IHMATER1)||(game.quad[i][j]==IHMATER2)||(game.quad[i][j]==IHE)||(game.quad[i][j]==IHF)){
286 case IHRED: textcolor(RED); break;
287 case IHGREEN: textcolor(GREEN); break;
288 case IHYELLOW: textcolor(YELLOW); break;
289 case IHDOCKED: textcolor(LIGHTGRAY); break;
290 case IHDEAD: textcolor(WHITE);
292 if (game.quad[i][j]!=ship) highvideo();
296 if (game.quad[i][j] & 128) highvideo();
298 c_printf("%c ",game.quad[i][j] & 127);
300 textcolor(LIGHTGRAY);
310 proutn("Stardate %.1f, Time Left %.2f", game.state.date, game.state.remtime);
313 if (condit != IHDOCKED) newcnd();
315 case IHRED: cp = "RED"; break;
316 case IHGREEN: cp = "GREEN"; break;
317 case IHYELLOW: cp = "YELLOW"; break;
318 case IHDOCKED: cp = "DOCKED"; break;
319 case IHDEAD: cp="DEAD"; break;
321 for (t=0;t<=NDEVICES;t++)
322 if (game.damage[t]>0) dam++;
323 proutn("Condition %s, %i DAMAGES", cp, dam);
326 proutn("Position %d - %d , %d - %d",
327 quadx, quady, sectx, secty);
330 proutn("Life Support ");
331 if (game.damage[DLIFSUP] != 0.0) {
332 if (condit == IHDOCKED)
333 proutn("DAMAGED, Base provides");
335 proutn("DAMAGED, reserves=%4.2f", lsupres);
341 proutn("Warp Factor %.1f", warpfac);
344 proutn("Energy %.2f", energy);
347 proutn("Torpedoes %d", torps);
351 if (game.damage[DSHIELD] != 0)
357 proutn(" %d%% %.1f units",
358 (int)((100.0*shield)/inshld + 0.5), shield);
361 proutn("Klingons Left %d", game.state.remkl);
368 if (i<10) c_printf("\n\r");
369 if (k!=0) return(goodScan);
382 int ix1, ix2, iy1, iy2, prompt=FALSE;
384 double ttime, twarp, tpower;
385 if (game.damage[DCOMPTR] != 0.0) {
386 prout("COMPUTER DAMAGED, USE A POCKET CALCULATOR.");
390 if (scan() != IHREAL) {
393 proutn("Destination quadrant and/or sector? ");
394 if (scan()!=IHREAL) {
400 if (scan() != IHREAL) {
405 if (scan() == IHREAL) {
407 if (scan() != IHREAL) {
414 if (quady>ix1) ix2 = 1;
416 if (quadx>iy1) iy2 = 1;
420 if (ix1 > 8 || ix1 < 1 || iy1 > 8 || iy1 < 1 ||
421 ix2 > 10 || ix2 < 1 || iy2 > 10 || iy2 < 1) {
425 dist = sqrt(square(iy1-quadx+0.1*(iy2-sectx))+
426 square(ix1-quady+0.1*(ix2-secty)));
429 if (prompt) prout("Answer \"no\" if you don't know the value:");
432 proutn("Time or arrival date? ");
433 if (scan()==IHREAL) {
435 if (ttime > game.state.date) ttime -= game.state.date; // Actually a star date
436 if (ttime <= 1e-10 ||
437 (twarp=(floor(sqrt((10.0*dist)/ttime)*10.0)+1.0)/10.0) > 10) {
438 prout("We'll never make it, sir.");
442 if (twarp < 1.0) twarp = 1.0;
446 proutn("Warp factor? ");
447 if (scan()== IHREAL) {
450 if (twarp<1.0 || twarp > 10.0) {
456 prout("Captain, certainly you can give me one of these.");
460 ttime = (10.0*dist)/square(twarp);
461 tpower = dist*twarp*twarp*twarp*(shldup+1);
462 if (tpower >= energy) {
463 prout("Insufficient energy, sir.");
464 if (shldup==0 || tpower > energy*2.0) {
466 proutn("New warp factor to try? ");
467 if (scan() == IHREAL) {
470 if (twarp<1.0 || twarp > 10.0) {
482 prout("But if you lower your shields,");
488 prout(" energy will be %.2f.", energy-tpower);
490 prout("And we will arrive at stardate %.2f.",
491 game.state.date+ttime);
494 prout("Any warp speed is adequate.");
496 prout("Minimum warp needed is %.2f,", twarp);
497 prout("and we will arrive at stardate %.2f.",
498 game.state.date+ttime);
500 if (game.state.remtime < ttime)
501 prout("Unfortunately, the Federation will be destroyed by then.");
503 prout("You'll be taking risks at that speed, Captain");
504 if ((isatb==1 && game.state.isy == ix1 && game.state.isx == iy1 &&
505 game.future[FSCDBAS]< ttime+game.state.date)||
506 (game.future[FCDBAS]<ttime+game.state.date && baty==ix1 && batx == iy1))
507 prout("The starbase there will be destroyed by then.");
508 proutn("New warp factor to try? ");
509 if (scan() == IHREAL) {
512 if (twarp<1.0 || twarp > 10.0) {