|
|
1.1 root 1: #ifndef lint
2: static char sccsid[] = "@(#)abandon.c 4.3 (Berkeley) 5/27/83";
3: #endif not lint
4:
5: # include "trek.h"
6:
7: /*
8: ** Abandon Ship
9: **
10: ** The ship is abandoned. If your current ship is the Faire
11: ** Queene, or if your shuttlecraft is dead, you're out of
12: ** luck. You need the shuttlecraft in order for the captain
13: ** (that's you!!) to escape.
14: **
15: ** Your crew can beam to an inhabited starsystem in the
16: ** quadrant, if there is one and if the transporter is working.
17: ** If there is no inhabited starsystem, or if the transporter
18: ** is out, they are left to die in outer space.
19: **
20: ** These currently just count as regular deaths, but they
21: ** should count very heavily against you.
22: **
23: ** If there are no starbases left, you are captured by the
24: ** Klingons, who torture you mercilessly. However, if there
25: ** is at least one starbase, you are returned to the
26: ** Federation in a prisoner of war exchange. Of course, this
27: ** can't happen unless you have taken some prisoners.
28: **
29: ** Uses trace flag 40
30: */
31:
32: abandon()
33: {
34: register struct quad *q;
35: register int i;
36: int j;
37: register struct event *e;
38:
39: if (Ship.ship == QUEENE)
40: return (printf("You may not abandon ye Faire Queene\n"));
41: if (Ship.cond != DOCKED)
42: {
43: if (damaged(SHUTTLE))
44: return (out(SHUTTLE));
45: printf("Officers escape in shuttlecraft\n");
46: /* decide on fate of crew */
47: q = &Quad[Ship.quadx][Ship.quady];
48: if (q->qsystemname == 0 || damaged(XPORTER))
49: {
50: printf("Entire crew of %d left to die in outer space\n",
51: Ship.crew);
52: Game.deaths += Ship.crew;
53: }
54: else
55: {
56: printf("Crew beams down to planet %s\n", systemname(q));
57: }
58: }
59: /* see if you can be exchanged */
60: if (Now.bases == 0 || Game.captives < 20 * Game.skill)
61: lose(L_CAPTURED);
62: /* re-outfit new ship */
63: printf("You are hereby put in charge of an antiquated but still\n");
64: printf(" functional ship, the Fairie Queene.\n");
65: Ship.ship = QUEENE;
66: Ship.shipname = "Fairie Queene";
67: Param.energy = Ship.energy = 3000;
68: Param.torped = Ship.torped = 6;
69: Param.shield = Ship.shield = 1250;
70: Ship.shldup = 0;
71: Ship.cloaked = 0;
72: Ship.warp = 5.0;
73: Ship.warp2 = 25.0;
74: Ship.warp3 = 125.0;
75: Ship.cond = GREEN;
76: /* clear out damages on old ship */
77: for (i = 0; i < MAXEVENTS; i++)
78: {
79: e = &Event[i];
80: if (e->evcode != E_FIXDV)
81: continue;
82: unschedule(e);
83: }
84: /* get rid of some devices and redistribute probabilities */
85: i = Param.damprob[SHUTTLE] + Param.damprob[CLOAK];
86: Param.damprob[SHUTTLE] = Param.damprob[CLOAK] = 0;
87: while (i > 0)
88: for (j = 0; j < NDEV; j++)
89: {
90: if (Param.damprob[j] != 0)
91: {
92: Param.damprob[j] += 1;
93: i--;
94: if (i <= 0)
95: break;
96: }
97: }
98: /* pick a starbase to restart at */
99: i = ranf(Now.bases);
100: Ship.quadx = Now.base[i].x;
101: Ship.quady = Now.base[i].y;
102: /* setup that quadrant */
103: while (1)
104: {
105: initquad(1);
106: Sect[Ship.sectx][Ship.secty] = EMPTY;
107: for (i = 0; i < 5; i++)
108: {
109: Ship.sectx = Etc.starbase.x + ranf(3) - 1;
110: if (Ship.sectx < 0 || Ship.sectx >= NSECTS)
111: continue;
112: Ship.secty = Etc.starbase.y + ranf(3) - 1;
113: if (Ship.secty < 0 || Ship.secty >= NSECTS)
114: continue;
115: if (Sect[Ship.sectx][Ship.secty] == EMPTY)
116: {
117: Sect[Ship.sectx][Ship.secty] = QUEENE;
118: dock();
119: compkldist(0);
120: return;
121: }
122: }
123: }
124: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.