Skip to content

Commit 2827d68

Browse files
committed
Fix a bug that prevents making overlord on negative supply
1 parent 93f8ea2 commit 2827d68

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

sc2/bot_ai.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,8 @@ def is_near_to_expansion(t):
247247

248248
def can_feed(self, unit_type: UnitTypeId) -> bool:
249249
""" Checks if you have enough free supply to build the unit """
250-
return self.supply_left >= self._game_data.units[unit_type.value]._proto.food_required
250+
required = self._game_data.units[unit_type.value]._proto.food_required
251+
return required == 0 or self.supply_left >= required
251252

252253
def can_afford(self, item_id: Union[UnitTypeId, UpgradeId, AbilityId], check_supply_cost: bool=True) -> "CanAffordWrapper":
253254
"""Tests if the player has enough resources to build a unit or cast an ability."""

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
setup(
1111
name = "sc2",
1212
packages = find_packages(),
13-
version = "0.10.3",
13+
version = "0.10.4",
1414
description = "A StarCraft II API Client for Python 3",
1515
license="MIT",
1616
author = "Hannes Karppila",

0 commit comments

Comments
 (0)