use of org.openbw.bwapi4j.unit.ResearchingFacility in project Ecgberht by Jabbo16.
the class ChooseEMP method execute.
@Override
public State execute() {
try {
if (gameState.enemyRace != Race.Protoss)
return State.FAILURE;
boolean found = false;
ScienceFacility chosen = null;
for (ResearchingFacility r : gameState.UBs) {
if (r instanceof ScienceFacility && !r.isResearching()) {
found = true;
chosen = (ScienceFacility) r;
break;
}
}
if (!found)
return State.FAILURE;
if (!gameState.getPlayer().isResearching(TechType.EMP_Shockwave) && !gameState.getPlayer().hasResearched(TechType.EMP_Shockwave)) {
gameState.chosenUnitUpgrader = chosen;
gameState.chosenResearch = TechType.EMP_Shockwave;
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.ResearchingFacility 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;
}
}
use of org.openbw.bwapi4j.unit.ResearchingFacility 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;
}
}
use of org.openbw.bwapi4j.unit.ResearchingFacility in project Ecgberht by Jabbo16.
the class ChooseWeaponMechUp method execute.
@Override
public State execute() {
try {
if (gameState.UBs.isEmpty())
return State.FAILURE;
for (ResearchingFacility u : gameState.UBs) {
if (!(u instanceof Armory))
continue;
if (u.canUpgrade(UpgradeType.Terran_Vehicle_Weapons) && !u.isResearching() && !u.isUpgrading() && gameState.getPlayer().getUpgradeLevel(UpgradeType.Terran_Vehicle_Weapons) < 3) {
gameState.chosenUnitUpgrader = u;
gameState.chosenUpgrade = UpgradeType.Terran_Vehicle_Weapons;
return State.SUCCESS;
}
}
return State.FAILURE;
} catch (Exception e) {
System.err.println(this.getClass().getSimpleName());
e.printStackTrace();
return State.ERROR;
}
}
Aggregations