use of org.openbw.bwapi4j.unit.Academy in project Ecgberht by Jabbo16.
the class ChooseMarineRange method execute.
@Override
public State execute() {
try {
if (gameState.UBs.isEmpty())
return State.FAILURE;
String strat = gameState.getStrat().name;
if (strat.equals("BioMech") || strat.equals("BioMechGreedyFE") || strat.equals("BioMechFE")) {
Player self = gameState.getPlayer();
if (!self.isResearching(TechType.Tank_Siege_Mode) && !self.hasResearched(TechType.Tank_Siege_Mode)) {
return State.FAILURE;
}
}
for (ResearchingFacility u : gameState.UBs) {
if (!(u instanceof Academy))
continue;
if (gameState.getPlayer().hasResearched(TechType.Stim_Packs) && gameState.getPlayer().getUpgradeLevel(UpgradeType.U_238_Shells) < 1 && u.canUpgrade(UpgradeType.U_238_Shells) && !u.isResearching() && !u.isUpgrading()) {
gameState.chosenUnitUpgrader = u;
gameState.chosenUpgrade = UpgradeType.U_238_Shells;
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.Academy in project Ecgberht by Jabbo16.
the class ChooseComsatStation method execute.
@Override
public State execute() {
try {
if (!gameState.CCs.isEmpty()) {
for (CommandCenter c : gameState.CCs.values()) {
if (!c.isTraining() && c.getAddon() == null) {
for (ResearchingFacility u : gameState.UBs) {
if (u instanceof Academy) {
gameState.chosenBuildingAddon = c;
gameState.chosenAddon = UnitType.Terran_Comsat_Station;
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.Academy in project Ecgberht by Jabbo16.
the class ChooseMedic method execute.
@Override
public State execute() {
try {
if (gameState.UBs.isEmpty())
return State.FAILURE;
else {
for (ResearchingFacility u : gameState.UBs) {
if (u instanceof Academy) {
int marine_count = 0;
if (!gameState.DBs.isEmpty()) {
marine_count = gameState.DBs.values().stream().mapToInt(Set::size).sum();
}
if (!gameState.MBs.isEmpty() && Util.countUnitTypeSelf(UnitType.Terran_Medic) * 4 < Util.countUnitTypeSelf(UnitType.Terran_Marine) - marine_count) {
for (Barracks b : gameState.MBs) {
if (!b.isTraining()) {
gameState.chosenUnit = UnitType.Terran_Medic;
gameState.chosenTrainingFacility = b;
return State.SUCCESS;
}
}
}
break;
}
}
}
return State.FAILURE;
} catch (Exception e) {
System.err.println(this.getClass().getSimpleName());
e.printStackTrace();
return State.ERROR;
}
}
use of org.openbw.bwapi4j.unit.Academy in project Ecgberht by Jabbo16.
the class ChooseStimUpgrade method execute.
@Override
public State execute() {
try {
if (gameState.UBs.isEmpty())
return State.FAILURE;
for (ResearchingFacility u : gameState.UBs) {
if (!(u instanceof Academy))
continue;
if (!gameState.getPlayer().hasResearched(TechType.Stim_Packs) && u.canResearch(TechType.Stim_Packs) && !u.isResearching() && !u.isUpgrading()) {
gameState.chosenUnitUpgrader = u;
gameState.chosenResearch = TechType.Stim_Packs;
return State.SUCCESS;
}
}
return State.FAILURE;
} catch (Exception e) {
System.err.println(this.getClass().getSimpleName());
e.printStackTrace();
return State.ERROR;
}
}
Aggregations