X-Git-Url: https://jxself.org/git/?p=super-star-trek.git;a=blobdiff_plain;f=src%2Ffinish.c;h=42333d5fdad2d6040ebe2ed6c12c27d4e0aaaadb;hp=d39257422299a0ba4aa61eb6bb4d4291753537df;hb=e4ddd3649bf73ddd7a1e2bb32e7ce2e631293068;hpb=0f68a074434296ae409accdc39ba0142600ea255 diff --git a/src/finish.c b/src/finish.c index d392574..42333d5 100644 --- a/src/finish.c +++ b/src/finish.c @@ -50,7 +50,8 @@ void selfdestruct(void) void kaboom(void) { stars(); - if (game.ship==IHE) prouts("***"); + if (game.ship==IHE) + prouts("***"); prouts(_("********* Entropy of ")); crmshp(); prouts(_(" maximized *********")); @@ -91,12 +92,15 @@ void finish(FINTYPE ifin) double badpt; badpt = 5.0*game.state.starkl + game.casual + 10.0*game.state.nplankl + 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! + if (game.ship == IHF) + badpt += 100.0; + else if (game.ship == 0) + badpt += 200.0; + if (badpt < 100.0) + badpt = 0.0; // Close enough! if (game.state.date-game.indate < 5.0 || // killsPerDate >= RateMax - KLINGKILLED/(game.state.date-game.indate) >= + ((game.inkling + game.incom + game.inscom) - (game.state.remkl + game.state.remcom + game.state.nscrem))/(game.state.date-game.indate) >= 0.1*game.skill*(game.skill+1.0) + 0.1 + 0.008*badpt) { skip(1); prout(_("In fact, you have done so well that Starfleet Command")); @@ -154,14 +158,15 @@ void finish(FINTYPE ifin) prout(_("LIVE LONG AND PROSPER.")); } score(); - if (igotit) plaque(); + if (igotit) + plaque(); return; case FDEPLETE: // Federation Resources Depleted prout(_("Your time has run out and the Federation has been")); prout(_("conquered. Your starship is now Klingon property,")); prout(_("and you are put on trial as a war criminal. On the")); proutn(_("basis of your record, you are ")); - if (KLINGREM*3.0 > INKLINGTOT) { + if ((game.state.remkl + game.state.remcom + game.state.nscrem)*3.0 > (game.inkling + game.incom + game.inscom)) { prout(_("acquitted.")); skip(1); prout(_("LIVE LONG AND PROSPER.")); @@ -219,7 +224,7 @@ void finish(FINTYPE ifin) break; case FMATERIALIZE: prout(_("Starbase was unable to re-materialize your starship.")); - prout(_("Sic transit gloria muntdi")); + prout(_("Sic transit gloria mundi")); break; case FPHASER: proutn(_("The ")); @@ -286,10 +291,12 @@ void finish(FINTYPE ifin) prout(_("Your last crew member has died.")); break; } - if (game.ship==IHF) game.ship= 0; - else if (game.ship == IHE) game.ship = IHF; + if (game.ship==IHF) + game.ship= 0; + else if (game.ship == IHE) + game.ship = IHF; game.alive = false; - if (KLINGREM != 0) { + if ((game.state.remkl + game.state.remcom + game.state.nscrem) != 0) { double goodies = game.state.remres/game.inresor; double baddies = (game.state.remkl + 2.0*game.state.remcom)/(game.inkling+2.0*game.incom); if (goodies/baddies >= 1.0+0.5*Rand()) { @@ -323,36 +330,43 @@ void score(void) int ithperd, iwon, klship; iskill = game.skill; - if ((timused == 0 || KLINGREM != 0) && timused < 5.0) timused = 5.0; - perdate = KLINGKILLED/timused; + if ((timused == 0 || (game.state.remkl + game.state.remcom + game.state.nscrem) != 0) && timused < 5.0) + timused = 5.0; + perdate = ((game.inkling + game.incom + game.inscom) - (game.state.remkl + game.state.remcom + game.state.nscrem))/timused; ithperd = 500*perdate + 0.5; iwon = 0; - if (game.gamewon) iwon = 100*game.skill; - if (game.ship == IHE) klship = 0; - else if (game.ship == IHF) klship = 1; - else klship = 2; - if (!game.gamewon) game.state.nromrem = 0; // None captured if no win - iscore = 10*NKILLK + 50*NKILLC + ithperd + iwon + if (game.gamewon) + iwon = 100*game.skill; + if (game.ship == IHE) + klship = 0; + else if (game.ship == IHF) + klship = 1; + else + klship = 2; + if (!game.gamewon) + game.state.nromrem = 0; // None captured if no win + iscore = 10*(game.inkling - game.state.remkl) + 50*(game.incom - game.state.remcom) + ithperd + iwon - 100*game.state.basekl - 100*klship - 45*game.nhelp -5*game.state.starkl - game.casual - + 20*NKILLROM + 200*NKILLSC - 10*game.state.nplankl - 300*game.state.nworldkl + game.state.nromrem; - if (!game.alive) iscore -= 200; + + 20*(game.inrom - game.state.nromrem) + 200*(game.inscom - game.state.nscrem) - 10*game.state.nplankl - 300*game.state.nworldkl + game.state.nromrem; + if (!game.alive) + iscore -= 200; skip(2); prout(_("Your score --")); - if (NKILLROM) + if (game.inrom - game.state.nromrem) prout(_("%6d Romulans destroyed %5d"), - NKILLROM,20*NKILLROM); + game.inrom - game.state.nromrem, 20*(game.inrom - game.state.nromrem)); if (game.state.nromrem) prout(_("%6d Romulans captured %5d"), game.state.nromrem, game.state.nromrem); - if (NKILLK) + if (game.inkling - game.state.remkl) prout(_("%6d ordinary Klingons destroyed %5d"), - NKILLK, 10*NKILLK); - if (NKILLC) + game.inkling - game.state.remkl, 10*(game.inkling - game.state.remkl)); + if (game.incom - game.state.remcom) prout(_("%6d Klingon commanders destroyed %5d"), - NKILLC, 50*NKILLC); - if (NKILLSC) + game.incom - game.state.remcom, 50*(game.incom - game.state.remcom)); + if (game.inscom - game.state.nscrem) prout(_("%6d Super-Commander destroyed %5d"), - NKILLSC, 200*NKILLSC); + game.inscom - game.state.nscrem, 200*(game.inscom - game.state.nscrem)); if (ithperd) prout(_("%6.2f Klingons per stardate %5d"), perdate, ithperd); @@ -408,7 +422,6 @@ void plaque(void) char winner[128]; skip(2); - while (fp == NULL) { proutn(_("File or device name for your plaque: ")); cgetline(winner, sizeof(winner));