public static void buildIfNecessary() { if (shouldBuild()) { ShouldBuildCache.cacheShouldBuildInfo(buildingType, true); Constructing.construct(xvr, buildingType); } ShouldBuildCache.cacheShouldBuildInfo(buildingType, false); }
public static boolean shouldBuild() { if (!UnitCounter.weHaveBuilding(buildingType) && UnitCounter.weHaveBuilding(UnitTypes.Protoss_Cybernetics_Core) && UnitCounter.getNumberOfUnits(ProtossGateway.getBuildingType()) >= 3 && !Constructing.weAreBuilding(buildingType)) { if (BotStrategyManager.isExpandWithCannons()) { if (UnitCounter.getNumberOfBattleUnits() >= 2) { ShouldBuildCache.cacheShouldBuildInfo(buildingType, true); return true; } } else { if (UnitCounter.getNumberOfBattleUnits() >= ProtossGateway.MIN_UNITS_FOR_DIFF_BUILDING || xvr.getTimeSecond() > 800) { ShouldBuildCache.cacheShouldBuildInfo(buildingType, true); return true; } } } return false; }