Search in sources :

Example 1 with ResearchingFacility

use of org.openbw.bwapi4j.unit.ResearchingFacility in project Ecgberht by Jabbo16.

the class ChooseArmorMechUp 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_Plating) && !u.isResearching() && !u.isUpgrading() && gameState.getPlayer().getUpgradeLevel(UpgradeType.Terran_Vehicle_Plating) < 3) {
                gameState.chosenUnitUpgrader = u;
                gameState.chosenUpgrade = UpgradeType.Terran_Vehicle_Plating;
                return State.SUCCESS;
            }
        }
        return State.FAILURE;
    } catch (Exception e) {
        System.err.println(this.getClass().getSimpleName());
        e.printStackTrace();
        return State.ERROR;
    }
}
Also used : ResearchingFacility(org.openbw.bwapi4j.unit.ResearchingFacility) Armory(org.openbw.bwapi4j.unit.Armory)

Example 2 with ResearchingFacility

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

Example 3 with ResearchingFacility

use of org.openbw.bwapi4j.unit.ResearchingFacility in project Ecgberht by Jabbo16.

the class ChooseCharonBoosters method execute.

@Override
public State execute() {
    try {
        if (gameState.UBs.isEmpty() || !gameState.getStrat().trainUnits.contains(UnitType.Terran_Goliath) || gameState.maxGoliaths == 0) {
            return State.FAILURE;
        }
        for (ResearchingFacility u : gameState.UBs) {
            if (!(u instanceof MachineShop))
                continue;
            if (gameState.getPlayer().getUpgradeLevel(UpgradeType.Charon_Boosters) < 1 && u.canUpgrade(UpgradeType.Charon_Boosters) && !u.isResearching() && !u.isUpgrading()) {
                gameState.chosenUnitUpgrader = u;
                gameState.chosenUpgrade = UpgradeType.Charon_Boosters;
                return State.SUCCESS;
            }
        }
        return State.FAILURE;
    } catch (Exception e) {
        System.err.println(this.getClass().getSimpleName());
        e.printStackTrace();
        return State.ERROR;
    }
}
Also used : MachineShop(org.openbw.bwapi4j.unit.MachineShop) ResearchingFacility(org.openbw.bwapi4j.unit.ResearchingFacility)

Example 4 with ResearchingFacility

use of org.openbw.bwapi4j.unit.ResearchingFacility 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 5 with ResearchingFacility

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

Aggregations

ResearchingFacility (org.openbw.bwapi4j.unit.ResearchingFacility)14 Academy (org.openbw.bwapi4j.unit.Academy)4 MachineShop (org.openbw.bwapi4j.unit.MachineShop)4 Armory (org.openbw.bwapi4j.unit.Armory)2 EngineeringBay (org.openbw.bwapi4j.unit.EngineeringBay)2 ScienceFacility (org.openbw.bwapi4j.unit.ScienceFacility)2 Set (java.util.Set)1 Player (org.openbw.bwapi4j.Player)1 Barracks (org.openbw.bwapi4j.unit.Barracks)1 CommandCenter (org.openbw.bwapi4j.unit.CommandCenter)1