8 void attakreport(int l) {
10 if (game.future[FCDBAS] < 1e30) {
11 prout("Starbase in %s is currently under Commander attack.",
12 cramlc(quadrant, batx, baty));
13 prout("It can hold out until Stardate %d.",
14 (int)game.future[FCDBAS]);
17 prout("Starbase in %s is under Super-commander attack.",
18 cramlc(quadrant, game.state.isx, game.state.isy));
19 prout("It can hold out until Stardate %d.",
20 (int)game.future[FSCDBAS]);
23 if (game.future[FCDBAS] < 1e30)
24 proutn("Base in %i - %i attacked by C. Alive until %.1f", batx, baty, game.future[FCDBAS]);
26 proutn("Base in %i - %i attacked by S. Alive until %.1f", game.state.isx, game.state.isy, game.future[FSCDBAS]);
36 s1 = (thawed?"thawed ":"");
38 case 1: s2="short"; break;
39 case 2: s2="medium"; break;
40 case 4: s2="long"; break;
41 default: s2="unknown length"; break;
44 case 1: s3="novice"; break;
45 case 2: s3="fair"; break;
46 case 3: s3="good"; break;
47 case 4: s3="expert"; break;
48 case 5: s3="emeritus"; break;
49 default: s3="skilled"; break;
52 prout("You %s playing a %s%s %s game.",
53 alldone? "were": "are now", s1, s2, s3);
54 if (skill>3 && thawed && !alldone) prout("No plaque is allowed.");
55 if (tourn) prout("This is tournament game %d.", tourn);
56 prout("Your secret password is \"%s\"",game.passwd);
57 proutn("%d of %d Klingons have been killed",
58 game.state.killk+game.state.killc+game.state.nsckill, inkling);
59 if (game.state.killc) prout(", including %d Commander%s.", game.state.killc, game.state.killc==1?"":"s");
60 else if (game.state.killk+game.state.nsckill > 0) prout(", but no Commanders.");
62 if (skill > 2) prout("The Super Commander has %sbeen destroyed.",
63 game.state.nscrem?"not ":"");
64 if (game.state.rembase != inbase) {
66 if (inbase-game.state.rembase==1) proutn("has been 1 base");
68 proutn("have been %d bases", inbase-game.state.rembase);
70 prout(" destroyed, %d remaining.", game.state.rembase);
72 else prout("There are %d bases.", inbase);
73 if (game.damage[DRADIO] == 0.0 || condit == IHDOCKED || iseenit) {
74 /* Don't report this if not seen and
75 either the radio is dead or not at base! */
79 if (casual) prout("%d casualt%s suffered so far.",
80 casual, casual==1? "y" : "ies");
81 if (nhelp) prout("There were %d call%s for help.",
82 nhelp, nhelp==1 ? "" : "s");
85 if (nprobes) proutn("%d", nprobes);
87 proutn(" deep space probe");
88 if (nprobes!=1) proutn("s");
91 if ((game.damage[DRADIO] == 0.0 || condit == IHDOCKED)&&
92 game.future[FDSPROB] != 1e30) {
94 proutn("An armed deep space probe is in");
96 proutn("A deep space probe is in");
97 proutn(cramlc(quadrant, probecx, probecy));
102 prout("Dilithium crystals aboard ship... not yet used.");
106 while (cryprob > ai) {
110 prout("Dilithium crystals have been used %d time%s.",
120 if (game.damage[DLRSENS] != 0.0) {
121 /* Now allow base's sensors if docked */
122 if (condit != IHDOCKED) {
123 prout("LONG-RANGE SENSORS DAMAGED.");
126 proutn("Starbase's long-range scan");
129 prout("Long-range scan");
131 for (x = quadx-1; x <= quadx+1; x++) {
133 for (y = quady-1; y <= quady+1; y++) {
134 if (x == 0 || x > 8 || y == 0 || y > 8)
137 if (game.state.galaxy[x][y]<1000) proutn(" %3d", game.state.galaxy[x][y]);
139 game.starch[x][y] = game.damage[DRADIO] > 0 ? game.state.galaxy[x][y]+1000 : 1;
150 for (i = 1; i <= NDEVICES; i++) {
151 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.");
170 if (stdamtim != 1e30 && stdamtim != game.state.date && condit == IHDOCKED) {
171 c_printf("Spock- \"I revised the Star Chart from the starbase's records.\"\n\r");
173 if (nn == 0) c_printf(" STAR CHART FOR THE KNOWN GALAXY\n\r");
174 if (stdamtim != 1e30) {
175 if (condit == IHDOCKED) {
176 /* We are docked, so restore chart from base information */
177 stdamtim = game.state.date;
178 for (i=1; i <= 8 ; i++)
179 for (j=1; j <= 8; j++)
180 if (game.starch[i][j] == 1) game.starch[i][j] = game.state.galaxy[i][j]+1000;
183 proutn("(Last surveillance update %d stardates ago.",
184 (int)(game.state.date-stdamtim));
188 prout(" 1 2 3 4 5 6 7 8");
189 for (i = 1; i <= 8; i++) {
191 for (j = 1; j <= 8; j++) {
194 if (game.starch[i][j] < 0)
196 else if (game.starch[i][j] == 0)
198 else if (game.starch[i][j] > 999)
199 if ((i==quadx)&&(j==quady)){
200 gotoxy(wherex()-1,wherey());
201 if (game.starch[i][i]<2000)
202 sprintf(buf, "%03d", game.starch[i][j]-1000);
207 if (game.starch[i][j]<2000)
208 sprintf(buf, "%03d", game.starch[i][j]-1000);
211 else if ((i==quadx)&&(j==quady)){
212 gotoxy(wherex()-1,wherey());
213 sprintf(buf, "%03d", game.state.galaxy[i][j]);
215 else if (game.state.galaxy[i][j]>=1000)
218 sprintf(buf, "%03d", game.state.galaxy[i][j]);
219 for (cp = buf; cp < buf + sizeof(buf); cp++)
225 if (i<8) c_printf("\n\r");
227 prout(""); /* flush output */
233 int leftside=TRUE, rightside=TRUE, i, j, jj, k=0, nn=FALSE, t, dam=0;
237 if (game.damage[DSRSENS] != 0) {
238 /* Allow base's sensors if docked */
239 if (condit != IHDOCKED) {
240 prout(" S.R. SENSORS DAMAGED!");
244 prout(" [Using Base's sensors]");
246 else c_printf(" Short-range scan\n\r");
247 if (goodScan) game.starch[quadx][quady] = game.damage[DRADIO]>0.0 ? game.state.galaxy[quadx][quady]+1000:1;
249 if (isit("chart")) nn = TRUE;
252 c_printf(" 1 2 3 4 5 6 7 8 9 10\n\r");
262 if (condit != IHDOCKED) newcnd();
263 for (i = 1; i <= 10; i++) {
267 for (j = 1; j <= 10; j++) {
268 if (goodScan || (abs(i-sectx)<= 1 && abs(j-secty) <= 1)){
269 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)){
271 case IHRED: textcolor(RED); break;
272 case IHGREEN: textcolor(GREEN); break;
273 case IHYELLOW: textcolor(YELLOW); break;
274 case IHDOCKED: textcolor(LIGHTGRAY); break;
275 case IHDEAD: textcolor(WHITE);
277 if (game.quad[i][j]!=ship) highvideo();
279 if (game.quad[i][j] & 128) highvideo();
280 c_printf("%c ",game.quad[i][j] & 127);
281 textcolor(LIGHTGRAY);
290 proutn("Stardate %.1f, Time Left %.2f", game.state.date, game.state.remtime);
293 if (condit != IHDOCKED) newcnd();
295 case IHRED: cp = "RED"; break;
296 case IHGREEN: cp = "GREEN"; break;
297 case IHYELLOW: cp = "YELLOW"; break;
298 case IHDOCKED: cp = "DOCKED"; break;
299 case IHDEAD: cp="DEAD"; break;
301 for (t=0;t<=NDEVICES;t++)
302 if (game.damage[t]>0) dam++;
303 proutn("Condition %s, %i DAMAGES", cp, dam);
306 proutn("Position %d - %d , %d - %d",
307 quadx, quady, sectx, secty);
310 proutn("Life Support ");
311 if (game.damage[DLIFSUP] != 0.0) {
312 if (condit == IHDOCKED)
313 proutn("DAMAGED, Base provides");
315 proutn("DAMAGED, reserves=%4.2f", lsupres);
321 proutn("Warp Factor %.1f", warpfac);
324 proutn("Energy %.2f", energy);
327 proutn("Torpedoes %d", torps);
331 if (game.damage[DSHIELD] != 0)
337 proutn(" %d%% %.1f units",
338 (int)((100.0*shield)/inshld + 0.5), shield);
341 proutn("Klingons Left %d", game.state.remkl);
348 if (i<10) c_printf("\n\r");
349 if (k!=0) return(goodScan);
358 int ix1, ix2, iy1, iy2, prompt=FALSE;
360 double ttime, twarp, tpower;
361 if (game.damage[DCOMPTR] != 0.0) {
362 prout("COMPUTER DAMAGED, USE A POCKET CALCULATOR.");
366 if (scan() != IHREAL) {
369 proutn("Destination quadrant and/or sector? ");
370 if (scan()!=IHREAL) {
376 if (scan() != IHREAL) {
381 if (scan() == IHREAL) {
383 if (scan() != IHREAL) {
390 if (quady>ix1) ix2 = 1;
392 if (quadx>iy1) iy2 = 1;
396 if (ix1 > 8 || ix1 < 1 || iy1 > 8 || iy1 < 1 ||
397 ix2 > 10 || ix2 < 1 || iy2 > 10 || iy2 < 1) {
401 dist = sqrt(square(iy1-quadx+0.1*(iy2-sectx))+
402 square(ix1-quady+0.1*(ix2-secty)));
405 if (prompt) prout("Answer \"no\" if you don't know the value:");
408 proutn("Time or arrival date? ");
409 if (scan()==IHREAL) {
411 if (ttime > game.state.date) ttime -= game.state.date; // Actually a star date
412 if (ttime <= 1e-10 ||
413 (twarp=(floor(sqrt((10.0*dist)/ttime)*10.0)+1.0)/10.0) > 10) {
414 prout("We'll never make it, sir.");
418 if (twarp < 1.0) twarp = 1.0;
422 proutn("Warp factor? ");
423 if (scan()== IHREAL) {
426 if (twarp<1.0 || twarp > 10.0) {
432 prout("Captain, certainly you can give me one of these.");
436 ttime = (10.0*dist)/square(twarp);
437 tpower = dist*twarp*twarp*twarp*(shldup+1);
438 if (tpower >= energy) {
439 prout("Insufficient energy, sir.");
440 if (shldup==0 || tpower > energy*2.0) {
442 proutn("New warp factor to try? ");
443 if (scan() == IHREAL) {
446 if (twarp<1.0 || twarp > 10.0) {
458 prout("But if you lower your shields,");
464 prout(" energy will be %.2f.", energy-tpower);
466 prout("And we will arrive at stardate %.2f.",
467 game.state.date+ttime);
470 prout("Any warp speed is adequate.");
472 prout("Minimum warp needed is %.2f,", twarp);
473 prout("and we will arrive at stardate %.2f.",
474 game.state.date+ttime);
476 if (game.state.remtime < ttime)
477 prout("Unfortunately, the Federation will be destroyed by then.");
479 prout("You'll be taking risks at that speed, Captain");
480 if ((isatb==1 && game.state.isy == ix1 && game.state.isx == iy1 &&
481 game.future[FSCDBAS]< ttime+game.state.date)||
482 (game.future[FCDBAS]<ttime+game.state.date && baty==ix1 && batx == iy1))
483 prout("The starbase there will be destroyed by then.");
484 proutn("New warp factor to try? ");
485 if (scan() == IHREAL) {
488 if (twarp<1.0 || twarp > 10.0) {