Skip to content

Commit

Permalink
Merge pull request #203 from AresSC2/fix/max-pending-gas_buildings
Browse files Browse the repository at this point in the history
fix: gas building controller max pending works for Terran
  • Loading branch information
raspersc2 authored Jan 1, 2025
2 parents dafc205 + 09aa111 commit 5386c2e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
8 changes: 4 additions & 4 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions src/ares/behaviors/macro/gas_building_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from typing import TYPE_CHECKING, Optional

from cython_extensions import cy_distance_to_squared, cy_sorted_by_distance_to
from sc2.data import Race
from sc2.position import Point2
from sc2.units import Units

Expand Down Expand Up @@ -41,9 +42,13 @@ class GasBuildingController(MacroBehavior):
closest_to: Optional[Point2] = None

def execute(self, ai: "AresBot", config: dict, mediator: ManagerMediator) -> bool:
num_gas: int = (
len(ai.gas_buildings) + mediator.get_building_counter[ai.gas_type]
)
num_gas: int
if ai.race == Race.Terran:
num_gas = ai.not_started_but_in_building_tracker(ai.gas_type) + len(
ai.gas_buildings
)
else:
num_gas = len(ai.gas_buildings) + mediator.get_building_counter[ai.gas_type]
# we have enough gas / building gas then don't attempt behavior
if (
num_gas >= self.to_count
Expand Down

0 comments on commit 5386c2e

Please sign in to comment.