use of org.openbw.bwapi4j.unit.EngineeringBay in project Ecgberht by Jabbo16.
the class ChooseWeaponInfUp method execute.
@Override
public State execute() {
try {
if (gameState.UBs.isEmpty())
return State.FAILURE;
for (ResearchingFacility u : gameState.UBs) {
if (!(u instanceof EngineeringBay))
continue;
if (u.canUpgrade(UpgradeType.Terran_Infantry_Weapons) && !u.isResearching() && !u.isUpgrading() && gameState.getPlayer().getUpgradeLevel(UpgradeType.Terran_Infantry_Weapons) < 3) {
gameState.chosenUnitUpgrader = u;
gameState.chosenUpgrade = UpgradeType.Terran_Infantry_Weapons;
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.EngineeringBay in project Ecgberht by Jabbo16.
the class ChooseArmorInfUp method execute.
@Override
public State execute() {
try {
if (gameState.UBs.isEmpty())
return State.FAILURE;
for (ResearchingFacility u : gameState.UBs) {
if (!(u instanceof EngineeringBay))
continue;
if (u.canUpgrade(UpgradeType.Terran_Infantry_Armor) && !u.isResearching() && !u.isUpgrading() && gameState.getPlayer().getUpgradeLevel(UpgradeType.Terran_Infantry_Armor) < 3) {
gameState.chosenUnitUpgrader = u;
gameState.chosenUpgrade = UpgradeType.Terran_Infantry_Armor;
return State.SUCCESS;
}
}
return State.FAILURE;
} catch (Exception e) {
System.err.println(this.getClass().getSimpleName());
e.printStackTrace();
return State.ERROR;
}
}
Aggregations