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