|
|
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[] = "@(#)ram.c 5.4 (Berkeley) 6/18/88"; ! 20: #endif /* not lint */ ! 21: ! 22: # include "trek.h" ! 23: ! 24: /* ! 25: ** RAM SOME OBJECT ! 26: ** ! 27: ** You have run into some sort of object. It may be a Klingon, ! 28: ** a star, or a starbase. If you run into a star, you are really ! 29: ** stupid, because there is no hope for you. ! 30: ** ! 31: ** If you run into something else, you destroy that object. You ! 32: ** also rack up incredible damages. ! 33: */ ! 34: ! 35: ram(ix, iy) ! 36: int ix, iy; ! 37: { ! 38: register int i; ! 39: register char c; ! 40: ! 41: printf("\07RED ALERT\07: collision imminent\n"); ! 42: c = Sect[ix][iy]; ! 43: switch (c) ! 44: { ! 45: ! 46: case KLINGON: ! 47: printf("%s rams Klingon at %d,%d\n", Ship.shipname, ix, iy); ! 48: killk(ix, iy); ! 49: break; ! 50: ! 51: case STAR: ! 52: case INHABIT: ! 53: printf("Yeoman Rand: Captain, isn't it getting hot in here?\n"); ! 54: sleep(2); ! 55: printf("Spock: Hull temperature approaching 550 Degrees Kelvin.\n"); ! 56: lose(L_STAR); ! 57: ! 58: case BASE: ! 59: printf("You ran into the starbase at %d,%d\n", ix, iy); ! 60: killb(Ship.quadx, Ship.quady); ! 61: /* don't penalize the captain if it wasn't his fault */ ! 62: if (!damaged(SINS)) ! 63: Game.killb += 1; ! 64: break; ! 65: } ! 66: sleep(2); ! 67: printf("%s heavily damaged\n", Ship.shipname); ! 68: ! 69: /* select the number of deaths to occur */ ! 70: i = 10 + ranf(20 * Game.skill); ! 71: Game.deaths += i; ! 72: Ship.crew -= i; ! 73: printf("McCoy: Take it easy Jim; we had %d casualties.\n", i); ! 74: ! 75: /* damage devices with an 80% probability */ ! 76: for (i = 0; i < NDEV; i++) ! 77: { ! 78: if (ranf(100) < 20) ! 79: continue; ! 80: damage(i, (2.5 * (franf() + franf()) + 1.0) * Param.damfac[i]); ! 81: } ! 82: ! 83: /* no chance that your shields remained up in all that */ ! 84: Ship.shldup = 0; ! 85: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.