]> git.cameronkatri.com Git - bsdgames-darwin.git/blob - trek/board.x
Fix for compiling with -DFANCY, as per PR 5832 by Joseph Myers <jsm28@cam.ac.uk>
[bsdgames-darwin.git] / trek / board.x
1 /* $NetBSD: board.x,v 1.2 1995/04/22 10:58:30 cgd Exp $ */
2
3 # include "trek.h"
4
5 /*
6 ** BOARD A KLINGON
7 **
8 ** A Klingon battle cruiser is boarded. If the boarding party
9 ** is successful, they take over the vessel, otherwise, you
10 ** have wasted a move. Needless to say, this move is not free.
11 **
12 ** User parameters are the Klingon to be boarded and the size of
13 ** the boarding party.
14 **
15 ** Three things are computed. The first is the probability that
16 ** the party takes over the Klingon. This is dependent on the
17 ** size of the party, the condition of the Klingon (for which
18 ** the energy left is used, which is definately incorrect), and
19 ** the number of losses that the boarding party sustains. If too
20 ** many of the boarding party are killed, the probability drops
21 ** to zero. The second quantity computed is the losses that the
22 ** boarding party sustains. This counts in your score. It
23 ** depends on the absolute and relative size of the boarding
24 ** party and the strength of the Klingon. The third quantity
25 ** computed is the number of Klingon captives you get to take.
26 ** It is actually computed as the number of losses they sustain
27 ** subtracted from the size of their crew. It depends on the
28 ** relative size of the party. All of these quantities are
29 ** randomized in some fashion.
30 */
31
32 board()
33 {
34 int prob;
35 int losses;
36 int captives;
37 float t;
38 int party;
39
40 if (checkout(XPORTER))
41 return;
42
43 k = selectklingon();
44 if (!k->srndreq)
45 {
46 return (printf("But captain! You must request surrender first\n"));
47 }
48
49 t = party / Param.crew;
50
51 prob = 1000 * t;
52 prob =- 500 * k->power / Param.klingpwr;
53
54 losses = party * k->power * t * 0.5 / Param.klingpwr * (franf() + 1.0);
55 if (losses * 4 > party)
56 prob = 0;
57
58 captives = %%% * (1.0 - t) * 0.5 * (franf() + 1.0);
59
60 if (prob > ranf(1000))
61 success!!!;