Dentosal / python-sc2

A StarCraft II bot api client library for Python 3
MIT License
588 stars 182 forks source link

bot_ai already_pending_upgrade(upgrade_id) fails when using certain upgrade_ids #163

Closed ericbroda closed 5 years ago

ericbroda commented 6 years ago

I called bot_ai already_pending_upgrade(UpgradeId.ANIONPULSECRYSTALS) and the following error occurs:

File ".../sc2/bot_ai.py", line 366, in already_pending_upgrade
    creationAbilityID = self._game_data.upgrades[upgrade_type.value].research_ability.id
AttributeError: 'NoneType' object has no attribute 'id'

Below is the game_data for the specific resource:

It would appear that the associated research ability" for this upgrade is missing ("None" as per above)

BurnySc2 commented 6 years ago

I believe this upgrade is not in the game.

If you are trying to research phoenix range upgrade, this should be the correct upgrade:

https://github.com/Blizzard/s2client-api/blob/d9ba0a33d6ce9d233c2a4ee988360c188fbe9dbf/include/sc2api/sc2_typeenums.h#L798 https://github.com/Dentosal/python-sc2/blob/8a8f5c5517f84fc2b5b88f27b1235c64dd75fd5a/sc2/ids/upgrade_id.py#L106