use of org.openbw.bwapi4j.unit.MineralPatch in project Ecgberht by Jabbo16.
the class CheckMineralWalk method execute.
@Override
public State execute() {
try {
if (gameState.chosenScout == null)
return State.FAILURE;
if (gameState.walkingMinerals.isEmpty() || gameState.scoutSLs.isEmpty())
return State.SUCCESS;
if (movingMineral == null) {
MineralPatch target = getCloserMineral();
if (target == null) {
if (gameState.chosenScout.getOrderTarget() != null)
gameState.chosenScout.move(gameState.scoutSLs.iterator().next().getLocation().toPosition());
return State.SUCCESS;
}
movingMineral = target;
gameState.chosenScout.rightClick(target, false);
return State.FAILURE;
} else if (gameState.chosenScout.getDistance(movingMineral) < 32) {
gameState.chosenScout.move(gameState.scoutSLs.iterator().next().getLocation().toPosition());
movingMineral = null;
}
return State.SUCCESS;
} catch (Exception e) {
System.err.println(this.getClass().getSimpleName());
e.printStackTrace();
return State.ERROR;
}
}
Aggregations