Search in sources :

Example 6 with Region

use of bwta.Region in project BWJSAL by RobinsonMann.

the class EnemyBaseTracker method possibleEnemyStartingLocation.

/**
 * Will return a base location belonging to the enemy if the given building
 * is inside of a region that also contains a starting location that could contain
 * an enemy base.
 */
private Optional<BaseLocation> possibleEnemyStartingLocation(final Unit building) {
    // Find the region that this building belongs to.
    final Region unitRegion = this.bwta.getRegion(building.getTilePosition());
    final List<BaseLocation> baseLocationsInsideRegion = unitRegion.getBaseLocations();
    // starting locations that could contain the enemy. If so, return.
    for (final BaseLocation baseLocationInsideRegion : baseLocationsInsideRegion) {
        if (this.startLocationsThatCouldContainEnemy.contains(baseLocationInsideRegion)) {
            return Optional.of(baseLocationInsideRegion);
        }
    }
    return Optional.empty();
}
Also used : Region(bwta.Region) BaseLocation(bwta.BaseLocation)

Aggregations

Region (bwta.Region)6 Position (bwapi.Position)1 Unit (bwapi.Unit)1 BWTA (bwta.BWTA)1 BaseLocation (bwta.BaseLocation)1 Chokepoint (bwta.Chokepoint)1 Vulture (ecgberht.Agents.Vulture)1 EnemyBuilding (ecgberht.EnemyBuilding)1 GameState (ecgberht.GameState)1 Squad (ecgberht.Squad)1 FileNotFoundException (java.io.FileNotFoundException)1 ArrayList (java.util.ArrayList)1 JFAPUnit (jfap.JFAPUnit)1