Update libressl README.DRAGONFLY for v2.4.4
[dragonfly.git] / games / trek / ram.c
blobce0d5f55a339939db2992773e3e9475866759094
1 /*-
2 * Copyright (c) 1980, 1993
3 * The Regents of the University of California. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. Neither the name of the University nor the names of its contributors
14 * may be used to endorse or promote products derived from this software
15 * without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
29 * @(#)ram.c 8.1 (Berkeley) 5/31/93
30 * $FreeBSD: src/games/trek/ram.c,v 1.4 1999/11/30 03:49:53 billf Exp $
31 * $DragonFly: src/games/trek/ram.c,v 1.3 2006/09/07 21:19:44 pavalos Exp $
34 #include "trek.h"
37 ** RAM SOME OBJECT
39 ** You have run into some sort of object. It may be a Klingon,
40 ** a star, or a starbase. If you run into a star, you are really
41 ** stupid, because there is no hope for you.
43 ** If you run into something else, you destroy that object. You
44 ** also rack up incredible damages.
47 void
48 ram(int ix, int iy)
50 int i;
51 char c;
53 printf("\07RED ALERT\07: collision imminent\n");
54 c = Sect[ix][iy];
55 switch (c) {
57 case KLINGON:
58 printf("%s rams Klingon at %d,%d\n", Ship.shipname, ix, iy);
59 killk(ix, iy);
60 break;
62 case STAR:
63 case INHABIT:
64 printf("Yeoman Rand: Captain, isn't it getting hot in here?\n");
65 sleep(2);
66 printf("Spock: Hull temperature approaching 550 Degrees Kelvin.\n");
67 lose(L_STAR);
69 case BASE:
70 printf("You ran into the starbase at %d,%d\n", ix, iy);
71 killb(Ship.quadx, Ship.quady);
72 /* don't penalize the captain if it wasn't his fault */
73 if (!damaged(SINS))
74 Game.killb += 1;
75 break;
77 sleep(2);
78 printf("%s heavily damaged\n", Ship.shipname);
80 /* select the number of deaths to occur */
81 i = 10 + ranf(20 * Game.skill);
82 Game.deaths += i;
83 Ship.crew -= i;
84 printf("McCoy: Take it easy Jim; we had %d casualties.\n", i);
86 /* damage devices with an 80% probability */
87 for (i = 0; i < NDEV; i++) {
88 if (ranf(100) < 20)
89 continue;
90 damage(i, (2.5 * (franf() + franf()) + 1.0) * Param.damfac[i]);
93 /* no chance that your shields remained up in all that */
94 Ship.shldup = 0;