Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/Dentosal/python-sc2 into…
Browse files Browse the repository at this point in the history
… develop
  • Loading branch information
BurnySc2 committed Nov 30, 2018
2 parents 303516c + e8134df commit 5e11517
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion sc2/bot_ai.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def expansion_locations(self) -> Dict[Point2, Units]:
]
# order by distance to resources, 7.162 magic distance number (avg resource distance of current ladder maps)
possible_points.sort(
key=lambda p: statistics.mean([abs(p.distance_to(resource) - 7.162) for resource in resources])
key=lambda p: statistics.mean([abs(p.distance_to(resource) - 7.162) for resource in resources if resource in self.state.mineral_field])
)
# choose best fitting point
centers[possible_points[0]] = resources
Expand Down
2 changes: 1 addition & 1 deletion sc2/unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ def target_in_range(self, target: "Unit", bonus_distance: Union[int, float]=0) -
""" Includes the target's radius when calculating distance to target """
if self.can_attack_ground and not target.is_flying:
unit_attack_range = self.ground_range
elif self.can_attack_air and target.is_flying:
elif self.can_attack_air and (target.is_flying or target.type_id == UnitTypeId.COLOSSUS):
unit_attack_range = self.air_range
else:
unit_attack_range = -1
Expand Down

0 comments on commit 5e11517

Please sign in to comment.