Search in sources :

Example 1 with Result

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;
}
Also used : Area(bwem.Area) TilePosition(org.openbw.bwapi4j.TilePosition) WalkPosition(org.openbw.bwapi4j.WalkPosition) Result(org.bk.ass.path.Result)

Aggregations

Area (bwem.Area)1 Result (org.bk.ass.path.Result)1 TilePosition (org.openbw.bwapi4j.TilePosition)1 WalkPosition (org.openbw.bwapi4j.WalkPosition)1