@@ -39,8 +39,6 @@ def __init__(self):
3939 # There will be 20 iterations of the bot doing nothing between tests
4040 self .iteration_wait_time_between_actions = 20
4141
42- self .scv_action_list = ["move" , "patrol" , "attack" , "hold" , "scan_move" ]
43-
4442 # Variables for test_botai_actions11
4543
4644 async def on_start (self ):
@@ -154,7 +152,6 @@ async def test_botai_actions1(self):
154152
155153 await self ._advance_steps (2 )
156154 logger .warning ("Action test 01 successful." )
157- return
158155
159156 # Test BotAI action: move all SCVs to center of map
160157 async def test_botai_actions2 (self ):
@@ -166,12 +163,13 @@ def temp_filter(unit: Unit):
166163 or unit .is_attacking
167164 )
168165
169- while self .units .filter (lambda unit : temp_filter (unit )).amount < len (self .scv_action_list ):
166+ scv_action_list = ["move" , "patrol" , "attack" , "hold" , "scan_move" ]
167+ while self .units .filter (lambda unit : temp_filter (unit )).amount < len (scv_action_list ):
170168 scv : Unit
171169 for index , scv in enumerate (self .workers ):
172- if index > len (self . scv_action_list ):
170+ if index > len (scv_action_list ):
173171 scv .stop ()
174- action = self . scv_action_list [index % len (self . scv_action_list )]
172+ action = scv_action_list [index % len (scv_action_list )]
175173 if action == "move" :
176174 scv .move (center )
177175 elif action == "patrol" :
@@ -185,7 +183,6 @@ def temp_filter(unit: Unit):
185183
186184 await self ._advance_steps (2 )
187185 logger .warning ("Action test 02 successful." )
188- return
189186
190187 # Test BotAI action: move some scvs to the center, some to minerals
191188 async def test_botai_actions3 (self ):
@@ -204,7 +201,6 @@ async def test_botai_actions3(self):
204201 await self ._advance_steps (2 )
205202 await self ._advance_steps (2 )
206203 logger .warning ("Action test 03 successful." )
207- return
208204
209205 # Test BotAI action: move all SCVs to mine minerals near townhall
210206 async def test_botai_actions4 (self ):
@@ -216,7 +212,6 @@ async def test_botai_actions4(self):
216212 await self ._advance_steps (2 )
217213 await self ._advance_steps (2 )
218214 logger .warning ("Action test 04 successful." )
219- return
220215
221216 # Test BotAI action: self.expand_now() which tests for get_next_expansion, select_build_worker, can_place, find_placement, build and can_afford
222217 async def test_botai_actions5 (self ):
@@ -241,7 +236,6 @@ async def test_botai_actions5(self):
241236
242237 await self ._advance_steps (2 )
243238 logger .warning ("Action test 05 successful." )
244- return
245239
246240 # Test if reaper grenade shows up in effects
247241 async def test_botai_actions6 (self ):
@@ -268,7 +262,6 @@ async def test_botai_actions6(self):
268262 # Wait for effectts to time out
269263 await self ._advance_steps (100 )
270264 logger .warning ("Action test 06 successful." )
271- return
272265
273266 # Test ravager effects
274267 async def test_botai_actions7 (self ):
@@ -293,7 +286,6 @@ async def test_botai_actions7(self):
293286 # Wait for effectts to time out
294287 await self ._advance_steps (100 )
295288 logger .warning ("Action test 07 successful." )
296- return
297289
298290 # Test if train function works on hatchery, lair, hive
299291 async def test_botai_actions8 (self ):
@@ -326,39 +318,47 @@ async def test_botai_actions8(self):
326318 await self .client .debug_kill_unit (townhalls | queens | pool )
327319 await self ._advance_steps (2 )
328320 logger .warning ("Action test 08 successful." )
329- return
330321
331322 # Morph an archon from 2 high templars
332323 async def test_botai_actions9 (self ):
333324 center = self .game_info .map_center
334- target_amount = 2
335- HTs = self .units (UnitTypeId .HIGHTEMPLAR )
336- archons = self .units (UnitTypeId .ARCHON )
325+ await self .client .debug_create_unit (
326+ [
327+ [UnitTypeId .HIGHTEMPLAR , 1 , center , 1 ],
328+ [UnitTypeId .DARKTEMPLAR , 1 , center + Point2 ((5 , 0 )), 1 ],
329+ ]
330+ )
331+ await self ._advance_steps (4 )
332+ assert self .already_pending (UnitTypeId .ARCHON ) == 0
337333
338334 while 1 :
339- HTs = self .units (UnitTypeId .HIGHTEMPLAR )
340- if HTs .amount < target_amount :
341- await self .client .debug_create_unit ([[UnitTypeId .HIGHTEMPLAR , target_amount - HTs .amount , center , 1 ]])
335+ for templar in self .units .of_type ({UnitTypeId .HIGHTEMPLAR , UnitTypeId .DARKTEMPLAR }):
336+ templar (AbilityId .MORPH_ARCHON )
337+
338+ await self ._advance_steps (4 )
342339
340+ templars = self .units .of_type ({UnitTypeId .HIGHTEMPLAR , UnitTypeId .DARKTEMPLAR })
341+ archons = self .units (UnitTypeId .ARCHON )
342+ if templars .amount > 0 :
343+ # High templars are on their way to morph ot morph has started
344+ assert self .already_pending (UnitTypeId .ARCHON ) == 1
343345 else :
344- for ht in HTs :
345- ht ( AbilityId . MORPH_ARCHON )
346+ # Morph started
347+ assert self . already_pending ( UnitTypeId . ARCHON ) == archons . not_ready . amount
346348
347- await self ._advance_steps (2 )
348349 # Check if condition is met
349- HTs = self . units ( UnitTypeId . HIGHTEMPLAR )
350- archons = self . units ( UnitTypeId . ARCHON )
351- if archons . amount == 1 :
350+ if archons . ready . amount == 1 :
351+ assert templars . amount == 0
352+ assert self . already_pending ( UnitTypeId . ARCHON ) == 0
352353 break
353354
354355 # Cleanup
355356 if archons :
356357 await self .client .debug_kill_unit (archons )
357- if HTs :
358- await self .client .debug_kill_unit (HTs )
358+ if templars :
359+ await self .client .debug_kill_unit (templars )
359360 await self ._advance_steps (2 )
360361 logger .warning ("Action test 09 successful." )
361- return
362362
363363 # Morph 400 banelings from 400 lings in the same frame
364364 async def test_botai_actions10 (self ):
@@ -401,7 +401,6 @@ async def test_botai_actions10(self):
401401 await self .client .debug_kill_unit (lings | banes | bane_nests | bane_cocoons )
402402 await self ._advance_steps (2 )
403403 logger .warning ("Action test 10 successful." )
404- return
405404
406405 # Trigger anti armor missile of raven against enemy unit and check if buff was received
407406 async def test_botai_actions11 (self ):
0 commit comments