@@ -13,12 +13,40 @@ def distance(x1, y1, x2, y2):
1313 y = y2 - y1
1414 return sqrt (x * x + y * y )
1515
16+ @staticmethod
17+ def sublight_navigation (game ):
18+ dest_sys = game .read_xypos ()
19+ if not dest_sys :
20+ game .display ("Invalid course." )
21+ game .display ()
22+ return
23+
24+ game .display ()
25+ game .display ("Sub-light engines engaged." )
26+ game .display ()
27+ game .game_map .go_to (dest_sys )
28+
29+ game .time_remaining -= 1
30+ game .star_date += 1
31+
32+ game .enterprise .short_range_scan (game )
33+
34+ if game .enterprise .docked :
35+ game .display ("Lowering shields as part of docking sequence..." )
36+ game .display ("Enterprise successfully docked with starbase." )
37+ game .display ()
38+ else :
39+ if game .game_map .klingons > 0 :
40+ ShipKlingon .attack_if_you_can (game )
41+ game .display ()
42+ elif not game .enterprise .repair (game ):
43+ game .enterprise .damage (game , - 1 )
1644
1745 @staticmethod
18- def navigation (game ):
46+ def warp_navigation (game ):
1947 if game .enterprise .navigation_damage > 0 :
2048 max_warp_factor = 0.2 + random .randint (0 , 8 ) / 10.0
21- game .display ("Warp engines damaged. Maximum warp factor: {0}" . format ( max_warp_factor ) )
49+ game .display (f "Warp engines damaged. Maximum warp factor: { max_warp_factor } " )
2250 game .display ()
2351
2452 dest_sys = game .read_sector ()
@@ -53,7 +81,7 @@ def navigation(game):
5381 game .display ()
5482 else :
5583 if game .game_map .klingons > 0 :
56- ShipKlingon .attack (game )
84+ ShipKlingon .attack_if_you_can (game )
5785 game .display ()
5886 elif not game .enterprise .repair (game ):
5987 game .enterprise .damage (game , - 1 )
0 commit comments