use of org.openbw.bwapi4j.unit.MobileUnit in project Ecgberht by Jabbo16.
the class SendScout method execute.
@Override
public State execute() {
try {
if (gameState.enemyMainBase == null) {
if (!gameState.scoutSLs.isEmpty()) {
List<Base> aux = new ArrayList<>();
for (Base b : gameState.scoutSLs) {
if (gameState.fortressSpecialBLs.containsKey(b))
continue;
if (gameState.getStrat().name.equals("PlasmaWraithHell")) {
if (((MobileUnit) gameState.chosenScout).move(b.getLocation().toPosition())) {
return State.SUCCESS;
}
} else if (Util.isConnected(b.getLocation(), gameState.chosenScout.getTilePosition())) {
if (((MobileUnit) gameState.chosenScout).move(b.getLocation().toPosition())) {
return State.SUCCESS;
}
} else
aux.add(b);
}
gameState.scoutSLs.removeAll(aux);
}
}
if (gameState.getStrat().name.equals("PlasmaWraithHell")) {
((MobileUnit) gameState.chosenScout).stop(false);
gameState.chosenScout = null;
return State.FAILURE;
}
gameState.workerIdle.add((Worker) gameState.chosenScout);
((MobileUnit) gameState.chosenScout).stop(false);
gameState.chosenScout = null;
return State.FAILURE;
} catch (Exception e) {
System.err.println(this.getClass().getSimpleName());
e.printStackTrace();
return State.ERROR;
}
}
Aggregations