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 */
232 static char requests[][3] =
233 {"","da","co","po","ls","wa","en","to","sh","kl","ti"};
235 int leftside=TRUE, rightside=TRUE, i, j, jj, k=0, nn=FALSE, t, dam=0;
238 case SCAN_FULL: // SRSCAN
239 if (game.damage[DSRSENS] != 0) {
240 /* Allow base's sensors if docked */
241 if (condit != IHDOCKED) {
242 prout(" S.R. SENSORS DAMAGED!");
246 prout(" [Using Base's sensors]");
248 else c_printf(" Short-range scan\n\r");
249 if (goodScan) game.starch[quadx][quady] = game.damage[DRADIO]>0.0 ? game.state.galaxy[quadx][quady]+1000:1;
251 if (isit("chart")) nn = TRUE;
252 if (isit("no")) rightside = FALSE;
254 c_printf(" 1 2 3 4 5 6 7 8 9 10\n\r");
257 while (scan() == IHEOL)
258 proutn("Information desired? ");
260 for (k = 1; k <= 10; k++)
261 if (strncmp(citem,requests[k],min(2,strlen(citem)))==0)
264 prout("UNRECOGNIZED REQUEST. Legal requests are:\n"
265 " date, condition, position, lsupport, warpfactor,\n"
266 " energy, torpedoes, shields, klingons, time.");
270 case SCAN_STATUS: // STATUS
274 case SCAN_NO_LEFTSIDE: // REQUEST
278 if (condit != IHDOCKED) newcnd();
279 for (i = 1; i <= 10; i++) {
283 for (j = 1; j <= 10; j++) {
284 if (goodScan || (abs(i-sectx)<= 1 && abs(j-secty) <= 1)){
285 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)){
287 case IHRED: textcolor(RED); break;
288 case IHGREEN: textcolor(GREEN); break;
289 case IHYELLOW: textcolor(YELLOW); break;
290 case IHDOCKED: textcolor(LIGHTGRAY); break;
291 case IHDEAD: textcolor(WHITE);
293 if (game.quad[i][j]!=ship) highvideo();
295 if (game.quad[i][j] & 128) highvideo();
296 c_printf("%c ",game.quad[i][j] & 127);
297 textcolor(LIGHTGRAY);
306 proutn("Stardate %.1f, Time Left %.2f", game.state.date, game.state.remtime);
309 if (condit != IHDOCKED) newcnd();
311 case IHRED: cp = "RED"; break;
312 case IHGREEN: cp = "GREEN"; break;
313 case IHYELLOW: cp = "YELLOW"; break;
314 case IHDOCKED: cp = "DOCKED"; break;
315 case IHDEAD: cp="DEAD"; break;
317 for (t=0;t<=NDEVICES;t++)
318 if (game.damage[t]>0) dam++;
319 proutn("Condition %s, %i DAMAGES", cp, dam);
322 proutn("Position %d - %d , %d - %d",
323 quadx, quady, sectx, secty);
326 proutn("Life Support ");
327 if (game.damage[DLIFSUP] != 0.0) {
328 if (condit == IHDOCKED)
329 proutn("DAMAGED, Base provides");
331 proutn("DAMAGED, reserves=%4.2f", lsupres);
337 proutn("Warp Factor %.1f", warpfac);
340 proutn("Energy %.2f", energy);
343 proutn("Torpedoes %d", torps);
347 if (game.damage[DSHIELD] != 0)
353 proutn(" %d%% %.1f units",
354 (int)((100.0*shield)/inshld + 0.5), shield);
357 proutn("Klingons Left %d", game.state.remkl);
364 if (i<10) c_printf("\n\r");
365 if (k!=0) return(goodScan);
374 int ix1, ix2, iy1, iy2, prompt=FALSE;
376 double ttime, twarp, tpower;
377 if (game.damage[DCOMPTR] != 0.0) {
378 prout("COMPUTER DAMAGED, USE A POCKET CALCULATOR.");
382 if (scan() != IHREAL) {
385 proutn("Destination quadrant and/or sector? ");
386 if (scan()!=IHREAL) {
392 if (scan() != IHREAL) {
397 if (scan() == IHREAL) {
399 if (scan() != IHREAL) {
406 if (quady>ix1) ix2 = 1;
408 if (quadx>iy1) iy2 = 1;
412 if (ix1 > 8 || ix1 < 1 || iy1 > 8 || iy1 < 1 ||
413 ix2 > 10 || ix2 < 1 || iy2 > 10 || iy2 < 1) {
417 dist = sqrt(square(iy1-quadx+0.1*(iy2-sectx))+
418 square(ix1-quady+0.1*(ix2-secty)));
421 if (prompt) prout("Answer \"no\" if you don't know the value:");
424 proutn("Time or arrival date? ");
425 if (scan()==IHREAL) {
427 if (ttime > game.state.date) ttime -= game.state.date; // Actually a star date
428 if (ttime <= 1e-10 ||
429 (twarp=(floor(sqrt((10.0*dist)/ttime)*10.0)+1.0)/10.0) > 10) {
430 prout("We'll never make it, sir.");
434 if (twarp < 1.0) twarp = 1.0;
438 proutn("Warp factor? ");
439 if (scan()== IHREAL) {
442 if (twarp<1.0 || twarp > 10.0) {
448 prout("Captain, certainly you can give me one of these.");
452 ttime = (10.0*dist)/square(twarp);
453 tpower = dist*twarp*twarp*twarp*(shldup+1);
454 if (tpower >= energy) {
455 prout("Insufficient energy, sir.");
456 if (shldup==0 || tpower > energy*2.0) {
458 proutn("New warp factor to try? ");
459 if (scan() == IHREAL) {
462 if (twarp<1.0 || twarp > 10.0) {
474 prout("But if you lower your shields,");
480 prout(" energy will be %.2f.", energy-tpower);
482 prout("And we will arrive at stardate %.2f.",
483 game.state.date+ttime);
486 prout("Any warp speed is adequate.");
488 prout("Minimum warp needed is %.2f,", twarp);
489 prout("and we will arrive at stardate %.2f.",
490 game.state.date+ttime);
492 if (game.state.remtime < ttime)
493 prout("Unfortunately, the Federation will be destroyed by then.");
495 prout("You'll be taking risks at that speed, Captain");
496 if ((isatb==1 && game.state.isy == ix1 && game.state.isx == iy1 &&
497 game.future[FSCDBAS]< ttime+game.state.date)||
498 (game.future[FCDBAS]<ttime+game.state.date && baty==ix1 && batx == iy1))
499 prout("The starbase there will be destroyed by then.");
500 proutn("New warp factor to try? ");
501 if (scan() == IHREAL) {
504 if (twarp<1.0 || twarp > 10.0) {