1*21288Sdist /* 2*21288Sdist * Copyright (c) 1980 Regents of the University of California. 3*21288Sdist * All rights reserved. The Berkeley software License Agreement 4*21288Sdist * specifies the terms and conditions for redistribution. 5*21288Sdist */ 6*21288Sdist 711689Smckusick #ifndef lint 8*21288Sdist static char sccsid[] = "@(#)ram.c 5.1 (Berkeley) 05/30/85"; 911689Smckusick #endif not lint 1011689Smckusick 1111689Smckusick # include "trek.h" 1211689Smckusick 1311689Smckusick /* 1411689Smckusick ** RAM SOME OBJECT 1511689Smckusick ** 1611689Smckusick ** You have run into some sort of object. It may be a Klingon, 1711689Smckusick ** a star, or a starbase. If you run into a star, you are really 1811689Smckusick ** stupid, because there is no hope for you. 1911689Smckusick ** 2011689Smckusick ** If you run into something else, you destroy that object. You 2111689Smckusick ** also rack up incredible damages. 2211689Smckusick */ 2311689Smckusick 2411689Smckusick ram(ix, iy) 2511689Smckusick int ix, iy; 2611689Smckusick { 2711689Smckusick register int i; 2811689Smckusick register char c; 2911689Smckusick 3011689Smckusick printf("RED ALERT: collision imminent\n"); 3111689Smckusick c = Sect[ix][iy]; 3211689Smckusick switch (c) 3311689Smckusick { 3411689Smckusick 3511689Smckusick case KLINGON: 3611689Smckusick printf("%s rams Klingon at %d,%d\n", Ship.shipname, ix, iy); 3711689Smckusick killk(ix, iy); 3811689Smckusick break; 3911689Smckusick 4011689Smckusick case STAR: 4111689Smckusick case INHABIT: 4211689Smckusick printf("Yeoman Rand: Captain, isn't it getting hot in here?\n"); 4311689Smckusick sleep(2); 4411689Smckusick printf("Spock: Hull temperature approaching 550 Degrees Kelvin.\n"); 4511689Smckusick lose(L_STAR); 4611689Smckusick 4711689Smckusick case BASE: 4811689Smckusick printf("You ran into the starbase at %d,%d\n", ix, iy); 4911689Smckusick killb(Ship.quadx, Ship.quady); 5011689Smckusick /* don't penalize the captain if it wasn't his fault */ 5111689Smckusick if (!damaged(SINS)) 5212344Slayer Game.killb += 1; 5311689Smckusick break; 5411689Smckusick } 5511689Smckusick sleep(2); 5611689Smckusick printf("%s heavily damaged\n", Ship.shipname); 5711689Smckusick 5811689Smckusick /* select the number of deaths to occur */ 5911689Smckusick i = 10 + ranf(20 * Game.skill); 6012344Slayer Game.deaths += i; 6112344Slayer Ship.crew -= i; 6211689Smckusick printf("McCoy: Take it easy Jim; we had %d casualties.\n", i); 6311689Smckusick 6411689Smckusick /* damage devices with an 80% probability */ 6511689Smckusick for (i = 0; i < NDEV; i++) 6611689Smckusick { 6711689Smckusick if (ranf(100) < 20) 6811689Smckusick continue; 6911689Smckusick damage(i, (2.5 * (franf() + franf()) + 1.0) * Param.damfac[i]); 7011689Smckusick } 7111689Smckusick 7211689Smckusick /* no chance that your shields remained up in all that */ 7311689Smckusick Ship.shldup = 0; 7411689Smckusick } 75