DCLOAK = 16
NDEVICES = 17 # Number of devices
-SKILL_NONE = 0
-SKILL_NOVICE = 1
-SKILL_FAIR = 2
-SKILL_GOOD = 3
-SKILL_EXPERT = 4
-SKILL_EMERITUS = 5
+SKILL_NONE = 0
+SKILL_NOVICE = 1
+SKILL_FAIR = 2
+SKILL_GOOD = 3
+SKILL_EXPERT = 4
+SKILL_EMERITUS = 5
def damaged(dev):
return (game.damage[dev] != 0.0)
return not damaged(DRADIO) or game.condition=="docked"
# Define future events
-FSPY = 0 # Spy event happens always (no future[] entry)
- # can cause SC to tractor beam Enterprise
+FSPY = 0 # Spy event happens always (no future[] entry)
+ # can cause SC to tractor beam Enterprise
FSNOVA = 1 # Supernova
FTBEAM = 2 # Commander tractor beams Enterprise
FSNAP = 3 # Snapshot for time warp
FSCMOVE = 6 # Supercommander moves (might attack base)
FSCDBAS = 7 # Supercommander destroys base
FDSPROB = 8 # Move deep space probe
-FDISTR = 9 # Emit distress call from an inhabited world
-FENSLV = 10 # Inhabited word is enslaved */
-FREPRO = 11 # Klingons build a ship in an enslaved system
-NEVENTS = 12
+FDISTR = 9 # Emit distress call from an inhabited world
+FENSLV = 10 # Inhabited word is enslaved */
+FREPRO = 11 # Klingons build a ship in an enslaved system
+NEVENTS = 12
# Abstract out the event handling -- underlying data structures will change
# when we implement stateful events
# Killed some type of Klingon
game.state.galaxy[game.quadrant.i][game.quadrant.j].klingons -= 1
game.klhere -= 1
- if etype == 'C':
+ if type == 'C':
game.state.kcmdr.remove(game.quadrant)
unschedule(FTBEAM)
if game.state.kcmdr:
schedule(FTBEAM, expran(1.0*game.incom/len(game.state.kcmdr)))
if is_scheduled(FCDBAS) and game.battle == game.quadrant:
unschedule(FCDBAS)
- elif etype == 'K':
+ elif type == 'K':
game.state.remkl -= 1
- elif etype == 'S':
+ elif type == 'S':
game.state.nscrem -= 1
game.state.kscmdr.invalidate()
game.isatb = 0
skip(1)
kk = 0
for wham in hits:
- if not kk < len(game.enemies):
- # Should never happen.
- break
if wham == 0:
continue
dustfac = randreal(0.9, 1.0)
finish(FWON)
if game.alldone:
return
+ kk -= 1 # don't do the increment
continue
else: # decide whether or not to emasculate klingon
if kpow > 0 and withprob(0.9) and kpow <= randreal(0.4, 0.8)*kpini:
prout(_("%d captured Klingons transferred to base") % (game.brigcapacity-game.brigfree))
game.kcaptured += game.brigcapacity-game.brigfree
game.brigfree = game.brigcapacity
- if not damaged(DRADIO) and \
+ if communicating() and \
((is_scheduled(FCDBAS) or game.isatb == 1) and not game.iseenit):
# get attack report from base
prout(_("Lt. Uhura- \"Captain, an important message from the starbase:\""))
iprompt = True
key = scanner.nexttok()
itemp = "verbose"
- if key == "IHREAL":
- delta.j = scanner.real
- else:
+ if key != "IHREAL":
huh()
raise TrekError
+ delta.j = scanner.real
key = scanner.nexttok()
- if key == "IHREAL":
- delta.i = scanner.real
- else:
- delta.i = 0
+ if key != "IHREAL":
+ huh()
+ raise TrekError
+ delta.i = scanner.real
# Check for zero movement
if delta.i == 0 and delta.j == 0:
scanner.chew()
scanner.chew()
if (game.options & OPTION_AUTOSCAN):
lrscan(silent=True)
- if not damaged(DRADIO):
+ if communicating():
rechart()
if game.lastchart < game.state.date and game.condition == "docked":
prout(_("Spock- \"I revised the Star Chart from the starbase's records.\""))
prout(_(" [Using Base's sensors]"))
else:
prout(_(" Short-range scan"))
- if goodScan and not damaged(DRADIO):
+ if goodScan and communicating():
game.state.chart[game.quadrant.i][game.quadrant.j].klingons = game.state.galaxy[game.quadrant.i][game.quadrant.j].klingons
game.state.chart[game.quadrant.i][game.quadrant.j].starbase = game.state.galaxy[game.quadrant.i][game.quadrant.j].starbase
game.state.chart[game.quadrant.i][game.quadrant.j].stars = game.state.galaxy[game.quadrant.i][game.quadrant.j].stars
huh()
else:
break
+ if game.options & OPTION_CURSES:
+ prout("COMMAND> %s" % cmd)
if cmd == "SRSCAN": # srscan
srscan()
elif cmd == "STATUS": # status