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]);
34 s1 = (thawed?"thawed ":"");
36 case 1: s2="short"; break;
37 case 2: s2="medium"; break;
38 case 4: s2="long"; break;
39 default: s2="unknown length"; break;
42 case 1: s3="novice"; break;
43 case 2: s3="fair"; break;
44 case 3: s3="good"; break;
45 case 4: s3="expert"; break;
46 case 5: s3="emeritus"; break;
47 default: s3="skilled"; break;
50 prout("You %s playing a %s%s %s game.",
51 alldone? "were": "are now", s1, s2, s3);
52 if (skill>3 && thawed && !alldone) prout("No plaque is allowed.");
53 if (tourn) prout("This is tournament game %d.", tourn);
54 prout("Your secret password is \"%s\"",game.passwd);
55 proutn("%d of %d Klingons have been killed",
56 game.state.killk+game.state.killc+game.state.nsckill, inkling);
57 if (game.state.killc) prout(", including %d Commander%s.", game.state.killc, game.state.killc==1?"":"s");
58 else if (game.state.killk+game.state.nsckill > 0) prout(", but no Commanders.");
60 if (skill > 2) prout("The Super Commander has %sbeen destroyed.",
61 game.state.nscrem?"not ":"");
62 if (game.state.rembase != inbase) {
64 if (inbase-game.state.rembase==1) proutn("has been 1 base");
66 proutn("have been %d bases", inbase-game.state.rembase);
68 prout(" destroyed, %d remaining.", game.state.rembase);
70 else prout("There are %d bases.", inbase);
71 if (game.damage[DRADIO] == 0.0 || condit == IHDOCKED || iseenit) {
72 /* Don't report this if not seen and
73 either the radio is dead or not at base! */
77 if (casual) prout("%d casualt%s suffered so far.",
78 casual, casual==1? "y" : "ies");
79 if (nhelp) prout("There were %d call%s for help.",
80 nhelp, nhelp==1 ? "" : "s");
83 if (nprobes) proutn("%d", nprobes);
85 proutn(" deep space probe");
86 if (nprobes!=1) proutn("s");
89 if ((game.damage[DRADIO] == 0.0 || condit == IHDOCKED)&&
90 game.future[FDSPROB] != 1e30) {
92 proutn("An armed deep space probe is in");
94 proutn("A deep space probe is in");
95 proutn(cramlc(quadrant, probecx, probecy));
100 prout("Dilithium crystals aboard ship... not yet used.");
104 while (cryprob > ai) {
108 prout("Dilithium crystals have been used %d time%s.",
118 if (game.damage[DLRSENS] != 0.0) {
119 /* Now allow base's sensors if docked */
120 if (condit != IHDOCKED) {
121 prout("LONG-RANGE SENSORS DAMAGED.");
124 proutn("Starbase's long-range scan");
127 prout("Long-range scan");
129 for (x = quadx-1; x <= quadx+1; x++) {
131 for (y = quady-1; y <= quady+1; y++) {
132 if (x == 0 || x > 8 || y == 0 || y > 8)
135 if (game.state.galaxy[x][y]<1000) proutn(" %3d", game.state.galaxy[x][y]);
137 game.starch[x][y] = game.damage[DRADIO] > 0 ? game.state.galaxy[x][y]+1000 : 1;
148 for (i = 1; i <= NDEVICES; i++) {
149 if (game.damage[i] > 0.0) {
151 prout("DEVICE -REPAIR TIMES-");
152 prout(" IN FLIGHT DOCKED");
155 prout(" %16s %8.2f %8.2f",
158 docfac*game.damage[i]+0.005);
161 if (!jdam) prout("All devices functional.");
168 if (stdamtim != 1e30 && stdamtim != game.state.date && condit == IHDOCKED) {
169 proutn("Spock- \"I revised the Star Chart from the starbase's records.\"\n\r");
171 if (nn == 0) proutn(" STAR CHART FOR THE KNOWN GALAXY\n\r");
172 if (stdamtim != 1e30) {
173 if (condit == IHDOCKED) {
174 /* We are docked, so restore chart from base information */
175 stdamtim = game.state.date;
176 for (i=1; i <= 8 ; i++)
177 for (j=1; j <= 8; j++)
178 if (game.starch[i][j] == 1) game.starch[i][j] = game.state.galaxy[i][j]+1000;
181 proutn("(Last surveillance update %d stardates ago.",
182 (int)(game.state.date-stdamtim));
186 prout(" 1 2 3 4 5 6 7 8");
187 for (i = 1; i <= 8; i++) {
189 for (j = 1; j <= 8; j++) {
192 if (game.starch[i][j] < 0)
194 else if (game.starch[i][j] == 0)
196 else if (game.state.galaxy[i][j]>=1000)
199 sprintf(buf, "%03d", game.state.galaxy[i][j]);
200 for (cp = buf; cp < buf + sizeof(buf); cp++)
206 if (i<8) proutn("\n\r");
208 prout(""); /* flush output */
213 static char requests[][3] =
214 {"","da","co","po","ls","wa","en","to","sh","kl","ti"};
216 int leftside=TRUE, rightside=TRUE, i, j, jj, k=0, nn=FALSE, t, dam=0;
219 case SCAN_FULL: // SRSCAN
220 if (game.damage[DSRSENS] != 0) {
221 /* Allow base's sensors if docked */
222 if (condit != IHDOCKED) {
223 prout(" S.R. SENSORS DAMAGED!");
227 prout(" [Using Base's sensors]");
229 else proutn(" Short-range scan\n\r");
230 if (goodScan) game.starch[quadx][quady] = game.damage[DRADIO]>0.0 ? game.state.galaxy[quadx][quady]+1000:1;
232 if (isit("chart")) nn = TRUE;
233 if (isit("no")) rightside = FALSE;
235 proutn(" 1 2 3 4 5 6 7 8 9 10\n\r");
238 while (scan() == IHEOL)
239 proutn("Information desired? ");
241 for (k = 1; k <= 10; k++)
242 if (strncmp(citem,requests[k],min(2,strlen(citem)))==0)
245 prout("UNRECOGNIZED REQUEST. Legal requests are:\n"
246 " date, condition, position, lsupport, warpfactor,\n"
247 " energy, torpedoes, shields, klingons, time.");
251 case SCAN_STATUS: // STATUS
255 case SCAN_NO_LEFTSIDE: // REQUEST
259 if (condit != IHDOCKED) newcnd();
260 for (i = 1; i <= 10; i++) {
264 for (j = 1; j <= 10; j++) {
265 if (goodScan || (abs(i-sectx)<= 1 && abs(j-secty) <= 1)){
266 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)){
268 case IHRED: textcolor(RED); break;
269 case IHGREEN: textcolor(GREEN); break;
270 case IHYELLOW: textcolor(YELLOW); break;
271 case IHDOCKED: textcolor(CYAN); break;
272 case IHDEAD: textcolor(BROWN);
274 if (game.quad[i][j] != ship)
277 if (game.quad[i][j] & DAMAGED)
279 proutn("%c ",game.quad[i][j] & ~DAMAGED);
289 proutn("Stardate %.1f, Time Left %.2f", game.state.date, game.state.remtime);
292 if (condit != IHDOCKED) newcnd();
294 case IHRED: cp = "RED"; break;
295 case IHGREEN: cp = "GREEN"; break;
296 case IHYELLOW: cp = "YELLOW"; break;
297 case IHDOCKED: cp = "DOCKED"; break;
298 case IHDEAD: cp="DEAD"; break;
300 for (t=0;t<=NDEVICES;t++)
301 if (game.damage[t]>0) dam++;
302 proutn("Condition %s, %i DAMAGES", cp, dam);
305 proutn("Position %d - %d , %d - %d",
306 quadx, quady, sectx, secty);
309 proutn("Life Support ");
310 if (game.damage[DLIFSUP] != 0.0) {
311 if (condit == IHDOCKED)
312 proutn("DAMAGED, Base provides");
314 proutn("DAMAGED, reserves=%4.2f", lsupres);
320 proutn("Warp Factor %.1f", warpfac);
323 proutn("Energy %.2f", energy);
326 proutn("Torpedoes %d", torps);
330 if (game.damage[DSHIELD] != 0)
336 proutn(" %d%% %.1f units",
337 (int)((100.0*shield)/inshld + 0.5), shield);
340 proutn("Klingons Left %d", game.state.remkl);
347 if (i<10) proutn("\n\r");
348 if (k!=0) return(goodScan);
357 int ix1, ix2, iy1, iy2, prompt=FALSE;
359 double ttime, twarp, tpower;
360 if (game.damage[DCOMPTR] != 0.0) {
361 prout("COMPUTER DAMAGED, USE A POCKET CALCULATOR.");
365 if (scan() != IHREAL) {
368 proutn("Destination quadrant and/or sector? ");
369 if (scan()!=IHREAL) {
375 if (scan() != IHREAL) {
380 if (scan() == IHREAL) {
382 if (scan() != IHREAL) {
389 if (quady>ix1) ix2 = 1;
391 if (quadx>iy1) iy2 = 1;
395 if (ix1 > 8 || ix1 < 1 || iy1 > 8 || iy1 < 1 ||
396 ix2 > 10 || ix2 < 1 || iy2 > 10 || iy2 < 1) {
400 dist = sqrt(square(iy1-quadx+0.1*(iy2-sectx))+
401 square(ix1-quady+0.1*(ix2-secty)));
404 if (prompt) prout("Answer \"no\" if you don't know the value:");
407 proutn("Time or arrival date? ");
408 if (scan()==IHREAL) {
410 if (ttime > game.state.date) ttime -= game.state.date; // Actually a star date
411 if (ttime <= 1e-10 ||
412 (twarp=(floor(sqrt((10.0*dist)/ttime)*10.0)+1.0)/10.0) > 10) {
413 prout("We'll never make it, sir.");
417 if (twarp < 1.0) twarp = 1.0;
421 proutn("Warp factor? ");
422 if (scan()== IHREAL) {
425 if (twarp<1.0 || twarp > 10.0) {
431 prout("Captain, certainly you can give me one of these.");
435 ttime = (10.0*dist)/square(twarp);
436 tpower = dist*twarp*twarp*twarp*(shldup+1);
437 if (tpower >= energy) {
438 prout("Insufficient energy, sir.");
439 if (shldup==0 || tpower > energy*2.0) {
441 proutn("New warp factor to try? ");
442 if (scan() == IHREAL) {
445 if (twarp<1.0 || twarp > 10.0) {
457 prout("But if you lower your shields,");
463 prout(" energy will be %.2f.", energy-tpower);
465 prout("And we will arrive at stardate %.2f.",
466 game.state.date+ttime);
469 prout("Any warp speed is adequate.");
471 prout("Minimum warp needed is %.2f,", twarp);
472 prout("and we will arrive at stardate %.2f.",
473 game.state.date+ttime);
475 if (game.state.remtime < ttime)
476 prout("Unfortunately, the Federation will be destroyed by then.");
478 prout("You'll be taking risks at that speed, Captain");
479 if ((isatb==1 && game.state.isy == ix1 && game.state.isx == iy1 &&
480 game.future[FSCDBAS]< ttime+game.state.date)||
481 (game.future[FCDBAS]<ttime+game.state.date && baty==ix1 && batx == iy1))
482 prout("The starbase there will be destroyed by then.");
483 proutn("New warp factor to try? ");
484 if (scan() == IHREAL) {
487 if (twarp<1.0 || twarp > 10.0) {