@@ -74,7 +74,7 @@ async def on_step(self, iteration):
7474 async def clean_up_center (self ):
7575 map_center = self .game_info .map_center
7676 # Remove everything close to map center
77- my_units = self .units | self . structures
77+ my_units = self .all_own_units
7878 if my_units :
7979 my_units = my_units .closer_than (20 , map_center )
8080 if my_units :
@@ -143,8 +143,8 @@ async def test_game_info_static_variables(self):
143143 assert len (self .game_info .player_races ) == 2 , self .game_info .player_races
144144 self .tests_done_by_name .add ("test_game_info_static_variables" )
145145
146- # Test BotAI action: train SCV
147146 async def test_botai_actions1 (self ):
147+ # Test BotAI action: train SCV
148148 while self .already_pending (UnitTypeId .SCV ) < 1 :
149149 if self .can_afford (UnitTypeId .SCV ):
150150 self .townhalls .random .train (UnitTypeId .SCV )
@@ -184,8 +184,8 @@ def temp_filter(unit: Unit):
184184 await self ._advance_steps (2 )
185185 logger .warning ("Action test 02 successful." )
186186
187- # Test BotAI action: move some scvs to the center, some to minerals
188187 async def test_botai_actions3 (self ):
188+ # Test BotAI action: move some scvs to the center, some to minerals
189189 center = self .game_info .map_center
190190
191191 while self .units .filter (lambda x : x .is_moving ).amount < 6 and self .units .gathering .amount >= 6 :
@@ -202,8 +202,8 @@ async def test_botai_actions3(self):
202202 await self ._advance_steps (2 )
203203 logger .warning ("Action test 03 successful." )
204204
205- # Test BotAI action: move all SCVs to mine minerals near townhall
206205 async def test_botai_actions4 (self ):
206+ # Test BotAI action: move all SCVs to mine minerals near townhall
207207 while self .units .gathering .amount < 12 :
208208 mf = self .mineral_field .closest_to (self .townhalls .random )
209209 for scv in self .workers :
@@ -213,8 +213,8 @@ async def test_botai_actions4(self):
213213 await self ._advance_steps (2 )
214214 logger .warning ("Action test 04 successful." )
215215
216- # Test BotAI action: self.expand_now() which tests for get_next_expansion, select_build_worker, can_place, find_placement, build and can_afford
217216 async def test_botai_actions5 (self ):
217+ # Test BotAI action: self.expand_now() which tests for get_next_expansion, select_build_worker, can_place, find_placement, build and can_afford
218218 # Wait till worker has started construction of CC
219219 while 1 :
220220 if self .can_afford (UnitTypeId .COMMANDCENTER ):
@@ -237,8 +237,8 @@ async def test_botai_actions5(self):
237237 await self ._advance_steps (2 )
238238 logger .warning ("Action test 05 successful." )
239239
240- # Test if reaper grenade shows up in effects
241240 async def test_botai_actions6 (self ):
241+ # Test if reaper grenade shows up in effects
242242 center = self .game_info .map_center
243243
244244 while 1 :
@@ -263,8 +263,8 @@ async def test_botai_actions6(self):
263263 await self ._advance_steps (100 )
264264 logger .warning ("Action test 06 successful." )
265265
266- # Test ravager effects
267266 async def test_botai_actions7 (self ):
267+ # Test ravager effects
268268 center = self .game_info .map_center
269269 while 1 :
270270 if self .units (UnitTypeId .RAVAGER ).amount < 10 :
@@ -287,8 +287,8 @@ async def test_botai_actions7(self):
287287 await self ._advance_steps (100 )
288288 logger .warning ("Action test 07 successful." )
289289
290- # Test if train function works on hatchery, lair, hive
291290 async def test_botai_actions8 (self ):
291+ # Test if train function works on hatchery, lair, hive
292292 center = self .game_info .map_center
293293 if not self .structures (UnitTypeId .HIVE ):
294294 await self .client .debug_create_unit ([[UnitTypeId .HIVE , 1 , center , 1 ]])
@@ -319,8 +319,8 @@ async def test_botai_actions8(self):
319319 await self ._advance_steps (2 )
320320 logger .warning ("Action test 08 successful." )
321321
322- # Morph an archon from 2 high templars
323322 async def test_botai_actions9 (self ):
323+ # Morph an archon from 2 high templars
324324 center = self .game_info .map_center
325325 await self .client .debug_create_unit (
326326 [
@@ -360,8 +360,8 @@ async def test_botai_actions9(self):
360360 await self ._advance_steps (2 )
361361 logger .warning ("Action test 09 successful." )
362362
363- # Morph 400 banelings from 400 lings in the same frame
364363 async def test_botai_actions10 (self ):
364+ # Morph 400 banelings from 400 lings in the same frame
365365 center = self .game_info .map_center
366366
367367 target_amount = 400
@@ -381,8 +381,9 @@ async def test_botai_actions10(self):
381381 # Spawn units
382382 if not bane_nests :
383383 await self .client .debug_create_unit ([[UnitTypeId .BANELINGNEST , 1 , center , 1 ]])
384- if banes .amount + bane_cocoons .amount + lings .amount < target_amount :
385- await self .client .debug_create_unit ([[UnitTypeId .ZERGLING , target_amount - lings .amount , center , 1 ]])
384+ current_amount = banes .amount + bane_cocoons .amount + lings .amount
385+ if current_amount < target_amount :
386+ await self .client .debug_create_unit ([[UnitTypeId .ZERGLING , target_amount - current_amount , center , 1 ]])
386387
387388 if lings .amount >= target_amount and self .minerals >= 10_000 and self .vespene >= 10_000 :
388389 for ling in lings :
@@ -402,8 +403,8 @@ async def test_botai_actions10(self):
402403 await self ._advance_steps (2 )
403404 logger .warning ("Action test 10 successful." )
404405
405- # Trigger anti armor missile of raven against enemy unit and check if buff was received
406406 async def test_botai_actions11 (self ):
407+ # Trigger anti armor missile of raven against enemy unit and check if buff was received
407408 await self .clean_up_center ()
408409 await self .clean_up_center ()
409410
@@ -435,10 +436,8 @@ async def test_botai_actions11(self):
435436 logger .warning ("Action test 11 successful." )
436437 await self .clean_up_center ()
437438
438- # Test if structures_without_construction_SCVs works after killing the scv
439439 async def test_botai_actions12 (self ):
440- map_center : Point2 = self .game_info .map_center
441-
440+ # Test if structures_without_construction_SCVs works after killing the scv
442441 # Wait till can afford depot
443442 while not self .can_afford (UnitTypeId .SUPPLYDEPOT ):
444443 await self .client .debug_all_resources ()
0 commit comments