await self.build(UnitTypeId.BARRACKS, near=cc.position.towards(self.game_info.map_center, 8))
build a custom barracks.
ability_id.py
BARRACKSTECHLABMORPH_BUILDREACTORBARRACKS = 5001
BARRACKSTECHLABMORPH_TECHREACTOR2 = 5002
BARRACKSADDONS=5003
BARRACKSTECHREACTOR=5004
BARRACKSLIFTOFF=5005
2021-03-18 23:14:59.626 | INFO | sc2.protocol:_execute:72 - Client status changed to Status.launched (was None)
2021-03-18 23:14:59.762 | INFO | sc2.protocol:_execute:72 - Client status changed to Status.launched (was None)
2021-03-18 23:14:59.764 | INFO | sc2.controller:create_game:36 - Creating new game
2021-03-18 23:14:59.766 | INFO | sc2.controller:create_game:37 - Map: 沙漠风暴经典版work
2021-03-18 23:14:59.768 | INFO | sc2.controller:create_game:38 - Players: Bot WorkerRushBot(Terran), Bot CyclonePush(Terran)
2021-03-18 23:14:59.773 | INFO | sc2.protocol:_execute:72 - Client status changed to Status.init_game (was Status.launched)
2021-03-18 23:15:16.007 | INFO | sc2.protocol:_execute:72 - Client status changed to Status.in_game (was None)
2021-03-18 23:15:16.010 | INFO | sc2.main:_play_game:328 - Player 2 - Bot CyclonePush(Terran)
2021-03-18 23:15:16.063 | INFO | sc2.protocol:_execute:72 - Client status changed to Status.in_game (was None)
2021-03-18 23:15:16.068 | INFO | sc2.main:_play_game:328 - Player 1 - Bot WorkerRushBot(Terran)
2021-03-18 23:15:17.427 | ERROR | sc2.main:_play_game_ai:297 - AI step threw an error
Traceback (most recent call last):
File "d:/python-sc2/python-sc2\1.py", line 45, in <module>
main()
└ <function main at 0x00000225409363A0>
File "d:/python-sc2/python-sc2\1.py", line 32, in main
sc2.run_game(
│ └ <function run_game at 0x00000225603B9D30>
└ <module 'sc2' from 'd:\\python-sc2\\python-sc2\\sc2\\__init__.py'>
File "d:\python-sc2\python-sc2\sc2\main.py", line 596, in run_game
result = asyncio.get_event_loop().run_until_complete(
│ └ <built-in function get_event_loop>
└ <module 'asyncio' from 'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.8_3.8.1776.0_x64__qbz5n2kfra8p0\\li...
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1776.0_x64__qbz5n2kfra8p0\lib\asyncio\base_events.py", line 603, in run_until_complete
self.run_forever()
│ └ <function ProactorEventLoop.run_forever at 0x000002254116E9D0>
└ <ProactorEventLoop running=True closed=False debug=False>
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1776.0_x64__qbz5n2kfra8p0\lib\asyncio\windows_events.py", line 316, in run_forever
super().run_forever()
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1776.0_x64__qbz5n2kfra8p0\lib\asyncio\base_events.py", line 570, in run_forever
self._run_once()
│ └ <function BaseEventLoop._run_once at 0x00000225410DF040>
└ <ProactorEventLoop running=True closed=False debug=False>
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1776.0_x64__qbz5n2kfra8p0\lib\asyncio\base_events.py", line 1859, in _run_once
handle._run()
│ └ <function Handle._run at 0x000002254104ADC0>
└ <Handle <TaskWakeupMethWrapper object at 0x0000022560683E20>(<Future finished result=None>)>
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1776.0_x64__qbz5n2kfra8p0\lib\asyncio\events.py", line 81, in _run
self._context.run(self._callback, *self._args)
│ │ │ │ │ └ <member '_args' of 'Handle' objects>
│ │ │ │ └ <Handle <TaskWakeupMethWrapper object at 0x0000022560683E20>(<Future finished result=None>)>
│ │ │ └ <member '_callback' of 'Handle' objects>
│ │ └ <Handle <TaskWakeupMethWrapper object at 0x0000022560683E20>(<Future finished result=None>)>
│ └ <member '_context' of 'Handle' objects>
└ <Handle <TaskWakeupMethWrapper object at 0x0000022560683E20>(<Future finished result=None>)>
File "d:\python-sc2\python-sc2\sc2\main.py", line 479, in _host_game
result = await _play_game(
└ <function _play_game at 0x00000225603B9790>
File "d:\python-sc2\python-sc2\sc2\main.py", line 333, in _play_game
result = await _play_game_ai(client, player_id, player.ai, realtime, step_time_limit, game_time_limit)
│ │ │ │ │ │ │ └ None
│ │ │ │ │ │ └ None
│ │ │ │ │ └ False
│ │ │ │ └ <__main__.WorkerRushBot object at 0x0000022540B84370>
│ │ │ └ <sc2.player.Bot object at 0x0000022540B346A0>
│ │ └ 1
│ └ <sc2.client.Client object at 0x0000022560616850>
└ <function _play_game_ai at 0x00000225603B9700>
> File "d:\python-sc2\python-sc2\sc2\main.py", line 247, in _play_game_ai
await ai.on_step(iteration)
│ │ └ 0
│ └ <function WorkerRushBot.on_step at 0x0000022540B94310>
└ <__main__.WorkerRushBot object at 0x0000022540B84370>
File "d:/python-sc2/python-sc2\1.py", line 22, in on_step
if self.can_afford(UnitTypeId.BARRACKS):
│ │ │ └ UnitTypeId.BARRACKS
│ │ └ <enum 'UnitTypeId'>
│ └ <function BotAI.can_afford at 0x000002255FB1B310>
└ <__main__.WorkerRushBot object at 0x0000022540B84370>
File "d:\python-sc2\python-sc2\sc2\bot_ai.py", line 737, in can_afford
cost = self.calculate_cost(item_id)
│ │ └ UnitTypeId.BARRACKS
│ └ <function BotAI.calculate_cost at 0x000002255FB1B280>
└ <__main__.WorkerRushBot object at 0x0000022540B84370>
File "d:\python-sc2\python-sc2\sc2\bot_ai.py", line 699, in calculate_cost
cost = self._game_data.calculate_ability_cost(unit_data.creation_ability)
│ │ │ │ └ <property object at 0x000002255FAF9720>
│ │ │ └ UnitTypeData(name=Barracks)
│ │ └ <functools._lru_cache_wrapper object at 0x000002255FA5F790>
│ └ <sc2.game_data.GameData object at 0x0000022560623FD0>
└ <__main__.WorkerRushBot object at 0x0000022540B84370>
File "d:\python-sc2\python-sc2\sc2\game_data.py", line 37, in calculate_ability_cost
assert isinstance(ability, AbilityData), f"C: {ability}"
│ └ <class 'sc2.game_data.AbilityData'>
└ None
AssertionError: C: None
2021-03-18 23:15:17.656 | ERROR | sc2.main:_play_game_ai:298 - Error: C: None
2021-03-18 23:15:17.658 | ERROR | sc2.main:_play_game_ai:299 - Resigning due to previous error
2021-03-18 23:15:17.661 | INFO | sc2.main:_play_game:335 - Result for player 1 - Bot WorkerRushBot(Terran): Defeat
2021-03-18 23:15:18.747 | INFO | sc2.protocol:_execute:72 - Client status changed to Status.ended (was Status.in_game)
2021-03-18 23:15:18.790 | INFO | sc2.main:_play_game:335 - Result for player 2 - Bot CyclonePush(Terran): Victory
2021-03-18 23:15:19.239 | INFO | sc2.protocol:_execute:72 - Client status changed to Status.launched (was Status.in_game)
2021-03-18 23:15:19.243 | INFO | sc2.protocol:_execute:72 - Client status changed to Status.quit (was Status.launched)
2021-03-18 23:15:19.245 | INFO | sc2.sc2process:_close_connection:231 - Closing connection at 23501...
2021-03-18 23:15:19.249 | INFO | sc2.sc2process:kill_all:37 - kill_switch: Process cleanup for 2 processes
2021-03-18 23:15:19.251 | INFO | sc2.sc2process:_clean:240 - Cleaning up...
2021-03-18 23:15:19.767 | INFO | sc2.sc2process:_clean:273 - Cleanup complete
2021-03-18 23:15:19.769 | INFO | sc2.sc2process:_clean:240 - Cleaning up...
2021-03-18 23:15:20.784 | INFO | sc2.sc2process:_clean:273 - Cleanup complete
2021-03-18 23:15:20.788 | INFO | sc2.protocol:__request:47 - Cannot receive: Game has already ended.
2021-03-18 23:15:20.792 | INFO | sc2.sc2process:_close_connection:231 - Closing connection at None...
2021-03-18 23:15:20.795 | INFO | sc2.sc2process:kill_all:37 - kill_switch: Process cleanup for 2 processes
2021-03-18 23:15:20.797 | INFO | sc2.sc2process:_clean:240 - Cleaning up...
2021-03-18 23:15:20.799 | INFO | sc2.sc2process:_clean:273 - Cleanup complete
2021-03-18 23:15:20.801 | INFO | sc2.sc2process:_clean:240 - Cleaning up...
2021-03-18 23:15:20.804 | INFO | sc2.sc2process:_clean:273 - Cleanup complete
Traceback (most recent call last):
File "d:/python-sc2/python-sc2/1.py", line 45, in <module>
main()
File "d:/python-sc2/python-sc2/1.py", line 32, in main
sc2.run_game(
File "d:\python-sc2\python-sc2\sc2\main.py", line 596, in run_game
result = asyncio.get_event_loop().run_until_complete(
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1776.0_x64__qbz5n2kfra8p0\lib\asyncio\base_events.py", line 616, in run_until_complete
return future.result()
File "d:\python-sc2\python-sc2\sc2\main.py", line 557, in _join_game
await client.quit()
File "d:\python-sc2\python-sc2\sc2\protocol.py", line 87, in quit
await self._execute(quit=sc_pb.RequestQuit())
File "d:\python-sc2\python-sc2\sc2\protocol.py", line 68, in _execute
response = await self.__request(sc_pb.Request(**kwargs))
File "d:\python-sc2\python-sc2\sc2\protocol.py", line 36, in __request
await self._ws.send_bytes(request.SerializeToString())
File "C:\Users\wwwfe\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\aiohttp\client_ws.py", line 155, in send_bytes
await self._writer.send(data, binary=True, compress=compress)
File "C:\Users\wwwfe\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\aiohttp\http_websocket.py", line 685, in send
await self._send_frame(message, WSMsgType.BINARY, compress)
File "C:\Users\wwwfe\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\aiohttp\http_websocket.py", line 598, in _send_frame
raise ConnectionResetError("Cannot write to closing transport")
ConnectionResetError: Cannot write to closing transport```