This repository has been archived on 2023-07-11. You can view files and clone it, but cannot push or open issues or pull requests.
BWMirror-Generator/generated/bwta/BaseLocation.java

177 lines
4.1 KiB
Java
Raw Normal View History

2015-02-27 15:29:33 -05:00
package bwta;
import bwta.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
import bwapi.Position;
import bwapi.TilePosition;
import bwapi.Player;
import bwapi.Unit;
2015-03-22 13:44:15 -04:00
import bwapi.Pair;
2015-02-27 15:29:33 -05:00
import bwapi.PositionedObject;
2015-07-12 09:35:38 -04:00
/**
A <a href="BaseLocation.html">BaseLocation</a> a position on the map where it makes sense to place a base (i.e. near minerals).
*/
2015-02-27 15:29:33 -05:00
public class BaseLocation extends PositionedObject
{
2015-07-12 09:35:38 -04:00
/**
Returns the position of the center of the base location.
*/
2015-02-27 15:29:33 -05:00
public Position getPosition() {
return getPosition_native(pointer);
}
2015-07-12 09:35:38 -04:00
/**
Returns the tile position of the base location.
*/
2015-02-27 15:29:33 -05:00
public TilePosition getTilePosition() {
return getTilePosition_native(pointer);
}
2015-07-12 09:35:38 -04:00
/**
Returns the region the base location is in.
*/
2015-02-27 15:29:33 -05:00
public Region getRegion() {
return getRegion_native(pointer);
}
2015-07-12 09:35:38 -04:00
/**
Returns the total mineral resource count of all accessible mineral patches.
*/
2015-02-27 15:29:33 -05:00
public int minerals() {
return minerals_native(pointer);
}
2015-07-12 09:35:38 -04:00
/**
Returns the total gas resource count of all accessible vespene geysers.
*/
2015-02-27 15:29:33 -05:00
public int gas() {
return gas_native(pointer);
}
2015-07-12 09:35:38 -04:00
/**
Returns the set of accessible mineral patches near the base location.
*/
2015-02-27 15:29:33 -05:00
public List<Unit> getMinerals() {
return getMinerals_native(pointer);
}
2015-07-12 09:35:38 -04:00
/**
Returns the set of all mineral patches near the base location, including mined out and invisible ones.
*/
2015-02-27 15:29:33 -05:00
public List<Unit> getStaticMinerals() {
return getStaticMinerals_native(pointer);
}
2015-07-12 09:35:38 -04:00
/**
Returns the set of vespene geysers near the base location. If the set is empty, the base location is mineral only.
*/
2015-02-27 15:29:33 -05:00
public List<Unit> getGeysers() {
return getGeysers_native(pointer);
}
2015-07-12 09:35:38 -04:00
/**
Returns the ground (walking) distance to the given base location. If its impossible to reach the given base location from the current one, this will return a negative value.
*/
2015-02-27 15:29:33 -05:00
public double getGroundDistance(BaseLocation other) {
return getGroundDistance_native(pointer, other);
}
2015-07-12 09:35:38 -04:00
/**
Returns the air (flying) distance to the given base location.
*/
2015-02-27 15:29:33 -05:00
public double getAirDistance(BaseLocation other) {
return getAirDistance_native(pointer, other);
}
2015-07-12 09:35:38 -04:00
/**
Returns true if the base location not in not reachable by ground from any other base location.
*/
2015-02-27 15:29:33 -05:00
public boolean isIsland() {
return isIsland_native(pointer);
}
2015-07-12 09:35:38 -04:00
/**
Returns true if the base location is mineral-only.
*/
2015-02-27 15:29:33 -05:00
public boolean isMineralOnly() {
return isMineralOnly_native(pointer);
}
2015-07-12 09:35:38 -04:00
/**
Returns true if the base location is a start location.
*/
2015-02-27 15:29:33 -05:00
public boolean isStartLocation() {
return isStartLocation_native(pointer);
}
private static Map<Long, BaseLocation> instances = new HashMap<Long, BaseLocation>();
private BaseLocation(long pointer) {
this.pointer = pointer;
}
private static BaseLocation get(long pointer) {
if (pointer == 0 ) {
return null;
}
BaseLocation instance = instances.get(pointer);
if (instance == null ) {
instance = new BaseLocation(pointer);
instances.put(pointer, instance);
}
return instance;
}
private long pointer;
private native Position getPosition_native(long pointer);
private native TilePosition getTilePosition_native(long pointer);
private native Region getRegion_native(long pointer);
private native int minerals_native(long pointer);
private native int gas_native(long pointer);
private native List<Unit> getMinerals_native(long pointer);
private native List<Unit> getStaticMinerals_native(long pointer);
private native List<Unit> getGeysers_native(long pointer);
private native double getGroundDistance_native(long pointer, BaseLocation other);
private native double getAirDistance_native(long pointer, BaseLocation other);
private native boolean isIsland_native(long pointer);
private native boolean isMineralOnly_native(long pointer);
private native boolean isStartLocation_native(long pointer);
}