Search in sources :

Example 1 with EngineeringBay

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;
    }
}
Also used : EngineeringBay(org.openbw.bwapi4j.unit.EngineeringBay) ResearchingFacility(org.openbw.bwapi4j.unit.ResearchingFacility)

Example 2 with EngineeringBay

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;
    }
}
Also used : EngineeringBay(org.openbw.bwapi4j.unit.EngineeringBay) ResearchingFacility(org.openbw.bwapi4j.unit.ResearchingFacility)

Aggregations

EngineeringBay (org.openbw.bwapi4j.unit.EngineeringBay)2 ResearchingFacility (org.openbw.bwapi4j.unit.ResearchingFacility)2