public IEnumerable <Action> BuildPylons() { var commands = new List <Action>(); if (lastFailFrame < MacroData.Frame - 100) { var unitData = SharkyUnitData.BuildingData[UnitTypes.PROTOSS_PYLON]; var orderedBuildings = ActiveUnitData.Commanders.Values.Count(c => c.UnitCalculation.UnitClassifications.Contains(UnitClassification.Worker) && c.UnitCalculation.Unit.Orders.Any(o => o.AbilityId == (uint)unitData.Ability)); foreach (var proxy in MacroData.Proxies) { if (ActiveUnitData.SelfUnits.Count(u => u.Value.Unit.UnitType == (uint)UnitTypes.PROTOSS_PYLON && Vector2.DistanceSquared(u.Value.Position, new Vector2(proxy.Value.Location.X, proxy.Value.Location.Y)) < proxy.Value.MaximumBuildingDistance * proxy.Value.MaximumBuildingDistance) + orderedBuildings < proxy.Value.DesiredPylons) { var command = BuildingBuilder.BuildBuilding(MacroData, UnitTypes.PROTOSS_PYLON, unitData, proxy.Value.Location, true, proxy.Value.MaximumBuildingDistance, MicroTaskData.MicroTasks[proxy.Key].UnitCommanders); if (command != null) { commands.AddRange(command); return(commands); } else { lastFailFrame = MacroData.Frame; } } } } return(commands); }
private List <Action> BuildSupply() { var commands = new List <Action>(); if (SkipSupply) { SkipSupply = false; return(commands); } var begin = System.DateTime.UtcNow; if (MacroData.BuildPylon) { var unitData = SharkyUnitData.BuildingData[UnitTypes.PROTOSS_PYLON]; var command = BuildingBuilder.BuildBuilding(MacroData, UnitTypes.PROTOSS_PYLON, unitData, wallOffType: BuildOptions.WallOffType); if (command != null) { commands.AddRange(command); return(commands); } } if (MacroData.BuildSupplyDepot) { var unitData = SharkyUnitData.BuildingData[UnitTypes.TERRAN_SUPPLYDEPOT]; var command = BuildingBuilder.BuildBuilding(MacroData, UnitTypes.TERRAN_SUPPLYDEPOT, unitData, wallOffType: BuildOptions.WallOffType); if (command != null) { commands.AddRange(command); return(commands); } } if (MacroData.BuildOverlord) { MacroData.BuildUnits[UnitTypes.ZERG_OVERLORD] = true; } var endTime = (System.DateTime.UtcNow - begin).TotalMilliseconds; if (endTime > 1) { SkipSupply = true; } return(commands); }
public List <Action> BuildDefensiveBuildings() { var commands = new List <Action>(); foreach (var unit in MacroData.BuildDefensiveBuildings) { if (unit.Value) { var unitData = SharkyUnitData.BuildingData[unit.Key]; var command = BuildingBuilder.BuildBuilding(MacroData, unit.Key, unitData, TargetingData.ForwardDefensePoint, wallOffType: BuildOptions.WallOffType); if (command != null) { commands.AddRange(command); return(commands); } } } return(commands); }
public List <SC2APIProtocol.Action> BuildPylon(Point2D location, bool ignoreMineralProximity = false, float maxDistance = 50) { var unitData = SharkyUnitData.BuildingData[UnitTypes.PROTOSS_PYLON]; return(BuildingBuilder.BuildBuilding(MacroData, UnitTypes.PROTOSS_PYLON, unitData, location, ignoreMineralProximity, maxDistance)); }