X-Git-Url: https://jxself.org/git/?p=super-star-trek.git;a=blobdiff_plain;f=sst.py;h=7c7d075a8c9527a484e089dcfd070ae77badfade;hp=2cc711bff8a37f570eec3fcefec01e5605ff8a2e;hb=aa6040b239a54a4fe69ba0d2e142b2ffa8bda9f4;hpb=328cfa015ee53eca56bf3c9145ff1461a12093fa diff --git a/sst.py b/sst.py index 2cc711b..7c7d075 100755 --- a/sst.py +++ b/sst.py @@ -2127,20 +2127,22 @@ def capture(): # intelligent design # x = 300 + 25*skill; x = game.energy / (weakest.power * len(klingons)) - x *= 2.5; # would originally have been equivalent of 1.4, + #prout(_("Stats: energy = %s, kpower = %s, klingons = %s") + # % (game.energy, weakest.power, len(klingons))) + x *= 2.5 # would originally have been equivalent of 1.4, # but we want command to work more often, more humanely */ - #prout(_("Prob = %d (%.4f)\n", i, x)) + #prout(_("Prob = %.4f" % x)) # x = 100; // For testing, of course! - if x > randreal(100): + if x < randreal(100): # guess what, he surrendered!!! */ prout(_("Klingon captain at %s surrenders.") % weakest.location) i = randreal(200) if i > 0: - prout(_("%d Klingons commit suicide rather than be taken captive.") % 200 - i) - if i > brigfree: - prout(_("%d Klingons die because there is no room for them in the brig.") % i-brigfree) - i = brigfree - brigfree -= i + prout(_("%d Klingons commit suicide rather than be taken captive.") % (200 - i)) + if i > game.brigfree: + prout(_("%d Klingons die because there is no room for them in the brig.") % (i-brigfree)) + i = game.brigfree + game.brigfree -= i prout(_("%d captives taken") % i) deadkl(weakest.location, weakest.type, game.sector) if (game.state.remkl + len(game.state.kcmdr) + game.state.nscrem)<=0: @@ -2148,7 +2150,7 @@ def capture(): return # big surprise, he refuses to surrender */ - prout(_("Fat chance, captain!")) + prout(_("Fat chance, captain!")) # Code from events.c begins here. @@ -3483,7 +3485,11 @@ def cgetline(): elif linein[0] != "#": break else: - linein = my_input() + "\n" + try: + linein = my_input() + "\n" + except EOFError: + prout("") + sys.exit(0) if logfp: logfp.write(linein) return linein @@ -3534,7 +3540,7 @@ def clrscr(): linecount = 0 def textcolor(color=DEFAULT): - if game.options & OPTION_COLOR: + if (game.options & OPTION_COLOR) and (game.options & OPTION_CURSES): if color == DEFAULT: curwnd.attrset(0) elif color == BLACK: @@ -3571,7 +3577,7 @@ def textcolor(color=DEFAULT): curwnd.attron(curses.color_pair(curses.COLOR_WHITE) | curses.A_BOLD) def highvideo(): - if game.options & OPTION_COLOR: + if (game.options & OPTION_COLOR) and (game.options & OPTION_CURSES): curwnd.attron(curses.A_REVERSE) # @@ -4005,15 +4011,16 @@ def getcourse(isprobe): iprompt = True key = scanner.nexttok() itemp = "verbose" - if key != "IHREAL": + if key == "IHREAL": + delta.j = scanner.real + else: huh() raise TrekError - delta.j = scanner.real key = scanner.nexttok() - if key != "IHREAL": - huh() - raise TrekError - delta.i = scanner.real + if key == "IHREAL": + delta.i = scanner.real + else: + delta.i = 0 # Check for zero movement if delta.i == 0 and delta.j == 0: scanner.chew()