6 void attakreport(int curt)
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]);
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 SKILL_NOVICE: s3="novice"; break;
45 case SKILL_FAIR: s3="fair"; break;
46 case SKILL_GOOD: s3="good"; break;
47 case SKILL_EXPERT: s3="expert"; break;
48 case SKILL_EMERITUS: 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>SKILL_GOOD && 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 > SKILL_FAIR) 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.",
121 if (game.damage[DLRSENS] != 0.0) {
122 /* Now allow base's sensors if docked */
123 if (condit != IHDOCKED) {
124 prout("LONG-RANGE SENSORS DAMAGED.");
127 proutn("Starbase's long-range scan");
130 prout("Long-range scan");
132 for (x = quadx-1; x <= quadx+1; x++) {
134 for (y = quady-1; y <= quady+1; y++) {
135 if (x == 0 || x > GALSIZE || y == 0 || y > GALSIZE)
138 if (game.state.galaxy[x][y]<SUPERNOVA_PLACE) proutn(" %3d", game.state.galaxy[x][y]);
140 game.starch[x][y] = game.damage[DRADIO] > 0 ? game.state.galaxy[x][y]+SUPERNOVA_PLACE : 1;
152 for (i = 0; i < NDEVICES; i++) {
153 if (game.damage[i] > 0.0) {
155 prout("DEVICE -REPAIR TIMES-");
156 prout(" IN FLIGHT DOCKED");
159 prout(" %16s %8.2f %8.2f",
162 docfac*game.damage[i]+0.005);
165 if (!jdam) prout("All devices functional.");
173 if (stdamtim != 1e30 && stdamtim != game.state.date && condit == IHDOCKED) {
174 proutn("Spock- \"I revised the Star Chart from the starbase's records.\"\n\r");
176 if (nn == 0) proutn(" STAR CHART FOR THE KNOWN GALAXY\n\r");
177 if (stdamtim != 1e30) {
178 if (condit == IHDOCKED) {
179 /* We are docked, so restore chart from base information */
180 stdamtim = game.state.date;
181 for (i=1; i <= GALSIZE ; i++)
182 for (j=1; j <= GALSIZE; j++)
183 if (game.starch[i][j] == 1) game.starch[i][j] = game.state.galaxy[i][j]+SUPERNOVA_PLACE;
186 proutn("(Last surveillance update %d stardates ago.",
187 (int)(game.state.date-stdamtim));
191 prout(" 1 2 3 4 5 6 7 8");
192 for (i = 1; i <= GALSIZE; i++) {
194 for (j = 1; j <= GALSIZE; j++) {
197 if (game.starch[i][j] == CHART_UNKNOWN)
199 else if (game.starch[i][j] == 0)
201 else if (game.state.galaxy[i][j]>=SUPERNOVA_PLACE)
204 sprintf(buf, "%03d", game.state.galaxy[i][j]);
205 for (cp = buf; cp < buf + sizeof(buf); cp++)
211 if (i<GALSIZE) proutn("\n\r");
213 prout(""); /* flush output */
216 static void sectscan(int goodScan, int i, int j)
218 if (goodScan || (abs(i-sectx)<= 1 && abs(j-secty) <= 1)){
219 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)){
221 case IHRED: textcolor(RED); break;
222 case IHGREEN: textcolor(GREEN); break;
223 case IHYELLOW: textcolor(YELLOW); break;
224 case IHDOCKED: textcolor(CYAN); break;
225 case IHDEAD: textcolor(BROWN);
227 if (game.quad[i][j] != ship)
230 if (game.quad[i][j] & DAMAGED)
232 proutn("%c ",game.quad[i][j] & ~DAMAGED);
239 static void status(int req)
245 proutn("Stardate %.1f, Time Left %.2f", game.state.date, game.state.remtime);
248 if (condit != IHDOCKED) newcnd();
250 case IHRED: cp = "RED"; break;
251 case IHGREEN: cp = "GREEN"; break;
252 case IHYELLOW: cp = "YELLOW"; break;
253 case IHDOCKED: cp = "DOCKED"; break;
254 case IHDEAD: cp="DEAD"; break;
256 for (t=0;t<NDEVICES;t++)
257 if (game.damage[t]>0)
259 proutn("Condition %s, %i DAMAGES", cp, dam);
262 proutn("Position %d - %d , %d - %d",
263 quadx, quady, sectx, secty);
266 proutn("Life Support ");
267 if (game.damage[DLIFSUP] != 0.0) {
268 if (condit == IHDOCKED)
269 proutn("DAMAGED, Base provides");
271 proutn("DAMAGED, reserves=%4.2f", lsupres);
277 proutn("Warp Factor %.1f", warpfac);
280 proutn("Energy %.2f", energy);
281 if (icrystl) /* ESR */
282 proutn(" (have crystals)");
285 proutn("Torpedoes %d", torps);
289 if (game.damage[DSHIELD] != 0)
295 proutn(" %d%% %.1f units",
296 (int)((100.0*shield)/inshld + 0.5), shield);
299 proutn("Klingons Left %d", game.state.remkl);
305 * Note: attakreport() can in some cases produce two lines of
306 * output. If that happens, and QUADSIZE is the normal 10, items
307 * 11 and up will be printed past the bottom of the quadrant display.
308 * Under the curses display logic they will get lost because they're
309 * written outside the report window.
312 proutn("Bases Left %d", game.state.rembase);
319 static char requests[][3] =
320 {"","da","co","po","ls","wa","en","to","sh","kl","ti", "ba"};
321 int leftside=TRUE, rightside=TRUE, i, j, jj, req=0, nn=FALSE;
324 case SCAN_FULL: // SRSCAN
325 if (game.damage[DSRSENS] != 0) {
326 /* Allow base's sensors if docked */
327 if (condit != IHDOCKED) {
328 prout(" S.R. SENSORS DAMAGED!");
332 prout(" [Using Base's sensors]");
334 else proutn(" Short-range scan\n\r");
335 if (goodScan) game.starch[quadx][quady] = game.damage[DRADIO]>0.0 ? game.state.galaxy[quadx][quady]+SUPERNOVA_PLACE:1;
337 if (isit("chart")) nn = TRUE;
338 if (isit("no")) rightside = FALSE;
340 proutn(" 1 2 3 4 5 6 7 8 9 10\n\r");
343 while (scan() == IHEOL)
344 proutn("Information desired? ");
346 for (req = 1; req <= sizeof(requests)/sizeof(requests[0]); req++)
347 if (strncmp(citem,requests[req],min(2,strlen(citem)))==0)
349 if (req > sizeof(requests)/sizeof(requests[0])) {
350 prout("UNRECOGNIZED REQUEST. Legal requests are:\n"
351 " date, condition, position, lsupport, warpfactor,\n"
352 " energy, torpedoes, shields, klingons, time, bases.");
356 case SCAN_STATUS: // STATUS
361 case SCAN_NO_LEFTSIDE: // REQUEST
365 if (condit != IHDOCKED) newcnd();
366 for (i = 1; i <= max(QUADSIZE, sizeof(requests)/sizeof(requests[0])); i++) {
367 jj = (req!=0 ? req : i);
368 if (leftside && i <= QUADSIZE) {
370 for (j = 1; j <= QUADSIZE; j++) {
371 sectscan(goodScan, i, j);
376 if (i<sizeof(requests)/sizeof(requests[0])) proutn("\n\r");
377 if (req!=0) return(goodScan);
387 int ix1, ix2, iy1, iy2, prompt=FALSE;
389 double ttime, twarp, tpower;
390 if (game.damage[DCOMPTR] != 0.0) {
391 prout("COMPUTER DAMAGED, USE A POCKET CALCULATOR.");
395 if (scan() != IHREAL) {
398 proutn("Destination quadrant and/or sector? ");
399 if (scan()!=IHREAL) {
405 if (scan() != IHREAL) {
410 if (scan() == IHREAL) {
412 if (scan() != IHREAL) {
419 if (quady>ix1) ix2 = 1;
421 if (quadx>iy1) iy2 = 1;
425 if (ix1 > GALSIZE || ix1 < 1 || iy1 > GALSIZE || iy1 < 1 ||
426 ix2 > QUADSIZE || ix2 < 1 || iy2 > QUADSIZE || iy2 < 1) {
430 dist = sqrt(square(iy1-quadx+0.1*(iy2-sectx))+
431 square(ix1-quady+0.1*(ix2-secty)));
434 if (prompt) prout("Answer \"no\" if you don't know the value:");
437 proutn("Time or arrival date? ");
438 if (scan()==IHREAL) {
440 if (ttime > game.state.date) ttime -= game.state.date; // Actually a star date
441 if (ttime <= 1e-10 ||
442 (twarp=(floor(sqrt((10.0*dist)/ttime)*10.0)+1.0)/10.0) > 10) {
443 prout("We'll never make it, sir.");
447 if (twarp < 1.0) twarp = 1.0;
451 proutn("Warp factor? ");
452 if (scan()== IHREAL) {
455 if (twarp<1.0 || twarp > 10.0) {
461 prout("Captain, certainly you can give me one of these.");
465 ttime = (10.0*dist)/square(twarp);
466 tpower = dist*twarp*twarp*twarp*(shldup+1);
467 if (tpower >= energy) {
468 prout("Insufficient energy, sir.");
469 if (shldup==0 || tpower > energy*2.0) {
471 proutn("New warp factor to try? ");
472 if (scan() == IHREAL) {
475 if (twarp<1.0 || twarp > 10.0) {
487 prout("But if you lower your shields,");
493 prout(" energy will be %.2f.", energy-tpower);
495 prout("And we will arrive at stardate %.2f.",
496 game.state.date+ttime);
499 prout("Any warp speed is adequate.");
501 prout("Minimum warp needed is %.2f,", twarp);
502 prout("and we will arrive at stardate %.2f.",
503 game.state.date+ttime);
505 if (game.state.remtime < ttime)
506 prout("Unfortunately, the Federation will be destroyed by then.");
508 prout("You'll be taking risks at that speed, Captain");
509 if ((isatb==1 && game.state.isy == ix1 && game.state.isx == iy1 &&
510 game.future[FSCDBAS]< ttime+game.state.date)||
511 (game.future[FCDBAS]<ttime+game.state.date && baty==ix1 && batx == iy1))
512 prout("The starbase there will be destroyed by then.");
513 proutn("New warp factor to try? ");
514 if (scan() == IHREAL) {
517 if (twarp<1.0 || twarp > 10.0) {