6 int ictbeam=0, ipage=0, istract=0, line, i=0, j, k, l, ixhold=0, iyhold=0;
7 double fintim = game.state.date + game.optime, datemin, xtime, repair, yank=0;
11 if (game.idebug) prout("EVENTS");
14 radio_was_broken = (game.damage[DRADIO] != 0.0);
17 /* Select earliest extraneous event, line==0 if no events */
19 if (game.alldone) return;
21 for (l = 1; l < NEVENTS; l++)
22 if (game.future[l] < datemin) {
24 datemin = game.future[l];
26 xtime = datemin-game.state.date;
27 game.state.date = datemin;
28 /* Decrement Federation resources and recompute remaining time */
29 game.state.remres -= (game.state.remkl+4*game.state.remcom)*xtime;
30 game.state.remtime = game.state.remres/(game.state.remkl+4*game.state.remcom);
31 if (game.state.remtime <=0) {
35 /* Is life support adequate? */
36 if (game.damage[DLIFSUP] && game.condit != IHDOCKED) {
37 if (game.lsupres < xtime && game.damage[DLIFSUP] > game.lsupres) {
41 game.lsupres -= xtime;
42 if (game.damage[DLIFSUP] <= xtime) game.lsupres = game.inlsr;
46 if (game.condit == IHDOCKED) repair /= game.docfac;
47 /* Don't fix Deathray here */
48 for (l=0; l<NDEVICES; l++)
49 if (game.damage[l] > 0.0 && l != DDRAY)
50 game.damage[l] -= (game.damage[l]-repair > 0.0 ? repair : game.damage[l]);
51 /* If radio repaired, update star chart and attack reports */
52 if (radio_was_broken && game.damage[DRADIO] == 0.0) {
53 prout(_("Lt. Uhura- \"Captain, the sub-space radio is working and"));
54 prout(_(" surveillance reports are coming in."));
56 if (game.iseenit==0) {
61 prout(_(" The star chart is now up to date.\""));
64 /* Cause extraneous event LINE to occur */
67 case FSNOVA: /* Supernova */
68 if (ipage==0) pause_game(1);
71 game.future[FSNOVA] = game.state.date + expran(0.5*game.intime);
72 if (game.state.galaxy[game.quadx][game.quady].supernova) return;
74 case FSPY: /* Check with spy to see if S.C. should tractor beam */
75 if (game.state.nscrem == 0 ||
76 ictbeam+istract > 0 ||
77 game.condit==IHDOCKED || game.isatb==1 || game.iscate==1) return;
79 (game.energy < 2000 && game.torps < 4 && game.shield < 1250) ||
80 (game.damage[DPHASER]>0 && (game.damage[DPHOTON]>0 || game.torps < 4)) ||
81 (game.damage[DSHIELD] > 0 &&
82 (game.energy < 2500 || game.damage[DPHASER] > 0) &&
83 (game.torps < 5 || game.damage[DPHOTON] > 0))) {
84 /* Tractor-beam her! */
86 yank = square(game.state.isx-game.quadx) + square(game.state.isy-game.quady);
87 /********* fall through to FTBEAM code ***********/
90 case FTBEAM: /* Tractor beam */
92 if (game.state.remcom == 0) {
93 game.future[FTBEAM] = FOREVER;
96 i = Rand()*game.state.remcom+1.0;
97 yank = square(game.state.cx[i]-game.quadx) + square(game.state.cy[i]-game.quady);
98 if (istract || game.condit == IHDOCKED || yank == 0) {
99 /* Drats! Have to reschedule */
100 game.future[FTBEAM] = game.state.date + game.optime +
101 expran(1.5*game.intime/game.state.remcom);
105 /* tractor beaming cases merge here */
107 if (ipage==0) pause_game(1);
109 game.optime = (10.0/(7.5*7.5))*yank; /* 7.5 is yank rate (warp 7.5) */
114 prout(_(" caught in long range tractor beam--"));
115 /* If Kirk & Co. screwing around on planet, handle */
116 atover(1); /* atover(1) is Grab */
117 if (game.alldone) return;
118 if (game.icraft == 1) { /* Caught in Galileo? */
122 /* Check to see if shuttle is aboard */
123 if (game.iscraft==0) {
126 prout(_("Galileo, left on the planet surface, is captured"));
127 prout(_("by aliens and made into a flying McDonald's."));
128 game.damage[DSHUTTL] = -10;
132 prout(_("Galileo, left on the planet surface, is well hidden."));
136 game.quadx = game.state.isx;
137 game.quady = game.state.isy;
140 game.quadx = game.state.cx[i];
141 game.quady = game.state.cy[i];
143 iran(QUADSIZE, &game.sectx, &game.secty);
145 proutn(_(" is pulled to "));
146 proutn(cramlc(quadrant, game.quadx, game.quady));
148 prout(cramlc(sector, game.sectx, game.secty));
150 prout(_("(Remainder of rest/repair period cancelled.)"));
153 if (game.shldup==0) {
154 if (game.damage[DSHIELD]==0 && game.shield > 0) {
155 doshield(2); /* Shldsup */
158 else prout(_("(Shields not currently useable.)"));
161 /* Adjust finish time to time of tractor beaming */
162 fintim = game.state.date+game.optime;
164 if (game.state.remcom <= 0) game.future[FTBEAM] = FOREVER;
165 else game.future[FTBEAM] = game.state.date+game.optime+expran(1.5*game.intime/game.state.remcom);
167 case FSNAP: /* Snapshot of the universe (for time warp) */
168 game.snapsht = game.state;
170 game.future[FSNAP] = game.state.date + expran(0.5 * game.intime);
172 case FBATTAK: /* Commander attacks starbase */
173 if (game.state.remcom==0 || game.state.rembase==0) {
175 game.future[FBATTAK] = game.future[FCDBAS] = FOREVER;
181 if (game.state.baseqx[j]==game.state.cx[k] && game.state.baseqy[j]==game.state.cy[k] &&
182 (game.state.baseqx[j]!=game.quadx || game.state.baseqy[j]!=game.quady) &&
183 (game.state.baseqx[j]!=game.state.isx || game.state.baseqy[j]!=game.state.isy)) {
189 if (j>game.state.rembase) {
190 /* no match found -- try later */
191 game.future[FBATTAK] = game.state.date + expran(0.3*game.intime);
192 game.future[FCDBAS] = FOREVER;
195 /* commander + starbase combination found -- launch attack */
196 game.batx = game.state.baseqx[j];
197 game.baty = game.state.baseqy[j];
198 game.future[FCDBAS] = game.state.date+1.0+3.0*Rand();
199 if (game.isatb) /* extra time if SC already attacking */
200 game.future[FCDBAS] += game.future[FSCDBAS]-game.state.date;
201 game.future[FBATTAK] = game.future[FCDBAS] +expran(0.3*game.intime);
203 if (game.damage[DRADIO] != 0.0 &&
204 game.condit != IHDOCKED) break; /* No warning :-( */
206 if (ipage==0) pause_game(1);
209 proutn(_("Lt. Uhura- \"Captain, the starbase in "));
210 prout(cramlc(quadrant, game.batx, game.baty));
211 prout(_(" reports that it is under attack and that it can"));
212 proutn(_(" hold out only until stardate %d"),
213 (int)game.future[FCDBAS]);
217 proutn(_("Mr. Spock- \"Captain, shall we cancel the rest period?\""));
225 case FSCDBAS: /* Supercommander destroys base */
226 game.future[FSCDBAS] = FOREVER;
228 if (!game.state.galaxy[game.state.isx][game.state.isy].starbase)
229 break; /* WAS RETURN! */
232 game.batx = game.state.isx;
233 game.baty = game.state.isy;
234 case FCDBAS: /* Commander succeeds in destroying base */
236 game.future[FCDBAS] = FOREVER;
237 /* find the lucky pair */
239 if (game.state.cx[i]==game.batx && game.state.cy[i]==game.baty)
241 if (i > game.state.remcom || game.state.rembase == 0 ||
242 !game.state.galaxy[game.batx][game.baty].starbase) {
243 /* No action to take after all */
244 game.batx = game.baty = 0;
248 /* Code merges here for any commander destroying base */
249 /* Not perfect, but will have to do */
250 /* Handle case where base is in same quadrant as starship */
251 if (game.batx==game.quadx && game.baty==game.quady) {
252 game.state.chart[game.batx][game.baty].starbase = FALSE;
253 game.quad[game.basex][game.basey]= IHDOT;
254 game.basex=game.basey=0;
257 prout(_("Spock- \"Captain, I believe the starbase has been destroyed.\""));
259 else if (game.state.rembase != 1 &&
260 (game.damage[DRADIO] <= 0.0 || game.condit == IHDOCKED)) {
261 /* Get word via subspace radio */
262 if (ipage==0) pause_game(1);
265 prout(_("Lt. Uhura- \"Captain, Starfleet Command reports that"));
266 proutn(_(" the starbase in "));
267 proutn(cramlc(quadrant, game.batx, game.baty));
268 prout(_(" has been destroyed by"));
269 if (game.isatb==2) prout(_("the Klingon Super-Commander"));
270 else prout(_("a Klingon Commander"));
271 game.state.chart[game.batx][game.baty].starbase = FALSE;
273 /* Remove Starbase from galaxy */
274 game.state.galaxy[game.batx][game.baty].starbase = FALSE;
276 if (game.state.baseqx[i]==game.batx && game.state.baseqy[i]==game.baty) {
277 game.state.baseqx[i]=game.state.baseqx[game.state.rembase];
278 game.state.baseqy[i]=game.state.baseqy[game.state.rembase];
280 game.state.rembase--;
281 if (game.isatb == 2) {
282 /* reinstate a commander's base attack */
288 game.batx = game.baty = 0;
291 case FSCMOVE: /* Supercommander moves */
292 game.future[FSCMOVE] = game.state.date+0.2777;
293 if (game.ientesc+istract==0 &&
295 (game.iscate!=1 || game.justin==1)) scom(&ipage);
297 case FDSPROB: /* Move deep space probe */
298 game.future[FDSPROB] = game.state.date + 0.01;
299 game.probex += game.probeinx;
300 game.probey += game.probeiny;
301 i = (int)(game.probex/QUADSIZE +0.05);
302 j = (int)(game.probey/QUADSIZE + 0.05);
303 if (game.probecx != i || game.probecy != j) {
306 if (!VALID_QUADRANT(i, j) ||
307 game.state.galaxy[game.probecx][game.probecy].supernova) {
308 // Left galaxy or ran into supernova
309 if (game.damage[DRADIO]==0.0 || game.condit == IHDOCKED) {
310 if (ipage==0) pause_game(1);
313 proutn(_("Lt. Uhura- \"The deep space probe "));
314 if (!VALID_QUADRANT(j, i))
315 proutn(_("has left the galaxy"));
317 proutn(_("is no longer transmitting"));
320 game.future[FDSPROB] = FOREVER;
323 if (game.damage[DRADIO]==0.0 || game.condit == IHDOCKED) {
324 if (ipage==0) pause_game(1);
327 proutn(_("Lt. Uhura- \"The deep space probe is now in "));
328 proutn(cramlc(quadrant, game.probecx, game.probecy));
332 /* Update star chart if Radio is working or have access to
334 if (game.damage[DRADIO] == 0.0 || game.condit == IHDOCKED) {
335 game.state.chart[game.probecx][game.probecy].klingons = game.state.galaxy[game.probecx][game.probecy].klingons;
336 game.state.chart[game.probecx][game.probecy].starbase = game.state.galaxy[game.probecx][game.probecy].starbase;
337 game.state.chart[game.probecx][game.probecy].stars = game.state.galaxy[game.probecx][game.probecy].stars;
338 game.state.galaxy[game.probecx][game.probecy].charted = TRUE;
340 game.proben--; // One less to travel
341 if (game.proben == 0 && game.isarmed &&
342 game.state.galaxy[game.probecx][game.probecy].stars) {
343 /* lets blow the sucker! */
345 game.future[FDSPROB] = FOREVER;
346 if (game.state.galaxy[game.quadx][game.quady].supernova)
351 case FDISTR: /* inhabited system issues distress call */
352 /* in BSD Trek this is a straight 1 stardate ahead */
353 game.future[FDISTR] = game.state.date + 1.0 + Rand();
354 /* if we already have too many, throw this one away */
355 if (game.ndistr >= MAXDISTR)
357 /* try a whole bunch of times to find something suitable */
358 for (i = 0; i < 100; i++) {
360 iran(GALSIZE, &ix, &iy);
361 q = &game.state.galaxy[game.quadx][game.quady];
362 /* need a quadrant which is not the current one,
363 which has some stars which are inhabited and
364 not already under attack, which is not
365 supernova'ed, and which has some Klingons in it */
366 if (!((ix == game.quadx && iy == game.quady) || q->stars<=0 ||
367 (q->qsystemname & Q_DISTRESSED) ||
368 (q->qsystemname & Q_SYSTEM) == 0 || q->klings <= 0))
372 /* can't seem to find one; ignore this call */
375 /* got one!! Schedule its enslavement */
377 e = xsched(E_ENSLV, 1, ix, iy, q->qsystemname);
378 q->qsystemname = (e - Event) | Q_DISTRESSED;
380 /* tell the captain about it if we can */
381 if (game.damage[DRADIO] == 0.0)
383 printf("\nUhura: Captain, starsystem %s in quadrant %d,%d is under attack\n",
384 Systemname[e->systemname], ix, iy);
388 /* if we can't tell him, make it invisible */
389 e->evcode |= E_HIDDEN;
391 case FENSLV: /* starsystem is enslaved */
393 /* see if current distress call still active */
394 q = &Quad[e->x][e->y];
397 /* no Klingons, clean up */
398 /* restore the system name */
399 q->qsystemname = e->systemname;
403 /* play stork and schedule the first baby */
404 e = schedule(E_REPRO, Param.eventdly[E_REPRO] * franf(), e->x, e->y, e->systemname);
406 /* report the disaster if we can */
407 if (game.damage[DRADIO] == 0.0)
409 printf("\nUhura: We've lost contact with starsystem %s\n",
410 Systemname[e->systemname]);
411 printf(" in quadrant %d,%d.\n", e->x, e->y);
414 e->evcode |= E_HIDDEN;
416 case FREPRO: /* Klingon reproduces */
417 /* see if distress call is still active */
418 q = &Quad[e->x][e->y];
422 q->qsystemname = e->systemname;
425 xresched(e, E_REPRO, 1);
426 /* reproduce one Klingon */
429 if (Now.klings == 127)
430 break; /* full right now */
431 if (q->klings >= MAXKLQUAD)
433 /* this quadrant not ok, pick an adjacent one */
434 for (i = ix - 1; i <= ix + 1; i++)
436 if (!VALID_QUADRANT(i))
438 for (j = iy - 1; j <= iy + 1; j++)
440 if (!VALID_QUADRANT(j))
443 /* check for this quad ok (not full & no snova) */
444 if (q->klings >= MAXKLQUAD || q->stars < 0)
452 /* cannot create another yet */
457 /* deliver the child */
459 if (ix == game.quadx && iy == game.quady)
460 newkling(++game.klhere, &ixhold, &iyhold);
462 /* recompute time left */
463 game.state.remtime = game.state.remres/(game.state.remkl+4*game.state.remcom);
465 #endif /* EXPERIMENTAL */
474 double temp, delay, origTime;
479 if (key != IHEOL) break;
480 proutn(_("How long? "));
487 origTime = delay = aaitem;
488 if (delay <= 0.0) return;
489 if (delay >= game.state.remtime || game.nenhere != 0) {
490 proutn(_("Are you sure? "));
491 if (ja() == 0) return;
494 /* Alternate resting periods (events) with attacks */
498 if (delay <= 0) game.resting = 0;
499 if (game.resting == 0) {
500 prout(_("%d stardates left."), (int)game.state.remtime);
503 temp = game.optime = delay;
506 double rtime = 1.0 + Rand();
507 if (rtime < temp) temp = rtime;
510 if (game.optime < delay) attack(0);
511 if (game.alldone) return;
514 if (game.alldone) return;
516 /* Repair Deathray if long rest at starbase */
517 if (origTime-delay >= 9.99 && game.condit == IHDOCKED)
518 game.damage[DDRAY] = 0.0;
520 // leave if quadrant supernovas
521 (!game.state.galaxy[game.quadx][game.quady].supernova);
527 void nova(int ix, int iy)
529 static double course[] =
530 {0.0, 10.5, 12.0, 1.5, 9.0, 0.0, 3.0, 7.5, 6.0, 4.5};
531 int bot, top, top2, hits[QUADSIZE+1][3], kount, icx, icy, mm, nn, j;
532 int iquad, iquad1, i, ll, newcx, newcy, ii, jj;
534 /* Wow! We've supernova'ed */
539 /* handle initial nova */
540 game.quad[ix][iy] = IHDOT;
541 crmena(1, IHSTAR, 2, ix, iy);
543 game.state.galaxy[game.quadx][game.quady].stars--;
546 /* Set up stack to recursively trigger adjacent stars */
547 bot = top = top2 = 1;
553 for (mm = bot; mm <= top; mm++)
554 for (nn = 1; nn <= 3; nn++) /* nn,j represents coordinates around current */
555 for (j = 1; j <= 3; j++) {
556 if (j==2 && nn== 2) continue;
557 ii = hits[mm][1]+nn-2;
558 jj = hits[mm][2]+j-2;
559 if (!VALID_SECTOR(jj, ii)) continue;
560 iquad = game.quad[ii][jj];
562 // case IHDOT: /* Empty space ends reaction
569 case IHSTAR: /* Affect another star */
571 /* This star supernovas */
578 game.state.galaxy[game.quadx][game.quady].stars -= 1;
580 crmena(1, IHSTAR, 2, ii, jj);
582 game.quad[ii][jj] = IHDOT;
584 case IHP: /* Destroy planet */
585 game.state.galaxy[game.quadx][game.quady].planet = NULL;
586 game.state.nplankl++;
587 crmena(1, IHP, 2, ii, jj);
588 prout(_(" destroyed."));
589 DESTROY(&game.state.plnets[game.iplnet]);
590 game.iplnet = game.plnetx = game.plnety = 0;
591 if (game.landed == 1) {
595 game.quad[ii][jj] = IHDOT;
597 case IHB: /* Destroy base */
598 game.state.galaxy[game.quadx][game.quady].starbase = FALSE;
600 if (game.state.baseqx[i]==game.quadx && game.state.baseqy[i]==game.quady)
602 game.state.baseqx[i] = game.state.baseqx[game.state.rembase];
603 game.state.baseqy[i] = game.state.baseqy[game.state.rembase];
604 game.state.rembase--;
605 game.basex = game.basey = 0;
608 crmena(1, IHB, 2, ii, jj);
609 prout(_(" destroyed."));
610 game.quad[ii][jj] = IHDOT;
612 case IHE: /* Buffet ship */
614 prout(_("***Starship buffeted by nova."));
616 if (game.shield >= 2000.0) game.shield -= 2000.0;
618 double diff = 2000.0 - game.shield;
622 prout(_("***Shields knocked out."));
623 game.damage[DSHIELD] += 0.005*game.damfac*Rand()*diff;
626 else game.energy -= 2000.0;
627 if (game.energy <= 0) {
631 /* add in course nova contributes to kicking starship*/
632 icx += game.sectx-hits[mm][1];
633 icy += game.secty-hits[mm][2];
636 case IHK: /* kill klingon */
637 deadkl(ii,jj,iquad, ii, jj);
639 case IHC: /* Damage/destroy big enemies */
642 for_local_enemies(ll)
643 if (game.kx[ll]==ii && game.ky[ll]==jj) break;
644 game.kpower[ll] -= 800.0; /* If firepower is lost, die */
645 if (game.kpower[ll] <= 0.0) {
646 deadkl(ii, jj, iquad, ii, jj);
649 newcx = ii + ii - hits[mm][1];
650 newcy = jj + jj - hits[mm][2];
651 crmena(1, iquad, 2, ii, jj);
652 proutn(_(" damaged"));
653 if (!VALID_SECTOR(newcx, newcy)) {
654 /* can't leave quadrant */
658 iquad1 = game.quad[newcx][newcy];
659 if (iquad1 == IHBLANK) {
660 proutn(_(", blasted into "));
661 crmena(0, IHBLANK, 2, newcx, newcy);
663 deadkl(ii, jj, iquad, newcx, newcy);
666 if (iquad1 != IHDOT) {
667 /* can't move into something else */
671 proutn(_(", buffeted to "));
672 proutn(cramlc(sector, newcx, newcy));
673 game.quad[ii][jj] = IHDOT;
674 game.quad[newcx][newcy] = iquad;
677 game.kavgd[ll] = sqrt(square(game.sectx-newcx)+square(game.secty-newcy));
678 game.kdist[ll] = game.kavgd[ll];
691 /* Starship affected by nova -- kick it away. */
692 game.dist = kount*0.1;
693 if (icx) icx = (icx < 0 ? -1 : 1);
694 if (icy) icy = (icy < 0 ? -1 : 1);
695 game.direc = course[3*(icx+1)+icy+2];
696 if (game.direc == 0.0) game.dist = 0.0;
697 if (game.dist == 0.0) return;
698 game.optime = 10.0*game.dist/16.0;
700 prout(_("Force of nova displaces starship."));
701 game.iattak=2; /* Eliminates recursion problem */
703 game.optime = 10.0*game.dist/16.0;
708 void snova(int insx, int insy)
710 int comdead, nqx=0, nqy=0, nsx, nsy, num=0, kldead, iscdead;
719 /* NOVAMAX being used */
725 /* Scheduled supernova -- select star */
726 /* logic changed here so that we won't favor quadrants in top
730 stars += game.state.galaxy[nqx][nqy].stars;
733 if (stars == 0) return; /* nothing to supernova exists */
734 num = Rand()*stars + 1;
737 num -= game.state.galaxy[nqx][nqy].stars;
744 proutn("Super nova here?");
753 if (nqx != game.quady || nqy != game.quady || game.justin != 0) {
754 /* it isn't here, or we just entered (treat as inroute) */
755 if (game.damage[DRADIO] == 0.0 || game.condit == IHDOCKED) {
757 prout(_("Message from Starfleet Command Stardate %.2f"), game.state.date);
758 prout(_(" Supernova in %s; caution advised."),
759 cramlc(quadrant, nqx, nqy));
763 /* we are in the quadrant! */
765 num = Rand()* game.state.galaxy[nqx][nqy].stars + 1;
768 if (game.quad[nsx][nsy]==IHSTAR) {
783 prouts(_("***RED ALERT! RED ALERT!"));
785 prout(_("***Incipient supernova detected at "), cramlc(sector, nsx, nsy));
788 if (square(nsx-game.sectx) + square(nsy-game.secty) <= 2.1) {
789 proutn(_("Emergency override attempts t"));
790 prouts("***************");
796 /* destroy any Klingons in supernovaed quadrant */
797 kldead = game.state.galaxy[nqx][nqy].klingons;
798 game.state.galaxy[nqx][nqy].klingons = 0;
799 comdead = iscdead = 0;
800 if (nqx==game.state.isx && nqy == game.state.isy) {
801 /* did in the Supercommander! */
802 game.state.nscrem = game.state.isx = game.state.isy = game.isatb = game.iscate = 0;
804 game.future[FSCMOVE] = game.future[FSCDBAS] = FOREVER;
806 if (game.state.remcom) {
807 int maxloop = game.state.remcom, l;
808 for (l = 1; l <= maxloop; l++) {
809 if (game.state.cx[l] == nqx && game.state.cy[l] == nqy) {
810 game.state.cx[l] = game.state.cx[game.state.remcom];
811 game.state.cy[l] = game.state.cy[game.state.remcom];
812 game.state.cx[game.state.remcom] = game.state.cy[game.state.remcom] = 0;
816 if (game.state.remcom==0) game.future[FTBEAM] = FOREVER;
821 game.state.remkl -= kldead;
822 /* destroy Romulans and planets in supernovaed quadrant */
823 nrmdead = game.state.galaxy[nqx][nqy].romulans;
824 game.state.galaxy[nqx][nqy].romulans = 0;
825 game.state.nromrem -= nrmdead;
826 npdead = num - nrmdead*10;
829 for (l = 0; l < game.inplan; l++)
830 if (game.state.plnets[l].x == nqx && game.state.plnets[l].y == nqy) {
831 DESTROY(&game.state.plnets[l]);
834 /* Destroy any base in supernovaed quadrant */
835 if (game.state.rembase) {
836 int maxloop = game.state.rembase, l;
837 for (l = 1; l <= maxloop; l++)
838 if (game.state.baseqx[l]==nqx && game.state.baseqy[l]==nqy) {
839 game.state.baseqx[l] = game.state.baseqx[game.state.rembase];
840 game.state.baseqy[l] = game.state.baseqy[game.state.rembase];
841 game.state.baseqx[game.state.rembase] = game.state.baseqy[game.state.rembase] = 0;
842 game.state.rembase--;
846 /* If starship caused supernova, tally up destruction */
848 game.state.starkl += game.state.galaxy[nqx][nqy].stars;
849 game.state.basekl += game.state.galaxy[nqx][nqy].starbase;
850 game.state.nplankl += npdead;
852 /* mark supernova in galaxy and in star chart */
853 if ((game.quadx == nqx && game.quady == nqy) ||
854 game.damage[DRADIO] == 0 ||
855 game.condit == IHDOCKED)
856 game.state.galaxy[nqx][nqy].supernova = TRUE;
857 /* If supernova destroys last klingons give special message */
858 if (KLINGREM==0 && (nqx != game.quadx || nqy != game.quady)) {
860 if (insx == 0) prout(_("Lucky you!"));
861 proutn(_("A supernova in %s has just destroyed the last Klingons."),
862 cramlc(quadrant, nqx, nqy));
866 /* if some Klingons remain, continue or die in supernova */
867 if (game.alldone) finish(FSNOVAED);