use of bwapi.Unit in project Ecgberht by Jabbo16.
the class ChooseMachineShop method execute.
@Override
public State execute() {
try {
if (!((GameState) this.handler).Fs.isEmpty()) {
for (Unit c : ((GameState) this.handler).Fs) {
if (!c.isTraining() && c.getAddon() == null) {
((GameState) this.handler).chosenBuildingAddon = c;
((GameState) this.handler).chosenAddon = UnitType.Terran_Machine_Shop;
return State.SUCCESS;
}
}
}
((GameState) this.handler).chosenBuildingAddon = null;
((GameState) this.handler).chosenAddon = null;
return State.FAILURE;
} catch (Exception e) {
System.err.println(this.getClass().getSimpleName());
System.err.println(e);
return State.ERROR;
}
}
use of bwapi.Unit in project Ecgberht by Jabbo16.
the class Squad method giveStimOrder.
public void giveStimOrder() {
for (Unit u : members) {
if (u.canUseTech(TechType.Stim_Packs) && !u.isStimmed() && u.isAttacking() && u.getHitPoints() >= 25) {
u.useTech(TechType.Stim_Packs);
if (getGs().getGame().elapsedTime() > getGs().lastFrameStim + 20) {
getGs().playSound("stim.mp3");
getGs().lastFrameStim = getGs().getGame().elapsedTime();
}
}
}
}
use of bwapi.Unit in project Ecgberht by Jabbo16.
the class ChooseMarine method execute.
@Override
public State execute() {
try {
if (!((GameState) this.handler).MBs.isEmpty()) {
for (Unit b : ((GameState) this.handler).MBs) {
if (!b.isTraining()) {
((GameState) this.handler).chosenUnit = UnitType.Terran_Marine;
((GameState) this.handler).chosenBuilding = b;
return State.SUCCESS;
}
}
}
return State.FAILURE;
} catch (Exception e) {
System.err.println(this.getClass().getSimpleName());
System.err.println(e);
return State.ERROR;
}
}
use of bwapi.Unit in project Ecgberht by Jabbo16.
the class ChooseSCV method execute.
@Override
public State execute() {
try {
if (((GameState) this.handler).strat.name == "ProxyBBS") {
boolean notTraining = false;
for (Unit b : ((GameState) this.handler).MBs) {
if (!b.isTraining()) {
notTraining = true;
break;
}
}
if (notTraining) {
return State.FAILURE;
}
}
if (((GameState) this.handler).getPlayer().allUnitCount(UnitType.Terran_SCV) < 50 && ((GameState) this.handler).getPlayer().allUnitCount(UnitType.Terran_SCV) < ((GameState) this.handler).mineralsAssigned.size() * 2 + 3 && !((GameState) this.handler).CCs.isEmpty()) {
for (Unit b : ((GameState) this.handler).CCs.values()) {
if (!b.isTraining() && !b.isConstructing()) {
((GameState) this.handler).chosenUnit = UnitType.Terran_SCV;
((GameState) this.handler).chosenBuilding = b;
return State.SUCCESS;
}
}
}
return State.FAILURE;
} catch (Exception e) {
System.err.println(this.getClass().getSimpleName());
System.err.println(e);
return State.ERROR;
}
}
use of bwapi.Unit in project Ecgberht by Jabbo16.
the class ChooseVulture method execute.
@Override
public State execute() {
try {
if (!((GameState) this.handler).Fs.isEmpty()) {
if (((GameState) this.handler).getPlayer().allUnitCount(UnitType.Terran_Vulture) * 2 <= ((GameState) this.handler).getPlayer().allUnitCount(UnitType.Terran_Siege_Tank_Siege_Mode) + ((GameState) this.handler).getPlayer().allUnitCount(UnitType.Terran_Siege_Tank_Tank_Mode) + 2) {
for (Unit b : ((GameState) this.handler).Fs) {
if (!b.isTraining() && b.canTrain()) {
((GameState) this.handler).chosenUnit = UnitType.Terran_Vulture;
((GameState) this.handler).chosenBuilding = b;
return State.SUCCESS;
}
}
}
}
return State.FAILURE;
} catch (Exception e) {
System.err.println(this.getClass().getSimpleName());
System.err.println(e);
return State.ERROR;
}
}
Aggregations