Search in sources :

Example 11 with ResearchingFacility

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

Example 12 with ResearchingFacility

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

Example 13 with ResearchingFacility

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

Example 14 with ResearchingFacility

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

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