7 void attakreport(int l) {
9 if (game.future[FCDBAS] < 1e30) {
10 prout("Starbase in %s is currently under Commander attack.",
11 cramlc(quadrant, batx, baty));
12 prout("It can hold out until Stardate %d.",
13 (int)game.future[FCDBAS]);
16 prout("Starbase in %s is under Super-commander attack.",
17 cramlc(quadrant, game.state.isx, game.state.isy));
18 prout("It can hold out until Stardate %d.",
19 (int)game.future[FSCDBAS]);
22 if (game.future[FCDBAS] < 1e30)
23 proutn("Base in %i - %i attacked by C. Alive until %.1f", batx, baty, game.future[FCDBAS]);
25 proutn("Base in %i - %i attacked by S. Alive until %.1f", game.state.isx, game.state.isy, game.future[FSCDBAS]);
35 s1 = (thawed?"thawed ":"");
37 case 1: s2="short"; break;
38 case 2: s2="medium"; break;
39 case 4: s2="long"; break;
40 default: s2="unknown length"; break;
43 case 1: s3="novice"; break;
44 case 2: s3="fair"; break;
45 case 3: s3="good"; break;
46 case 4: s3="expert"; break;
47 case 5: s3="emeritus"; break;
48 default: s3="skilled"; break;
51 prout("You %s playing a %s%s %s game.",
52 alldone? "were": "are now", s1, s2, s3);
53 if (skill>3 && thawed && !alldone) prout("No plaque is allowed.");
54 if (tourn) prout("This is tournament game %d.", tourn);
55 prout("Your secret password is \"%s\"",game.passwd);
56 proutn("%d of %d Klingons have been killed",
57 game.state.killk+game.state.killc+game.state.nsckill, inkling);
58 if (game.state.killc) prout(", including %d Commander%s.", game.state.killc, game.state.killc==1?"":"s");
59 else if (game.state.killk+game.state.nsckill > 0) prout(", but no Commanders.");
61 if (skill > 2) prout("The Super Commander has %sbeen destroyed.",
62 game.state.nscrem?"not ":"");
63 if (game.state.rembase != inbase) {
65 if (inbase-game.state.rembase==1) proutn("has been 1 base");
67 proutn("have been %d bases", inbase-game.state.rembase);
69 prout(" destroyed, %d remaining.", game.state.rembase);
71 else prout("There are %d bases.", inbase);
72 if (game.damage[DRADIO] == 0.0 || condit == IHDOCKED || iseenit) {
73 /* Don't report this if not seen and
74 either the radio is dead or not at base! */
78 if (casual) prout("%d casualt%s suffered so far.",
79 casual, casual==1? "y" : "ies");
80 if (nhelp) prout("There were %d call%s for help.",
81 nhelp, nhelp==1 ? "" : "s");
84 if (nprobes) proutn("%d", nprobes);
86 proutn(" deep space probe");
87 if (nprobes!=1) proutn("s");
90 if ((game.damage[DRADIO] == 0.0 || condit == IHDOCKED)&&
91 game.future[FDSPROB] != 1e30) {
93 proutn("An armed deep space probe is in");
95 proutn("A deep space probe is in");
96 proutn(cramlc(quadrant, probecx, probecy));
101 prout("Dilithium crystals aboard ship... not yet used.");
105 while (cryprob > ai) {
109 prout("Dilithium crystals have been used %d time%s.",
119 if (game.damage[DLRSENS] != 0.0) {
120 /* Now allow base's sensors if docked */
121 if (condit != IHDOCKED) {
122 prout("LONG-RANGE SENSORS DAMAGED.");
125 proutn("Starbase's long-range scan");
128 prout("Long-range scan");
130 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 if (game.state.galaxy[x][y]<1000) proutn(" %3d", game.state.galaxy[x][y]);
138 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) {
152 prout("DEVICE -REPAIR TIMES-");
153 prout(" IN FLIGHT DOCKED");
156 prout(" %16s %8.2f %8.2f",
159 docfac*game.damage[i]+0.005);
162 if (!jdam) prout("All devices functional.");
169 if (stdamtim != 1e30 && stdamtim != game.state.date && condit == IHDOCKED) {
170 proutn("Spock- \"I revised the Star Chart from the starbase's records.\"\n\r");
172 if (nn == 0) proutn(" STAR CHART FOR THE KNOWN GALAXY\n\r");
173 if (stdamtim != 1e30) {
174 if (condit == IHDOCKED) {
175 /* We are docked, so restore chart from base information */
176 stdamtim = game.state.date;
177 for (i=1; i <= 8 ; i++)
178 for (j=1; j <= 8; j++)
179 if (game.starch[i][j] == 1) game.starch[i][j] = game.state.galaxy[i][j]+1000;
182 proutn("(Last surveillance update %d stardates ago.",
183 (int)(game.state.date-stdamtim));
187 prout(" 1 2 3 4 5 6 7 8");
188 for (i = 1; i <= 8; i++) {
190 for (j = 1; j <= 8; j++) {
193 if (game.starch[i][j] < 0)
195 else if (game.starch[i][j] == 0)
197 else if (game.starch[i][j] > 999)
198 if ((i==quadx)&&(j==quady)){
199 gotoxy(wherex()-1,wherey());
200 if (game.starch[i][i]<2000)
201 sprintf(buf, "%03d", game.starch[i][j]-1000);
206 if (game.starch[i][j]<2000)
207 sprintf(buf, "%03d", game.starch[i][j]-1000);
210 else if ((i==quadx)&&(j==quady)){
211 gotoxy(wherex()-1,wherey());
212 sprintf(buf, "%03d", game.state.galaxy[i][j]);
214 else if (game.state.galaxy[i][j]>=1000)
217 sprintf(buf, "%03d", game.state.galaxy[i][j]);
218 for (cp = buf; cp < buf + sizeof(buf); cp++)
224 if (i<8) proutn("\n\r");
226 prout(""); /* flush output */
231 static char requests[][3] =
232 {"","da","co","po","ls","wa","en","to","sh","kl","ti"};
234 int leftside=TRUE, rightside=TRUE, i, j, jj, k=0, nn=FALSE, t, dam=0;
237 case SCAN_FULL: // SRSCAN
238 if (game.damage[DSRSENS] != 0) {
239 /* Allow base's sensors if docked */
240 if (condit != IHDOCKED) {
241 prout(" S.R. SENSORS DAMAGED!");
245 prout(" [Using Base's sensors]");
247 else proutn(" Short-range scan\n\r");
248 if (goodScan) game.starch[quadx][quady] = game.damage[DRADIO]>0.0 ? game.state.galaxy[quadx][quady]+1000:1;
250 if (isit("chart")) nn = TRUE;
251 if (isit("no")) rightside = FALSE;
253 proutn(" 1 2 3 4 5 6 7 8 9 10\n\r");
256 while (scan() == IHEOL)
257 proutn("Information desired? ");
259 for (k = 1; k <= 10; k++)
260 if (strncmp(citem,requests[k],min(2,strlen(citem)))==0)
263 prout("UNRECOGNIZED REQUEST. Legal requests are:\n"
264 " date, condition, position, lsupport, warpfactor,\n"
265 " energy, torpedoes, shields, klingons, time.");
269 case SCAN_STATUS: // STATUS
273 case SCAN_NO_LEFTSIDE: // REQUEST
277 if (condit != IHDOCKED) newcnd();
278 for (i = 1; i <= 10; i++) {
282 for (j = 1; j <= 10; j++) {
283 if (goodScan || (abs(i-sectx)<= 1 && abs(j-secty) <= 1)){
284 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();
294 if (game.quad[i][j] & 128) highvideo();
295 proutn("%c ",game.quad[i][j] & 127);
296 textcolor(LIGHTGRAY);
305 proutn("Stardate %.1f, Time Left %.2f", game.state.date, game.state.remtime);
308 if (condit != IHDOCKED) newcnd();
310 case IHRED: cp = "RED"; break;
311 case IHGREEN: cp = "GREEN"; break;
312 case IHYELLOW: cp = "YELLOW"; break;
313 case IHDOCKED: cp = "DOCKED"; break;
314 case IHDEAD: cp="DEAD"; break;
316 for (t=0;t<=NDEVICES;t++)
317 if (game.damage[t]>0) dam++;
318 proutn("Condition %s, %i DAMAGES", cp, dam);
321 proutn("Position %d - %d , %d - %d",
322 quadx, quady, sectx, secty);
325 proutn("Life Support ");
326 if (game.damage[DLIFSUP] != 0.0) {
327 if (condit == IHDOCKED)
328 proutn("DAMAGED, Base provides");
330 proutn("DAMAGED, reserves=%4.2f", lsupres);
336 proutn("Warp Factor %.1f", warpfac);
339 proutn("Energy %.2f", energy);
342 proutn("Torpedoes %d", torps);
346 if (game.damage[DSHIELD] != 0)
352 proutn(" %d%% %.1f units",
353 (int)((100.0*shield)/inshld + 0.5), shield);
356 proutn("Klingons Left %d", game.state.remkl);
363 if (i<10) proutn("\n\r");
364 if (k!=0) return(goodScan);
373 int ix1, ix2, iy1, iy2, prompt=FALSE;
375 double ttime, twarp, tpower;
376 if (game.damage[DCOMPTR] != 0.0) {
377 prout("COMPUTER DAMAGED, USE A POCKET CALCULATOR.");
381 if (scan() != IHREAL) {
384 proutn("Destination quadrant and/or sector? ");
385 if (scan()!=IHREAL) {
391 if (scan() != IHREAL) {
396 if (scan() == IHREAL) {
398 if (scan() != IHREAL) {
405 if (quady>ix1) ix2 = 1;
407 if (quadx>iy1) iy2 = 1;
411 if (ix1 > 8 || ix1 < 1 || iy1 > 8 || iy1 < 1 ||
412 ix2 > 10 || ix2 < 1 || iy2 > 10 || iy2 < 1) {
416 dist = sqrt(square(iy1-quadx+0.1*(iy2-sectx))+
417 square(ix1-quady+0.1*(ix2-secty)));
420 if (prompt) prout("Answer \"no\" if you don't know the value:");
423 proutn("Time or arrival date? ");
424 if (scan()==IHREAL) {
426 if (ttime > game.state.date) ttime -= game.state.date; // Actually a star date
427 if (ttime <= 1e-10 ||
428 (twarp=(floor(sqrt((10.0*dist)/ttime)*10.0)+1.0)/10.0) > 10) {
429 prout("We'll never make it, sir.");
433 if (twarp < 1.0) twarp = 1.0;
437 proutn("Warp factor? ");
438 if (scan()== IHREAL) {
441 if (twarp<1.0 || twarp > 10.0) {
447 prout("Captain, certainly you can give me one of these.");
451 ttime = (10.0*dist)/square(twarp);
452 tpower = dist*twarp*twarp*twarp*(shldup+1);
453 if (tpower >= energy) {
454 prout("Insufficient energy, sir.");
455 if (shldup==0 || tpower > energy*2.0) {
457 proutn("New warp factor to try? ");
458 if (scan() == IHREAL) {
461 if (twarp<1.0 || twarp > 10.0) {
473 prout("But if you lower your shields,");
479 prout(" energy will be %.2f.", energy-tpower);
481 prout("And we will arrive at stardate %.2f.",
482 game.state.date+ttime);
485 prout("Any warp speed is adequate.");
487 prout("Minimum warp needed is %.2f,", twarp);
488 prout("and we will arrive at stardate %.2f.",
489 game.state.date+ttime);
491 if (game.state.remtime < ttime)
492 prout("Unfortunately, the Federation will be destroyed by then.");
494 prout("You'll be taking risks at that speed, Captain");
495 if ((isatb==1 && game.state.isy == ix1 && game.state.isx == iy1 &&
496 game.future[FSCDBAS]< ttime+game.state.date)||
497 (game.future[FCDBAS]<ttime+game.state.date && baty==ix1 && batx == iy1))
498 prout("The starbase there will be destroyed by then.");
499 proutn("New warp factor to try? ");
500 if (scan() == IHREAL) {
503 if (twarp<1.0 || twarp > 10.0) {