From: Eric S. Raymond Date: Tue, 19 Sep 2006 19:04:35 +0000 (+0000) Subject: More BSD features. X-Git-Tag: 2.0~230 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=fbb4aa04129c7e9fbe17428c5e151d4afbdd039e;p=super-star-trek.git More BSD features. You can now lose if your entire crew dies in battle. When abandoning ship in a game with inhabited worlds enabled, they must have one in the quadrant to beam down to; otherwise they die in space and this counts heavily against your score (BSD Trek had score adjustment as a to-do). Docking at a starbase replenishes your crew. --- diff --git a/src/battle.c b/src/battle.c index eb6fbe6..b200f4d 100644 --- a/src/battle.c +++ b/src/battle.c @@ -158,6 +158,7 @@ void ram(int ibumpd, int ienm, coord w) icas = 10.0+20.0*Rand(); prout(_("***Sickbay reports %d casualties"), icas); game.casual += icas; + game.state.crew -= icas; for (l=0; l < NDEVICES; l++) { if (l == DDRAY) continue; // Don't damage deathray @@ -550,13 +551,13 @@ void attack(int torps_ok) if (absorb > game.shield) absorb = game.shield; game.shield -= absorb; hit -= hitsh; - if (game.condit==IHDOCKED) dock(0); + if (game.condit==IHDOCKED) dock(false); if (propor > 0.1 && hit < 0.005*game.energy) continue; } /* It's a hit -- print out hit size */ atackd = 1; /* We weren't going to check casualties, etc. if shields were down for some strange reason. This - doesn't make any sense, so I've fw.xed it */ + doesn't make any sense, so I've fixed it */ ihurt = 1; proutn(_("%d unit hit"), (int)hit); if ((damaged(DSRSENS) && itflag) || game.skill<=SKILL_FAIR) { @@ -574,7 +575,7 @@ void attack(int torps_ok) fry(hit); game.energy -= hit; if (game.condit==IHDOCKED) - dock(0); + dock(false); } if (game.energy <= 0) { /* Returning home upon your shield, not with it... */ @@ -606,6 +607,7 @@ void attack(int torps_ok) prout(_("Mc Coy- \"Sickbay to bridge. We suffered %d casualties"), icas); prout(_(" in that last attack.\"")); game.casual += icas; + game.state.crew -= icas; } } /* After attack, reset average distance to enemies */ @@ -891,7 +893,8 @@ static int checkshctrl(double rpow) skip(1); prout(_("McCoy to bridge- \"Severe radiation burns, Jim.")); prout(_(" %d casualties so far.\""), icas); - game.casual -= icas; + game.casual += icas; + game.state.crew -= icas; } skip(1); prout(_("Phaser energy dispersed by shields.")); diff --git a/src/events.c b/src/events.c index 079fea4..9954401 100644 --- a/src/events.c +++ b/src/events.c @@ -112,6 +112,11 @@ void events(void) finish(FDEPLETE); return; } + /* Any crew left alive? */ + if (game.state.crew <=0) { + finish(FCREW); + return; + } /* Is life support adequate? */ if (damaged(DLIFSUP) && game.condit != IHDOCKED) { if (game.lsupres < xtime && game.damage[DLIFSUP] > game.lsupres) { diff --git a/src/finish.c b/src/finish.c index 78680d8..9c518b6 100644 --- a/src/finish.c +++ b/src/finish.c @@ -88,7 +88,7 @@ void finish(FINTYPE ifin) if (game.alive) { double badpt; badpt = 5.0*game.state.starkl + game.casual + 10.0*game.state.nplankl + - 45.*game.nhelp+100.*game.state.basekl; + 45.*game.nhelp+100.*game.state.basekl+3.*game.abandoned; if (game.ship == IHF) badpt += 100.0; else if (game.ship == 0) badpt += 200.0; if (badpt < 100.0) badpt = 0.0; // Close enough! @@ -278,6 +278,9 @@ void finish(FINTYPE ifin) prout(_("Your ship is drawn to the center of the black hole.")); prout(_("You are crushed into extremely dense matter.")); break; + case FCREW: + prout(_("Your last crew member has died.")); + break; } if (game.ship==IHF) game.ship= 0; else if (game.ship == IHE) game.ship = IHF; @@ -366,6 +369,9 @@ void score(void) if (game.casual) prout(_("%6d casualties incurred %5d"), game.casual, -game.casual); + if (game.abandoned) + prout(_("%6d crew abandoned in space %5d"), + game.abandoned, -3*game.abandoned); if (klship) prout(_("%6d ship(s) lost or destroyed %5d"), klship, -100*klship); diff --git a/src/moving.c b/src/moving.c index f9986c4..126d3ba 100644 --- a/src/moving.c +++ b/src/moving.c @@ -214,10 +214,10 @@ no_quad_change: return; } -void dock(int l) +void dock(bool verbose) { chew(); - if (game.condit == IHDOCKED && l) { + if (game.condit == IHDOCKED && verbose) { prout(_("Already docked.")); return; } @@ -231,12 +231,13 @@ void dock(int l) return; } game.condit = IHDOCKED; - if (l) prout(_("Docked.")); + if (verbose) prout(_("Docked.")); game.ididit=1; if (game.energy < game.inenrg) game.energy = game.inenrg; game.shield = game.inshld; game.torps = game.intorps; game.lsupres = game.inlsr; + game.state.crew = FULLCREW; if (!damaged(DRADIO) && (is_scheduled(FCDBAS) || game.isatb == 1) && game.iseenit == 0) { /* get attack report from base */ diff --git a/src/setup.c b/src/setup.c index 94c7416..812a6c1 100644 --- a/src/setup.c +++ b/src/setup.c @@ -28,7 +28,7 @@ void freeze(bool boss) } else { if ((key = scan()) == IHEOL) { - proutn("File name: "); + proutn(_("File name: ")); key = scan(); } if (key != IHALPHA) { @@ -41,7 +41,7 @@ void freeze(bool boss) } } if ((fp = fopen(citem, "wb")) == NULL) { - proutn("Can't freeze game as file "); + proutn(_("Can't freeze game as file ")); proutn(citem); skip(1); return; @@ -169,6 +169,8 @@ void abandn(void) prout("to %s.", systemname(q->planet)); } else { prout("Entire crew of %d left to die in outer space."); + game.casual += game.state.crew; + game.abandoned += game.state.crew; } /* If at least one base left, give 'em the Faerie Queene */ @@ -202,6 +204,7 @@ void abandn(void) } /* Get new commission */ game.quad[game.sector.x][game.sector.y] = game.ship = IHF; + game.state.crew = FULLCREW; prout("Starfleet puts you in command of another ship,"); prout("the Faerie Queene, which is antiquated but,"); prout("still useable."); @@ -232,6 +235,7 @@ void setup(int needprompt) // Prepare the Enterprise game.alldone = game.gamewon = 0; game.ship = IHE; + game.state.crew = FULLCREW; game.energy = game.inenrg = 5000.0; game.shield = game.inshld = 2500.0; game.shldchg = 0; @@ -249,7 +253,7 @@ void setup(int needprompt) // Set up assorted game parameters game.battle.x = game.battle.y = 0; game.state.date = game.indate = 100.0*(int)(31.0*Rand()+20.0); - game.nkinks = game.nhelp = game.casual = 0; + game.nkinks = game.nhelp = game.casual = game.abandoned = 0; game.resting = false; game.isatb = game.iscate = game.imine = game.icrystl = game.icraft = game.state.nplankl = 0; game.state.starkl = game.state.basekl = 0; diff --git a/src/sst.c b/src/sst.c index 021e3d9..95ab355 100644 --- a/src/sst.c +++ b/src/sst.c @@ -162,6 +162,12 @@ for a lot of magic numbers and refactored the heck out of it. type is "plain" or "almy".) 6. User input is now logged so we can do regression testing. + + 7. More BSD-Trek features: You can now lose if your entire crew + dies in battle. When abandoning ship in a game with inhabited + worlds enabled, they must have one in the quadrant to beam down + to; otherwise they die in space and this counts heavily against + your score. Docking at a starbase replenishes your crew. */ /* the input queue */ diff --git a/src/sst.h b/src/sst.h index d58fea3..8651afd 100644 --- a/src/sst.h +++ b/src/sst.h @@ -58,6 +58,8 @@ typedef struct { typedef struct { int snap, // snapshot taken + crew, // crew complement +#define FULLCREW 428 /* BSD Trek was 387, that's wrong */ remkl, // remaining klingons remcom, // remaining commanders nscrem, // remaining super commanders @@ -224,6 +226,7 @@ struct game { condit, // condition (red/yellow/green/docked) torps, // number of torpedoes ship, // ship type -- 'E' is Enterprise + abandoned, // count of crew abandoned in space length, // length of game skill, // skill level klhere, // klingons here @@ -295,7 +298,7 @@ typedef enum {FWON, FDEPLETE, FLIFESUP, FNRG, FBATTLE, FNEG3, FNOVA, FSNOVAED, FABANDN, FDILITHIUM, FMATERIALIZE, FPHASER, FLOST, FMINING, FDPLANET, FPNOVA, FSSC, FSTRACTOR, FDRAY, FTRIBBLE, - FHOLE} FINTYPE ; + FHOLE, FCREW} FINTYPE ; enum loctype {neither, quadrant, sector}; #define IHR 'R' @@ -336,7 +339,7 @@ void phasers(void); void photon(void); void warp(bool); void doshield(int); -void dock(int); +void dock(bool); void dreprt(void); void chart(int); void rechart(void);