use of org.openbw.bwapi4j.unit.MachineShop in project Ecgberht by Jabbo16.
the class ChooseCharonBoosters method execute.
@Override
public State execute() {
try {
if (gameState.UBs.isEmpty() || !gameState.getStrat().trainUnits.contains(UnitType.Terran_Goliath) || gameState.maxGoliaths == 0) {
return State.FAILURE;
}
for (ResearchingFacility u : gameState.UBs) {
if (!(u instanceof MachineShop))
continue;
if (gameState.getPlayer().getUpgradeLevel(UpgradeType.Charon_Boosters) < 1 && u.canUpgrade(UpgradeType.Charon_Boosters) && !u.isResearching() && !u.isUpgrading()) {
gameState.chosenUnitUpgrader = u;
gameState.chosenUpgrade = UpgradeType.Charon_Boosters;
return State.SUCCESS;
}
}
return State.FAILURE;
} catch (Exception e) {
System.err.println(this.getClass().getSimpleName());
e.printStackTrace();
return State.ERROR;
}
}
use of org.openbw.bwapi4j.unit.MachineShop in project Ecgberht by Jabbo16.
the class ChooseMachineShop method execute.
@Override
public State execute() {
try {
if (gameState.getStrat().name.equals("VultureRush") && (gameState.Fs.size() < 2 || gameState.UBs.stream().anyMatch(u -> u instanceof MachineShop)))
return State.FAILURE;
if (gameState.getStrat().name.equals("TheNitekat") && (gameState.Fs.size() > 1 || gameState.UBs.stream().anyMatch(u -> u instanceof MachineShop)))
return State.FAILURE;
if (!gameState.Fs.isEmpty()) {
for (Factory c : gameState.Fs) {
if (!c.isTraining() && c.getAddon() == null) {
gameState.chosenBuildingAddon = c;
gameState.chosenAddon = UnitType.Terran_Machine_Shop;
return State.SUCCESS;
}
}
}
gameState.chosenBuildingAddon = null;
gameState.chosenAddon = null;
return State.FAILURE;
} catch (Exception e) {
System.err.println(this.getClass().getSimpleName());
e.printStackTrace();
return State.ERROR;
}
}
use of org.openbw.bwapi4j.unit.MachineShop in project Ecgberht by Jabbo16.
the class ChooseSiegeMode method execute.
@Override
public State execute() {
try {
if (gameState.UBs.isEmpty())
return State.FAILURE;
for (ResearchingFacility u : gameState.UBs) {
if (!(u instanceof MachineShop))
continue;
if (!gameState.getPlayer().hasResearched(TechType.Tank_Siege_Mode) && u.canResearch(TechType.Tank_Siege_Mode) && !u.isResearching() && !u.isUpgrading()) {
gameState.chosenUnitUpgrader = u;
gameState.chosenResearch = TechType.Tank_Siege_Mode;
return State.SUCCESS;
}
}
return State.FAILURE;
} catch (Exception e) {
System.err.println(this.getClass().getSimpleName());
e.printStackTrace();
return State.ERROR;
}
}
use of org.openbw.bwapi4j.unit.MachineShop in project Ecgberht by Jabbo16.
the class ChooseVultureMines method execute.
@Override
public State execute() {
try {
if (gameState.UBs.isEmpty())
return State.FAILURE;
for (ResearchingFacility u : gameState.UBs) {
if (!(u instanceof MachineShop))
continue;
if (!gameState.getPlayer().hasResearched(TechType.Spider_Mines) && u.canResearch(TechType.Spider_Mines) && !u.isResearching() && !u.isUpgrading()) {
gameState.chosenUnitUpgrader = u;
gameState.chosenResearch = TechType.Spider_Mines;
return State.SUCCESS;
}
}
return State.FAILURE;
} catch (Exception e) {
System.err.println(this.getClass().getSimpleName());
e.printStackTrace();
return State.ERROR;
}
}
use of org.openbw.bwapi4j.unit.MachineShop in project Ecgberht by Jabbo16.
the class ChooseVultureSpeed method execute.
@Override
public State execute() {
try {
if (gameState.UBs.isEmpty())
return State.FAILURE;
for (ResearchingFacility u : gameState.UBs) {
if (!(u instanceof MachineShop))
continue;
if (u.canUpgrade(UpgradeType.Ion_Thrusters) && !u.isResearching() && !u.isUpgrading() && gameState.getPlayer().getUpgradeLevel(UpgradeType.Ion_Thrusters) < 1) {
gameState.chosenUnitUpgrader = u;
gameState.chosenUpgrade = UpgradeType.Ion_Thrusters;
return State.SUCCESS;
}
}
return State.FAILURE;
} catch (Exception e) {
System.err.println(this.getClass().getSimpleName());
e.printStackTrace();
return State.ERROR;
}
}
Aggregations