Example #1
0
        public void HandlesBuildingTypeWithProtossBuilding(ProtossBuildingType building)
        {
            var buildingOrUnitType = new BuildingOrUnitType(building);
            var buildingType       = new BuildingType(building);

            Assert.IsTrue(buildingOrUnitType == buildingType);
        }
Example #2
0
        public void HandlesBuildingOrUnitTypeWithZergUnit(ZergUnitType unit)
        {
            var buildingOrUnitType      = new BuildingOrUnitType(unit);
            var otherBuildingOrUnitType = new BuildingOrUnitType(unit);

            Assert.IsTrue(buildingOrUnitType == otherBuildingOrUnitType);
        }
Example #3
0
        public void HandlesBuildingOrUnitTypeWithZergBuilding(ZergBuildingType building)
        {
            var buildingOrUnitType      = new BuildingOrUnitType(building);
            var otherBuildingOrUnitType = new BuildingOrUnitType(building);

            Assert.IsTrue(buildingOrUnitType == otherBuildingOrUnitType);
        }
Example #4
0
        public void HandlesUnitTypeWithProtossUnit(ProtossUnitType unit)
        {
            var buildingOrUnitType = new BuildingOrUnitType(unit);
            var unitType           = new UnitType(unit);

            Assert.IsTrue(buildingOrUnitType == unitType);
        }
        private BuildingOrUnitType UnitOrPrerequisite(BuildingOrUnitType buildingOrUnit, GameState gameState)
        {
            var cost = gameState.Translator.GetCost(buildingOrUnit);

            if (!cost.HasPrerequisite(gameState))
            {
                return(UnitOrPrerequisite(cost.Prerequisite, gameState));
            }

            return(buildingOrUnit);
        }
Example #6
0
        public static ProxyStarcraft.Unit GetBuilder(BuildingOrUnitType buildingOrUnit, GameState gameState, SynchronousApiClient client)
        {
            // TODO: Exclude units/structures already building things
            var buildAction = gameState.Translator.GetBuildAction(buildingOrUnit);

            foreach (var unit in gameState.Units)
            {
                var abilities = client.GetAbilities(unit.Tag);

                if (abilities.Contains(buildAction))
                {
                    return(unit);
                }
            }

            return(null);
        }
        public Command Produce(BuildingOrUnitType buildingOrUnit, GameState gameState)
        {
            var cost    = gameState.Translator.GetCost(buildingOrUnit);
            var builder = cost.GetBuilder(gameState);

            gameState.Observation.PlayerCommon.Minerals -= cost.Minerals;
            gameState.Observation.PlayerCommon.Vespene  -= cost.Vespene;
            gameState.Observation.PlayerCommon.FoodUsed += (uint)Math.Ceiling(cost.Supply);

            if (buildingOrUnit.IsBuildingType)
            {
                var buildingType = (BuildingType)buildingOrUnit;
                var location     = this.GetPlacement(buildingType, gameState);
                return(builder.Build(buildingType, location));
            }
            else
            {
                return(builder.Train((UnitType)buildingOrUnit));
            }
        }
Example #8
0
        public void HandlesZergBuildingType(ZergBuildingType building)
        {
            var buildingType = new BuildingOrUnitType(building);

            Assert.IsTrue(buildingType == building);
        }
Example #9
0
 public void Add(BuildingOrUnitType target)
 {
     buildOrder.Push(target);
 }
Example #10
0
 public void Push(BuildingOrUnitType target)
 {
     buildOrder.Enqueue(target);
 }
Example #11
0
        public void HandlesZergUnitType(ZergUnitType unit)
        {
            var buildingOrUnitType = new BuildingOrUnitType(unit);

            Assert.IsTrue(buildingOrUnitType == unit);
        }
Example #12
0
        public void HandlesTerranBuildingType(TerranBuildingType building)
        {
            var buildingOrUnitType = new BuildingOrUnitType(building);

            Assert.IsTrue(buildingOrUnitType == building);
        }