6 void attakreport(int curt)
9 if (game.future[FCDBAS] < FOREVER) {
10 prout("Starbase in %s is currently under Commander attack.",
11 cramlc(quadrant, game.batx, game.baty));
12 prout("It can hold out until Stardate %d.",
13 (int)game.future[FCDBAS]);
15 if (game.isatb == 1) {
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] < FOREVER)
23 proutn("Base in %i - %i attacked by C. Alive until %.1f", game.batx, game.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 = (game.thawed?"game.thawed ":"");
37 switch (game.length) {
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 game.alldone? "were": "are now", s1, s2, s3);
54 if (game.skill>SKILL_GOOD && game.thawed && !game.alldone) prout("No plaque is allowed.");
55 if (game.tourn) prout("This is tournament game %d.", game.tourn);
56 prout("Your secret password is \"%s\"",game.passwd);
57 proutn("%d of %d Klingons have been killed", KLINGKILLED, INKLINGTOT);
58 if (NKILLC) prout(", including %d Commander%s.", NKILLC, NKILLC==1?"":"s");
59 else if (NKILLK + NKILLSC > 0) prout(", but no Commanders.");
61 if (game.skill > SKILL_FAIR) prout("The Super Commander has %sbeen destroyed.",
62 game.state.nscrem?"not ":"");
63 if (game.state.rembase != game.inbase) {
65 if (game.inbase-game.state.rembase==1) proutn("has been 1 base");
67 proutn("have been %d bases", game.inbase-game.state.rembase);
69 prout(" destroyed, %d remaining.", game.state.rembase);
71 else prout("There are %d bases.", game.inbase);
72 if (game.damage[DRADIO] == 0.0 || game.condit == IHDOCKED || game.iseenit) {
73 /* Don't report this if not seen and
74 either the radio is dead or not at base! */
78 if (game.casual) prout("%d casualt%s suffered so far.",
79 game.casual, game.casual==1? "y" : "ies");
80 if (game.nhelp) prout("There were %d call%s for help.",
81 game.nhelp, game.nhelp==1 ? "" : "s");
82 if (game.ship == IHE) {
84 if (game.nprobes) proutn("%d", game.nprobes);
86 proutn(" deep space probe");
87 if (game.nprobes!=1) proutn("s");
90 if ((game.damage[DRADIO] == 0.0 || game.condit == IHDOCKED)&&
91 game.future[FDSPROB] != FOREVER) {
93 proutn("An armed deep space probe is in");
95 proutn("A deep space probe is in");
96 proutn(cramlc(quadrant, game.probecx, game.probecy));
100 if (game.cryprob <= .05)
101 prout("Dilithium crystals aboard ship... not yet used.");
105 while (game.cryprob > ai) {
109 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 (game.condit != IHDOCKED) {
123 prout("LONG-RANGE SENSORS DAMAGED.");
126 prout("Starbase's long-range scan");
129 prout("Long-range scan");
131 for (x = game.quadx-1; x <= game.quadx+1; x++) {
133 for (y = game.quady-1; y <= game.quady+1; y++) {
134 if (!VALID_QUADRANT(x, y))
137 if (!game.damage[DRADIO])
138 game.state.galaxy[x][y].charted = TRUE;
139 game.state.chart[x][y].klingons = game.state.galaxy[x][y].klingons;
140 game.state.chart[x][y].starbase = game.state.galaxy[x][y].starbase;
141 game.state.chart[x][y].stars = game.state.galaxy[x][y].stars;
142 if (game.state.galaxy[x][y].supernova)
145 proutn(" %3d", game.state.chart[x][y].klingons*100 + game.state.chart[x][y].starbase * 10 + game.state.chart[x][y].stars);
157 for (i = 0; i < NDEVICES; i++) {
158 if (game.damage[i] > 0.0) {
160 prout("DEVICE -REPAIR TIMES-");
161 prout(" IN FLIGHT DOCKED");
164 prout(" %16s %8.2f %8.2f",
167 game.docfac*game.damage[i]+0.005);
170 if (!jdam) prout("All devices functional.");
174 /* update the chart in the Enterprise's computer from galaxy data */
177 game.lastchart = game.state.date;
180 if (game.state.galaxy[i][j].charted) {
181 game.state.chart[i][j].klingons = game.state.galaxy[i][j].klingons;
182 game.state.chart[i][j].starbase = game.state.galaxy[i][j].starbase;
183 game.state.chart[i][j].stars = game.state.galaxy[i][j].stars;
192 if (game.damage[DRADIO] == 0.0)
195 if (game.lastchart < game.state.date && game.condit == IHDOCKED) {
196 prout("Spock- \"I revised the Star Chart from the starbase's records.\"");
200 if (nn == 0) prout(" STAR CHART FOR THE KNOWN GALAXY");
201 if (game.state.date > game.lastchart)
202 prout("(Last surveillance update %d stardates ago).",
203 (int)(game.state.date-game.lastchart));
204 prout(" 1 2 3 4 5 6 7 8");
209 if ((game.options & OPTION_SHOWME) && i == game.quadx && j == game.quady)
213 if (game.state.galaxy[i][j].supernova)
215 else if (!game.state.galaxy[i][j].charted && game.state.galaxy[i][j].starbase)
217 else if (game.state.galaxy[i][j].charted)
218 sprintf(buf, "%3d", game.state.chart[i][j].klingons*100 + game.state.chart[i][j].starbase * 10 + game.state.chart[i][j].stars);
222 if ((game.options & OPTION_SHOWME) && i == game.quadx && j == game.quady)
228 if (i<GALSIZE) skip(1);
232 static void sectscan(int goodScan, int i, int j)
234 if (goodScan || (abs(i-game.sectx)<= 1 && abs(j-game.secty) <= 1)){
235 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)){
236 switch (game.condit) {
237 case IHRED: textcolor(RED); break;
238 case IHGREEN: textcolor(GREEN); break;
239 case IHYELLOW: textcolor(YELLOW); break;
240 case IHDOCKED: textcolor(CYAN); break;
241 case IHDEAD: textcolor(BROWN);
243 if (game.quad[i][j] != game.ship)
246 proutn("%c ",game.quad[i][j]);
253 static void status(int req)
259 proutn("Stardate %.1f, Time Left %.2f", game.state.date, game.state.remtime);
262 if (game.condit != IHDOCKED) newcnd();
263 switch (game.condit) {
264 case IHRED: cp = "RED"; break;
265 case IHGREEN: cp = "GREEN"; break;
266 case IHYELLOW: cp = "YELLOW"; break;
267 case IHDOCKED: cp = "DOCKED"; break;
268 case IHDEAD: cp="DEAD"; break;
270 for (t=0;t<NDEVICES;t++)
271 if (game.damage[t]>0)
273 proutn("Condition %s, %i DAMAGES", cp, dam);
276 proutn("Position %d - %d , %d - %d",
277 game.quadx, game.quady, game.sectx, game.secty);
280 proutn("Life Support ");
281 if (game.damage[DLIFSUP] != 0.0) {
282 if (game.condit == IHDOCKED)
283 proutn("DAMAGED, Base provides");
285 proutn("DAMAGED, reserves=%4.2f", game.lsupres);
291 proutn("Warp Factor %.1f", game.warpfac);
294 proutn("Energy %.2f", game.energy);
295 if (game.icrystl && (game.options & OPTION_SHOWME)) /* ESR */
296 proutn(" (have crystals)");
299 proutn("Torpedoes %d", game.torps);
303 if (game.damage[DSHIELD] != 0)
305 else if (game.shldup)
309 proutn(" %d%% %.1f units",
310 (int)((100.0*game.shield)/game.inshld + 0.5), game.shield);
313 proutn("Klingons Left %d", KLINGREM);
316 if (game.options & OPTION_WORLDS) {
317 planet *here = game.state.galaxy[game.quadx][game.quady].planet;
318 if (here && here->inhabited != UNINHABITED)
319 proutn("Major system %s", systemname(here));
321 proutn("Sector is uninhabited");
333 /* the "sy" request is undocumented */
334 static char requests[][3] =
335 {"","da","co","po","ls","wa","en","to","sh","kl","sy", "ti"};
336 int leftside=TRUE, rightside=TRUE, i, j, jj, req=0, nn=FALSE;
339 case SCAN_FULL: // SRSCAN
340 if (game.damage[DSRSENS] != 0) {
341 /* Allow base's sensors if docked */
342 if (game.condit != IHDOCKED) {
343 prout(" S.R. SENSORS DAMAGED!");
347 prout(" [Using Base's sensors]");
349 else prout(" Short-range scan");
350 if (goodScan && !game.damage[DRADIO]) {
351 game.state.chart[game.quadx][game.quady].klingons = game.state.galaxy[game.quadx][game.quady].klingons;
352 game.state.chart[game.quadx][game.quady].starbase = game.state.galaxy[game.quadx][game.quady].starbase;
353 game.state.chart[game.quadx][game.quady].stars = game.state.galaxy[game.quadx][game.quady].stars;
354 game.state.galaxy[game.quadx][game.quady].charted = TRUE;
357 if (isit("chart")) nn = TRUE;
358 if (isit("no")) rightside = FALSE;
360 prout(" 1 2 3 4 5 6 7 8 9 10");
363 while (scan() == IHEOL)
364 proutn("Information desired? ");
366 for (req = 1; req <= sizeof(requests)/sizeof(requests[0]); req++)
367 if (strncmp(citem,requests[req],min(2,strlen(citem)))==0)
369 if (req > sizeof(requests)/sizeof(requests[0])) {
370 prout("UNRECOGNIZED REQUEST. Legal requests are:");
371 prout(" date, condition, position, lsupport, warpfactor,");
372 prout(" energy, torpedoes, shields, klingons, time, system, bases.");
376 case SCAN_STATUS: // STATUS
381 case SCAN_NO_LEFTSIDE: // REQUEST
385 if (game.condit != IHDOCKED) newcnd();
386 for (i = 1; i <= max(QUADSIZE, sizeof(requests)/sizeof(requests[0])); i++) {
387 jj = (req!=0 ? req : i);
388 if (leftside && i <= QUADSIZE) {
391 sectscan(goodScan, i, j);
396 if (i<sizeof(requests)/sizeof(requests[0])) skip(1);
397 if (req!=0) return(goodScan);
407 int ix1, ix2, iy1, iy2, prompt=FALSE;
409 double ttime, twarp, tpower;
410 if (game.damage[DCOMPTR] != 0.0) {
411 prout("COMPUTER DAMAGED, USE A POCKET CALCULATOR.");
415 if (scan() != IHREAL) {
418 proutn("Destination quadrant and/or sector? ");
419 if (scan()!=IHREAL) {
425 if (scan() != IHREAL) {
430 if (scan() == IHREAL) {
432 if (scan() != IHREAL) {
439 if (game.quady>ix1) ix2 = 1;
441 if (game.quadx>iy1) iy2 = 1;
445 if (!VALID_QUADRANT(ix1, iy1) || !VALID_SECTOR(ix2, iy2)) {
449 game.dist = sqrt(square(iy1-game.quadx+0.1*(iy2-game.sectx))+
450 square(ix1-game.quady+0.1*(ix2-game.secty)));
453 if (prompt) prout("Answer \"no\" if you don't know the value:");
456 proutn("Time or arrival date? ");
457 if (scan()==IHREAL) {
459 if (ttime > game.state.date) ttime -= game.state.date; // Actually a star date
460 if (ttime <= 1e-10 ||
461 (twarp=(floor(sqrt((10.0*game.dist)/ttime)*10.0)+1.0)/10.0) > 10) {
462 prout("We'll never make it, sir.");
466 if (twarp < 1.0) twarp = 1.0;
470 proutn("Warp factor? ");
471 if (scan()== IHREAL) {
474 if (twarp<1.0 || twarp > 10.0) {
480 prout("Captain, certainly you can give me one of these.");
484 ttime = (10.0*game.dist)/square(twarp);
485 tpower = game.dist*twarp*twarp*twarp*(game.shldup+1);
486 if (tpower >= game.energy) {
487 prout("Insufficient energy, sir.");
488 if (game.shldup==0 || tpower > game.energy*2.0) {
490 proutn("New warp factor to try? ");
491 if (scan() == IHREAL) {
494 if (twarp<1.0 || twarp > 10.0) {
506 prout("But if you lower your shields,");
512 prout(" game.energy will be %.2f.", game.energy-tpower);
514 prout("And we will arrive at stardate %.2f.",
515 game.state.date+ttime);
518 prout("Any warp speed is adequate.");
520 prout("Minimum warp needed is %.2f,", twarp);
521 prout("and we will arrive at stardate %.2f.",
522 game.state.date+ttime);
524 if (game.state.remtime < ttime)
525 prout("Unfortunately, the Federation will be destroyed by then.");
527 prout("You'll be taking risks at that speed, Captain");
528 if ((game.isatb==1 && game.state.isy == ix1 && game.state.isx == iy1 &&
529 game.future[FSCDBAS]< ttime+game.state.date)||
530 (game.future[FCDBAS]<ttime+game.state.date && game.baty==ix1 && game.batx == iy1))
531 prout("The starbase there will be destroyed by then.");
532 proutn("New warp factor to try? ");
533 if (scan() == IHREAL) {
536 if (twarp<1.0 || twarp > 10.0) {