|
|
1.1 root 1: # include "trek.h"
2:
3: /**
4: ** cause a nova to occur
5: **/
6:
7: nova(x, y)
8: int x, y;
9: {
10: int i, j;
11: int se;
12:
13: if (Sect[x][y] != STAR || Quad[Quadx][Quady].stars < 0)
14: return;
15: if (ranf(100) < 15)
16: {
17: printf("Spock: Star at %d,%d failed to nova\n", x, y);
18: return;
19: }
20: if (ranf(100) < 5) {
21: snova(x, y);
22: return;
23: }
24: printf("Spock: Star at %d,%d gone nova\n", x, y);
25:
26: if(ranf(3)) {
27: Sect[x][y] = EMPTY;
28: } else {
29: Sect[x][y] = BLACKHOLE;
30: Quad[Quadx][Quady].holes =+ 1;
31: }
32: Quad[Quadx][Quady].stars =- 1;
33: Game.kills =+ 1;
34: for (i = x - 1; i <= x + 1; i++)
35: {
36: if (i < 0 || i >= NSECTS)
37: continue;
38: for (j = y - 1; j <= y + 1; j++)
39: {
40: if (j < 0 || j >= NSECTS)
41: continue;
42: se = Sect[i][j];
43: switch (se)
44: {
45: case EMPTY:
46: case BLACKHOLE:
47: break;
48: case KLINGON:
49: killk(i, j);
50: break;
51: case STAR:
52: nova(i, j);
53: break;
54: case INHABIT:
55: kills(i, j, -1);
56: break;
57: case BASE:
58: killb(i, j); Game.killb++;
59: break;
60: case ENTERPRISE:
61: case QUEENE:
62: se = 2000;
63: if (Status.shldup)
64: if (Status.shield >= se)
65: {
66: Status.shield =- se;
67: se = 0;
68: }
69: else
70: {
71: se =- Status.shield;
72: Status.shield = 0;
73: }
74: Status.energy =- se;
75: if (Status.energy <= 0)
76: lose(L_SUICID);
77: break;
78:
79: default:
80: printf("Unknown object %c at %d,%d destroyed\n",
81: se, i, j);
82: Sect[i][j] = EMPTY;
83: break;
84: }
85: }
86: }
87: return;
88: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.