use of org.bk.ass.path.Result in project Ecgberht by Jabbo16.
the class WorkerScoutAgent method canProxyInThisMap.
private void canProxyInThisMap() {
Area enemyArea = this.enemyBase.getArea();
Set<TilePosition> tilesArea = getGs().map.getTilesArea(enemyArea);
if (tilesArea == null)
return;
Result path = getGs().silentCartographer.getWalkablePath(enemyBase.getLocation().toWalkPosition(), getGs().enemyNaturalBase.getLocation().toWalkPosition());
for (TilePosition t : tilesArea) {
if (!getGs().map.tileBuildable(t, UnitType.Terran_Factory))
continue;
if (t.getDistance(Util.getUnitCenterPosition(enemyBase.getLocation().toPosition(), UnitType.Zerg_Hatchery).toTilePosition()) <= 13)
continue;
if (enemyBase.getGeysers().stream().anyMatch(u -> t.getDistance(u.getCenter().toTilePosition()) <= 9))
continue;
if (path.path.stream().anyMatch(u -> t.getDistance(new WalkPosition(u.x, u.y).toTilePosition()) <= 10))
continue;
validTiles.add(t);
}
if (validTiles.isEmpty())
return;
double bestDist = 0.0;
for (TilePosition p : validTiles) {
double dist = p.getDistance(enemyBase.getLocation());
if (dist > bestDist) {
bestDist = dist;
proxyTile = p;
}
}
if (proxyTile != null)
ableToProxy = true;
}
Aggregations