99from Calculators import Calc
1010from Reports import Stats
1111from Quips import Quips
12+ from Difficulity import Probabilities
1213
1314class Control ():
1415
@@ -32,7 +33,7 @@ def computer(game):
3233 game .display ()
3334 game .display ("Invalid computer command." )
3435 game .display ()
35- game .enterprise .damage (game , 4 )
36+ game .enterprise .damage (game , Probabilities . COMPUTER )
3637
3738
3839 @staticmethod
@@ -43,7 +44,7 @@ def phasers(game):
4344 return
4445 kships = game .game_map .get_area_klingons ()
4546 if len (kships ) == 0 :
46- game .display ("There are no Klingon ships in this quadrant ." )
47+ game .display ("There are no Klingon ships in this sector ." )
4748 game .display ()
4849 return
4950 game .display ("Phasers locked on target." )
@@ -72,11 +73,12 @@ def phasers(game):
7273 else :
7374 game .display (f"Hit ship at [{ ship .xpos + 1 } ,{ ship .ypos + 1 } ]." )
7475 game .display (f"Enemy shield down to { ship .shield_level } ." )
75- game .game_map .remove_items (destroyed_ships )
76- if game .game_map .klingons > 0 :
76+ game .game_map .remove_area_items (destroyed_ships )
77+ if game .game_map .count_area_klingons () > 0 :
7778 game .display ()
7879 ShipKlingon .attack_if_you_can (game )
7980 game .display ()
81+ game .enterprise .damage (game , Probabilities .PHASERS )
8082
8183
8284 def shields (game ):
@@ -111,6 +113,7 @@ def shields(game):
111113 game .enterprise .shield_level -= int (transfer )
112114 game .display ("Shield strength is now {0}. Energy level is now {1}." .format (game .enterprise .shield_level , game .enterprise .energy ))
113115 game .display ()
116+ game .enterprise .damage (game , Probabilities .SHIELDS )
114117
115118
116119 def torpedos (game ):
@@ -122,8 +125,8 @@ def torpedos(game):
122125 game .display ("Photon torpedoes exhausted." )
123126 game .display ()
124127 return
125- if len ( game .game_map .get_area_klingons () ) == 0 :
126- game .display ("There are no Klingon ships in this quadrant ." )
128+ if game .game_map .count_area_klingons ( ) == 0 :
129+ game .display ("There are no Klingon ships in this sector ." )
127130 game .display ()
128131 return
129132 shot = game .read_xypos ()
@@ -140,33 +143,34 @@ def torpedos(game):
140143 print (f'{ ship .glyph } ({ ship .xpos } ,{ ship .ypos } ), shot({ shot .xpos } ,{ shot .ypos } )' )
141144 if ship .xpos == shot .xpos and ship .ypos == shot .ypos :
142145 if ship .glyph == Glyphs .KLINGON :
143- num = game .game_map .game_id (ship )
146+ num = game .game_map .get_game_id (ship )
144147 game .display (f"Klingon ship #{ num } destroyed." )
145148 game .display (Quips .jibe_defeat ('enemy' ))
146- game .game_map .remove_items ([ship ])
149+ game .game_map .remove_area_items ([ship ])
147150 hit = True
148151 break
149152 elif ship .glyph == Glyphs .STARBASE :
150- game .game_map .starbases -= 1
151- num = game .game_map .game_id (ship )
153+ game .game_map .game_starbases -= 1
154+ num = game .game_map .get_game_id (ship )
152155 game .display ("Federation Starbase #{num} destroyed!" )
153156 game .display (Quips .jibe_defeat ('commander' ))
154- game .game_map .remove_items ([ship ])
157+ game .game_map .remove_area_items ([ship ])
155158 hit = True
156159 break
157160 elif ship .glyph == Glyphs .STAR :
158- num = game .game_map .game_id (ship )
161+ num = game .game_map .get_game_id (ship )
159162 game .display (f"Torpedo vaporizes star #{ num } !" )
160163 game .display (Quips .jibe_defeat ('academic' ))
161- game .game_map .remove_items ([ship ])
164+ game .game_map .remove_area_items ([ship ])
162165 hit = True
163166 break
164167 if not hit :
165168 game .display ("Torpedo missed." )
166- if len ( game .game_map .get_area_klingons () ) > 0 :
169+ if game .game_map .count_area_klingons ( ) > 0 :
167170 game .display ()
168171 ShipKlingon .attack_if_you_can (game )
169172 game .display ()
173+ game .enterprise .damage (game , Probabilities .PHOTON )
170174
171175
172176
0 commit comments