private BuildList MainBuild() { BuildList result = new BuildList(); result.Building(UnitTypes.PYLON); result.Building(UnitTypes.GATEWAY); if (Bot.Main.EnemyRace != Race.Terran) { result.If(() => { return(!EarlyPool.Get().Detected || Expanded.Get().Detected || Completed(UnitTypes.ZEALOT) >= 2); }); } result.Building(UnitTypes.ASSIMILATOR); result.Building(UnitTypes.PYLON, Natural, NaturalDefensePos); result.Building(UnitTypes.CYBERNETICS_CORE); result.Building(UnitTypes.ASSIMILATOR, 2); result.Building(UnitTypes.GATEWAY); result.Building(UnitTypes.PYLON); result.Building(UnitTypes.PYLON, Natural); result.Building(UnitTypes.ROBOTICS_FACILITY); result.Building(UnitTypes.PYLON, 2); result.Building(UnitTypes.ROBOTICS_BAY, () => { return(!UseImmortals); }); result.Building(UnitTypes.PYLON, Natural); result.Building(UnitTypes.ROBOTICS_FACILITY); result.Building(UnitTypes.ASSIMILATOR); result.Building(UnitTypes.GATEWAY, 2); result.Building(UnitTypes.PYLON, Natural); result.Building(UnitTypes.TWILIGHT_COUNSEL); result.Building(UnitTypes.PYLON, Natural); result.If(() => { return(Count(UnitTypes.COLOSUS) >= 6); }); result.Building(UnitTypes.GATEWAY, 2); return(result); }
private BuildList EmergencyGateways() { BuildList result = new BuildList(); result.If(() => { return(EarlyPool.Get().Detected&& !Expanded.Get().Detected); }); result.Building(UnitTypes.PYLON); result.Building(UnitTypes.GATEWAY, 2); return(result); }
public override Build OverrideBuild() { if (!StalkerRushDetected) { if (EnemyCount(UnitTypes.GATEWAY) >= 3 && Bot.Main.Frame <= 22.4 * 60 * 2.5 && !Expanded.Get().Detected && TotalEnemyCount(UnitTypes.ROBOTICS_FACILITY) == 0) { StalkerRushDetected = true; StalkerDefenseBuild.OnStart(Bot.Main); CancelBuilding(UnitTypes.NEXUS); } } if (!CannonRush && Bot.Main.Frame <= 22.4 * 60 * 2 && EnemyCount(UnitTypes.FORGE) + EnemyCount(UnitTypes.PHOTON_CANNON) > 0) { CannonRush = true; CannonDefenseBuild.OnStart(Bot.Main); } if (!CannonRush) { foreach (Unit enemy in Bot.Main.Enemies()) { if (enemy.UnitType != UnitTypes.PYLON) { continue; } if (SC2Util.DistanceSq(enemy.Pos, Main.BaseLocation.Pos) <= 30 * 30) { CannonRush = true; CannonDefenseBuild.OnStart(Bot.Main); break; } if (SC2Util.DistanceSq(enemy.Pos, Natural.BaseLocation.Pos) <= 25 * 25) { CannonRush = true; CannonDefenseBuild.OnStart(Bot.Main); break; } } } if (CannonRush) { return(CannonDefenseBuild); } if (StalkerRushDetected) { return(StalkerDefenseBuild); } return(null); }
private BuildList Nexii() { BuildList result = new BuildList(); result.If(() => { return(Bot.Main.EnemyRace != Race.Terran || Count(UnitTypes.GATEWAY) >= 2); }); if (Bot.Main.EnemyRace == Race.Zerg) { result.If(() => { return(!EarlyPool.Get().Detected || Expanded.Get().Detected || Completed(UnitTypes.ZEALOT) >= 2); }); } result.Building(UnitTypes.NEXUS, 2); result.If(() => { return(Attacking); }); result.Building(UnitTypes.NEXUS); return(result); }
private BuildList MainBuild() { BuildList result = new BuildList(); result.Building(UnitTypes.NEXUS); result.Building(UnitTypes.PYLON, Main, WallIn.Wall[1].Pos, true); result.Building(UnitTypes.GATEWAY, Main, WallIn.Wall[0].Pos, true, () => Completed(UnitTypes.PYLON) > 0); result.Building(UnitTypes.ASSIMILATOR); result.Building(UnitTypes.CYBERNETICS_CORE); result.Building(UnitTypes.ASSIMILATOR); result.Building(UnitTypes.ROBOTICS_FACILITY); result.Building(UnitTypes.NEXUS); result.Upgrade(UpgradeType.WarpGate); result.Building(UnitTypes.GATEWAY, Main, () => Count(UnitTypes.IMMORTAL) > 0); result.Building(UnitTypes.PYLON, Natural, () => Natural.Owner == Bot.Main.PlayerId && !Natural.UnderAttack); result.Building(UnitTypes.SHIELD_BATTERY, Natural, 2, () => Bot.Main.Frame >= 3 * 60 * 22.4 && !Expanded.Get().Detected&& Completed(Natural, UnitTypes.PYLON) > 0 && !Natural.UnderAttack && !CannonDefenseDetected); result.If(() => Count(UnitTypes.STALKER) >= 5); result.Building(UnitTypes.GATEWAY, Main, () => !Expanded.Get().Detected); result.If(() => Count(UnitTypes.STALKER) >= 10); result.Building(UnitTypes.NEXUS); result.Building(UnitTypes.ASSIMILATOR, 2); result.Building(UnitTypes.STARGATE, 2, () => TempestDetected); result.Building(UnitTypes.ROBOTICS_FACILITY, () => !Expanded.Get().Detected&& !TempestDetected); result.If(() => Count(UnitTypes.IMMORTAL) >= 2); result.Building(UnitTypes.TWILIGHT_COUNSEL); result.Upgrade(UpgradeType.Blink); result.Building(UnitTypes.PYLON); result.Building(UnitTypes.ROBOTICS_FACILITY, () => Expanded.Get().Detected&& !TempestDetected); result.Building(UnitTypes.FORGE); result.Building(UnitTypes.ASSIMILATOR, 2); result.Upgrade(UpgradeType.ProtossGroundWeapons); result.Building(UnitTypes.FORGE); result.Upgrade(UpgradeType.ProtossGroundArmor); result.If(() => Count(UnitTypes.IMMORTAL) >= 3 && Count(UnitTypes.STALKER) >= 10); result.Building(UnitTypes.NEXUS); result.Building(UnitTypes.ASSIMILATOR, 2); result.Building(UnitTypes.ROBOTICS_BAY); result.Building(UnitTypes.ASSIMILATOR, 4, () => Minerals() >= 700 && Gas() < 200); result.Building(UnitTypes.ASSIMILATOR, 2); result.Building(UnitTypes.ASSIMILATOR, 2); result.If(() => Count(UnitTypes.STALKER) >= 20); result.Building(UnitTypes.ASSIMILATOR, 2); result.Building(UnitTypes.NEXUS); result.Building(UnitTypes.ASSIMILATOR, 2); result.Building(UnitTypes.NEXUS); return(result); }
private BuildList EmergencyGateways() { BuildList result = new BuildList(); result.If(() => { return(EarlyPool.Get().Detected&& !Expanded.Get().Detected); }); result.Building(UnitTypes.PYLON, Main, WallIn.Wall[1].Pos, true); result.Building(UnitTypes.GATEWAY, Main, WallIn.Wall[0].Pos, true); result.Building(UnitTypes.GATEWAY, Main); result.If(() => Count(UnitTypes.ZEALOT) >= 4); result.Building(UnitTypes.CYBERNETICS_CORE); result.If(() => Count(UnitTypes.ZEALOT) >= 6); result.Building(UnitTypes.ASSIMILATOR); result.If(() => Count(UnitTypes.ZEALOT) >= 8); result.Building(UnitTypes.GATEWAY, Main); return(result); }
private BuildList MainBuild() { BuildList result = new BuildList(); result.Building(UnitTypes.NEXUS); result.Building(UnitTypes.PYLON, Main, WallIn.Wall[1].Pos, true); result.Building(UnitTypes.GATEWAY, Main, WallIn.Wall[0].Pos, true, () => Completed(UnitTypes.PYLON) > 0); if (Bot.Main.EnemyRace != Race.Terran) { result.If(() => { return(!EarlyPool.Get().Detected || Expanded.Get().Detected || Completed(UnitTypes.ZEALOT) + Completed(UnitTypes.ADEPT) >= 15); }); } result.Building(UnitTypes.NEXUS); result.Building(UnitTypes.ASSIMILATOR); result.Building(UnitTypes.CYBERNETICS_CORE); result.Building(UnitTypes.GATEWAY, Main); result.Building(UnitTypes.PYLON, Natural); result.Building(UnitTypes.ROBOTICS_FACILITY); result.Building(UnitTypes.NEXUS); result.Building(UnitTypes.PYLON); result.Building(UnitTypes.ROBOTICS_FACILITY, () => RobosActive() || Minerals() >= 600 || FoodUsed() >= 190); result.Building(UnitTypes.TWILIGHT_COUNSEL); result.Building(UnitTypes.FORGE); result.Upgrade(UpgradeType.ProtossGroundWeapons); result.Building(UnitTypes.FORGE); result.Upgrade(UpgradeType.ProtossGroundArmor); result.Building(UnitTypes.ASSIMILATOR, 2); result.Building(UnitTypes.PYLON); result.Building(UnitTypes.ROBOTICS_BAY, () => RobosActive() || Count(UnitTypes.IMMORTAL) >= 3); result.If(() => Count(UnitTypes.IMMORTAL) >= 3 && Count(UnitTypes.ZEALOT) >= 10); result.Building(UnitTypes.NEXUS); result.Building(UnitTypes.ASSIMILATOR, 6); result.If(() => Count(UnitTypes.IMMORTAL) >= 10 && Count(UnitTypes.ZEALOT) >= 15); result.Building(UnitTypes.NEXUS); result.Building(UnitTypes.ASSIMILATOR, 2); result.Building(UnitTypes.NEXUS); result.Building(UnitTypes.ASSIMILATOR, 2); return(result); }
private BuildList MainBuild() { BuildList result = new BuildList(); result.Building(UnitTypes.NEXUS); result.Building(UnitTypes.PYLON, Main, WallIn.Wall[1].Pos, true); result.Building(UnitTypes.GATEWAY, Main, WallIn.Wall[0].Pos, true, () => Completed(UnitTypes.PYLON) > 0); if (Bot.Main.EnemyRace != Race.Terran) { result.If(() => { return(!EarlyPool.Get().Detected || Expanded.Get().Detected || Completed(UnitTypes.STALKER) + Completed(UnitTypes.ADEPT) >= 5); }); } result.Building(UnitTypes.NEXUS); result.Building(UnitTypes.ASSIMILATOR); result.Building(UnitTypes.CYBERNETICS_CORE); result.Building(UnitTypes.GATEWAY, Main); result.Upgrade(UpgradeType.WarpGate); result.Building(UnitTypes.PYLON, Natural, () => FourRaxSuspected); result.Building(UnitTypes.GATEWAY, Natural, () => FourRaxSuspected && Completed(Natural, UnitTypes.PYLON) > 0); result.Building(UnitTypes.SHIELD_BATTERY, Natural, 2, () => FourRaxSuspected && Completed(Natural, UnitTypes.PYLON) > 0); result.Building(UnitTypes.FORGE, () => FourRaxSuspected && Count(UnitTypes.GATEWAY) >= 3); result.Building(UnitTypes.PHOTON_CANNON, Natural, 4, () => FourRaxSuspected); result.Building(UnitTypes.ASSIMILATOR, () => FourRaxSuspected && Minerals() >= 600); result.Building(UnitTypes.ASSIMILATOR, () => FourRaxSuspected && Minerals() >= 800); //result.If(() => !FourRaxSuspected || Count(UnitTypes.STALKER) >= 10); result.Building(UnitTypes.ROBOTICS_FACILITY); result.Building(UnitTypes.PYLON, Natural, () => !FourRaxSuspected); result.Building(UnitTypes.ASSIMILATOR, () => !FourRaxSuspected || Count(UnitTypes.PHOTON_CANNON) >= 2); result.Building(UnitTypes.NEXUS); result.Building(UnitTypes.PYLON); result.Building(UnitTypes.ASSIMILATOR, 2, () => Bot.Main.EnemyStrategyAnalyzer.TotalCount(UnitTypes.BANSHEE) >= 3); result.Building(UnitTypes.TWILIGHT_COUNSEL); result.Building(UnitTypes.FORGE); result.Upgrade(UpgradeType.ProtossGroundWeapons); result.Building(UnitTypes.FORGE, () => !FourRaxSuspected); result.Upgrade(UpgradeType.ProtossGroundArmor); result.Building(UnitTypes.PYLON); result.Building(UnitTypes.TEMPLAR_ARCHIVE); result.Building(UnitTypes.NEXUS); result.Building(UnitTypes.ROBOTICS_FACILITY, () => !BattlecruisersDetected && Bot.Main.EnemyStrategyAnalyzer.TotalCount(UnitTypes.BANSHEE) == 0); result.Building(UnitTypes.ASSIMILATOR, 2); result.Building(UnitTypes.ASSIMILATOR, 4, () => Minerals() >= 500 && Gas() < 200); //result.Building(UnitTypes.STARGATE); //result.Building(UnitTypes.FLEET_BEACON); //result.If(() => Count(UnitTypes.IMMORTAL) >= 3 && Count(UnitTypes.STALKER) >= 10); //result.Building(UnitTypes.ROBOTICS_BAY, () => !BattlecruisersDetected && Tyr.Bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.BANSHEE) == 0); result.Building(UnitTypes.STARGATE, () => BattlecruisersDetected || Bot.Main.EnemyStrategyAnalyzer.TotalCount(UnitTypes.BANSHEE) > 0); result.Building(UnitTypes.FLEET_BEACON, () => Completed(UnitTypes.STARGATE) > 0); //result.If(() => Count(UnitTypes.STALKER) >= 20); result.Building(UnitTypes.ASSIMILATOR, 2); result.Building(UnitTypes.GATEWAY, Main, 2, () => Minerals() >= 500); result.Building(UnitTypes.GATEWAY, Main, 2, () => Minerals() >= 500); result.Building(UnitTypes.GATEWAY, Main, 2, () => Minerals() >= 500); result.If(() => Count(UnitTypes.ZEALOT) >= 20 && Count(UnitTypes.IMMORTAL) + Count(UnitTypes.ARCHON) >= 10); result.Building(UnitTypes.NEXUS); result.Building(UnitTypes.ASSIMILATOR, 2); result.If(() => Completed(UnitTypes.ZEALOT) + Completed(UnitTypes.IMMORTAL) + Completed(UnitTypes.DISRUPTOR) + Completed(UnitTypes.ARCHON) + Completed(UnitTypes.TEMPEST) >= 40 || Minerals() >= 650); result.Building(UnitTypes.NEXUS); result.Building(UnitTypes.ASSIMILATOR, 2); return(result); }
public override void OnFrame(Bot bot) { BalanceGas(); TimedObserverTask.Target = bot.TargetManager.PotentialEnemyStartLocations[0]; TimedObserverTask.Stopped = bot.Frame < 22.4 * 60 * 6 || bot.Frame >= 22.4 * 60 * 7 || bot.EnemyStrategyAnalyzer.Count(UnitTypes.SPIRE) > 0; if (TimedObserverTask.Stopped) { TimedObserverTask.Clear(); } if (Count(UnitTypes.ZEALOT) + Count(UnitTypes.ADEPT) + Count(UnitTypes.STALKER) + Count(UnitTypes.IMMORTAL) >= attackTask.RequiredSize) { Attacking = true; } foreach (WallBuilding building in WallIn.Wall) { bot.DrawSphere(new Point() { X = building.Pos.X, Y = building.Pos.Y, Z = bot.MapAnalyzer.StartLocation.Z }); } foreach (WorkerDefenseTask task in WorkerDefenseTask.Tasks) { task.Stopped = Completed(UnitTypes.ZEALOT) >= 5; } if (Bot.Main.EnemyStrategyAnalyzer.TotalCount(UnitTypes.ZERGLING) >= 5 && bot.Frame <= 22.4 * 60 * 2) { SmellCheese = true; } if (Bot.Main.EnemyStrategyAnalyzer.Count(UnitTypes.SPAWNING_POOL) > 0 && bot.Frame <= 22.4 * 60 * 1.4 && !Expanded.Get().Detected) { SmellCheese = true; } if (!SpinePushDetected && SmellCheese) { foreach (Unit enemy in bot.Enemies()) { if (enemy.UnitType != UnitTypes.QUEEN && enemy.UnitType != UnitTypes.SPINE_CRAWLER && enemy.UnitType != UnitTypes.SPINE_CRAWLER_UPROOTED) { continue; } if (SC2Util.DistanceSq(enemy.Pos, bot.MapAnalyzer.StartLocation) <= 50 * 50) { SpinePushDetected = true; break; } } } FearSpinesController.Stopped = !SpinePushDetected; if (bot.EnemyRace == Race.Zerg) { if (bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.MUTALISK) + bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.BROOD_LORD) + bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.CORRUPTOR) + bot.EnemyStrategyAnalyzer.Count(UnitTypes.SPIRE) + bot.EnemyStrategyAnalyzer.Count(UnitTypes.GREATER_SPIRE) > 0) { DesiredStalkers = 15; } else { DesiredStalkers = 2; } } if (StrategyAnalysis.CannonRush.Get().Detected) { attackTask.RequiredSize = 5; } else if (SmellCheese) { attackTask.RequiredSize = 30; } if (Count(UnitTypes.NEXUS) >= 3) { IdleTask.Task.OverrideTarget = OverrideDefenseTarget; } else { IdleTask.Task.OverrideTarget = null; } DefenseTask.GroundDefenseTask.ExpandDefenseRadius = 25; DefenseTask.GroundDefenseTask.MainDefenseRadius = 30; DefenseTask.GroundDefenseTask.MaxDefenseRadius = 120; DefenseTask.GroundDefenseTask.DrawDefenderRadius = 80; DefenseTask.AirDefenseTask.ExpandDefenseRadius = 25; DefenseTask.AirDefenseTask.MainDefenseRadius = 30; DefenseTask.AirDefenseTask.MaxDefenseRadius = 120; DefenseTask.AirDefenseTask.DrawDefenderRadius = 80; if (EarlyPool.Get().Detected&& !Expanded.Get().Detected&& Completed(UnitTypes.ZEALOT) < 2) { foreach (Agent agent in bot.UnitManager.Agents.Values) { if (agent.Unit.UnitType == UnitTypes.NEXUS && agent.Unit.BuildProgress < 0.99) { agent.Order(Abilities.CANCEL); } } } }
public override void Produce(Bot bot, Agent agent) { if (Count(UnitTypes.PROBE) >= 24 && Count(UnitTypes.NEXUS) < 2 && Minerals() < 450) { return; } if (agent.Unit.UnitType == UnitTypes.NEXUS && Minerals() >= 50 && Count(UnitTypes.PROBE) < 44 - Completed(UnitTypes.ASSIMILATOR) && (Count(UnitTypes.NEXUS) >= 2 || Count(UnitTypes.PROBE) < 18 + 2 * Completed(UnitTypes.ASSIMILATOR))) { if (Count(UnitTypes.PROBE) < 13 || Count(UnitTypes.PYLON) > 0) { agent.Order(1006); } } else if (agent.Unit.UnitType == UnitTypes.GATEWAY) { if (Count(UnitTypes.ZEALOT) >= 6 && Count(UnitTypes.NEXUS) < 2 && Minerals() < 500) { return; } if (Attacking && Count(UnitTypes.NEXUS) < 3) { return; } if (EarlyPool.Get().Detected&& !Expanded.Get().Detected) { if (Minerals() >= 100 && (Completed(UnitTypes.CYBERNETICS_CORE) == 0 || Count(UnitTypes.ZEALOT) <= Math.Max(2, Count(UnitTypes.ADEPT)))) { agent.Order(916); } else if (Completed(UnitTypes.CYBERNETICS_CORE) > 0 && Minerals() >= 100 && Gas() >= 25) { agent.Order(922); } } else if (!UseStalkers) { if (Minerals() >= 50 && Gas() >= 150 && Completed(UnitTypes.TEMPLAR_ARCHIVE) > 0 && Count(UnitTypes.HIGH_TEMPLAR) * 5 < Count(UnitTypes.STALKER) + Count(UnitTypes.ZEALOT) + Count(UnitTypes.ADEPT)) { agent.Order(919); } else if (Minerals() >= 100 && (Completed(UnitTypes.CYBERNETICS_CORE) == 0 || Count(UnitTypes.ZEALOT) <= Count(UnitTypes.ADEPT)) && (Count(UnitTypes.ZEALOT) < 10 || Gas() < 25)) { agent.Order(916); } else if (Completed(UnitTypes.CYBERNETICS_CORE) > 0 && Minerals() >= 100 && Gas() >= 25) { agent.Order(922); } } else { if (Minerals() >= 50 && Gas() >= 150 && Completed(UnitTypes.TEMPLAR_ARCHIVE) > 0 && Count(UnitTypes.HIGH_TEMPLAR) * 5 < Count(UnitTypes.STALKER) + Count(UnitTypes.ZEALOT) + Count(UnitTypes.ADEPT)) { agent.Order(919); } else if (Minerals() >= 100 && Gas() <= 200 && (Completed(UnitTypes.CYBERNETICS_CORE) == 0 || Count(UnitTypes.ZEALOT) <= Count(UnitTypes.STALKER))) { agent.Order(916); } else if (Completed(UnitTypes.CYBERNETICS_CORE) > 0 && Minerals() >= 125 && Gas() >= 50) { agent.Order(917); } } } else if (agent.Unit.UnitType == UnitTypes.ROBOTICS_FACILITY) { if (Attacking && Count(UnitTypes.NEXUS) < 3) { return; } if (Count(UnitTypes.OBSERVER) == 0 && Minerals() >= 25 && Gas() >= 75) { agent.Order(977); } else if (Completed(UnitTypes.ROBOTICS_BAY) > 0 && Minerals() >= 300 && Gas() >= 200 && !UseImmortals && Count(UnitTypes.COLOSUS) < 7) { agent.Order(978); } else if (Minerals() >= 250 && Gas() >= 100 && UseImmortals) { agent.Order(979); } } else if (agent.Unit.UnitType == UnitTypes.ROBOTICS_BAY) { if (Minerals() >= 150 && Gas() >= 150 && !Bot.Main.Observation.Observation.RawData.Player.UpgradeIds.Contains(50) && !UseImmortals) { agent.Order(1097); } } else if (agent.Unit.UnitType == UnitTypes.TEMPLAR_ARCHIVE) { if (!Bot.Main.Observation.Observation.RawData.Player.UpgradeIds.Contains(52) && Minerals() >= 200 && Gas() >= 200) { agent.Order(1126); } } else if (agent.Unit.UnitType == UnitTypes.TWILIGHT_COUNSEL) { if (UseStalkers) { if (!Bot.Main.Observation.Observation.RawData.Player.UpgradeIds.Contains(87) && Minerals() >= 150 && Gas() >= 150) { agent.Order(1593); } } else { if (!Bot.Main.Observation.Observation.RawData.Player.UpgradeIds.Contains(130) && Minerals() >= 100 && Gas() >= 100) { agent.Order(1594); } else if (!Bot.Main.Observation.Observation.RawData.Player.UpgradeIds.Contains(86) && Minerals() >= 100 && Gas() >= 100) { agent.Order(1592); } } } }
public override void OnFrame(Bot bot) { if (Count(UnitTypes.ZEALOT) + Count(UnitTypes.ADEPT) + Count(UnitTypes.STALKER) + Count(UnitTypes.COLOSUS) + Count(UnitTypes.IMMORTAL) >= attackTask.RequiredSize) { Attacking = true; } if (StrategyAnalysis.CannonRush.Get().Detected) { attackTask.RequiredSize = 5; } if (bot.EnemyRace == Race.Zerg && !PokeTask.Stopped) { if (bot.EnemyStrategyAnalyzer.Count(UnitTypes.ZERGLING) >= 10 || bot.EnemyStrategyAnalyzer.Count(UnitTypes.SPINE_CRAWLER) >= 2 || bot.EnemyStrategyAnalyzer.Count(UnitTypes.ROACH) >= 5) { PokeTask.Stopped = true; PokeTask.Clear(); } } if (EarlyPool.Get().Detected&& !Expanded.Get().Detected&& Completed(UnitTypes.ZEALOT) < 2) { foreach (Agent agent in bot.UnitManager.Agents.Values) { if (agent.Unit.UnitType == UnitTypes.NEXUS && agent.Unit.BuildProgress < 0.99) { agent.Order(Abilities.CANCEL); } } } if (MassHydra.Get().Detected) { UseStalkers = false; UseImmortals = false; } else if (MassRoach.Get().Detected) { UseStalkers = true; UseImmortals = true; } else if (bot.EnemyStrategyAnalyzer.EncounteredEnemies.Contains(UnitTypes.HYDRALISK) || bot.EnemyStrategyAnalyzer.EncounteredEnemies.Contains(UnitTypes.HYDRALISK_DEN)) { UseStalkers = false; UseImmortals = false; } else if (bot.EnemyStrategyAnalyzer.EncounteredEnemies.Contains(UnitTypes.ROACH) || bot.EnemyStrategyAnalyzer.EncounteredEnemies.Contains(UnitTypes.ROACH_WARREN)) { UseStalkers = true; UseImmortals = true; } else { UseStalkers = bot.EnemyRace == Race.Protoss || (MassRoach.Get().DetectedPreviously&& !MassHydra.Get().DetectedPreviously); UseImmortals = (MassRoach.Get().DetectedPreviously&& !MassHydra.Get().DetectedPreviously); } }
public override void OnFrame(Bot bot) { if (Count(UnitTypes.PROBE) <= 10) { GasWorkerTask.WorkersPerGas = 0; } else if (Count(UnitTypes.NEXUS) < 3) { GasWorkerTask.WorkersPerGas = 2; } else { BalanceGas(); } if (!CannonDefenseDetected && bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.PHOTON_CANNON) + bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.FORGE) >= 0 && bot.Frame < 22.4 * 60 * 4) { CannonDefenseDetected = true; } if (!TempestDetected && bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.TEMPEST) > 0) { TempestDetected = true; } bot.NexusAbilityManager.PriotitizedAbilities.Add(917); if (bot.EnemyStrategyAnalyzer.Count(UnitTypes.BATTLECRUISER) > 0) { BattlecruisersDetected = true; } if (TempestDetected) { AttackTask.RequiredSize = 25; AttackTask.RetreatSize = 8; } else if (BattlecruisersDetected) { AttackTask.RequiredSize = 40; AttackTask.RetreatSize = 10; } else { AttackTask.RequiredSize = 15; AttackTask.RetreatSize = 6; } foreach (WallBuilding building in WallIn.Wall) { bot.DrawSphere(new Point() { X = building.Pos.X, Y = building.Pos.Y, Z = bot.MapAnalyzer.StartLocation.Z }); } foreach (WorkerDefenseTask task in WorkerDefenseTask.Tasks) { task.Stopped = Completed(UnitTypes.ZEALOT) >= 5; } if (StrategyAnalysis.CannonRush.Get().Detected) { AttackTask.RequiredSize = 5; } else if (SmellCheese) { AttackTask.RequiredSize = 30; } if (Natural.Owner == bot.PlayerId && Count(UnitTypes.NEXUS) < 3 && Completed(UnitTypes.STALKER) < 15) { IdleTask.Task.OverrideTarget = SC2Util.Point((bot.MapAnalyzer.GetMainRamp().X + Natural.BaseLocation.Pos.X) / 2f, (bot.MapAnalyzer.GetMainRamp().Y + Natural.BaseLocation.Pos.Y) / 2f); } else if (Count(UnitTypes.NEXUS) >= 4) { IdleTask.Task.OverrideTarget = OverrideDefenseTarget; } else { IdleTask.Task.OverrideTarget = null; } DefenseTask.GroundDefenseTask.ExpandDefenseRadius = 25; DefenseTask.GroundDefenseTask.MainDefenseRadius = 30; DefenseTask.GroundDefenseTask.MaxDefenseRadius = 120; DefenseTask.GroundDefenseTask.DrawDefenderRadius = 80; if (TempestDetected && Count(UnitTypes.STALKER) + Count(UnitTypes.VOID_RAY) >= 12) { DefenseTask.AirDefenseTask.ExpandDefenseRadius = 40; DefenseTask.AirDefenseTask.MainDefenseRadius = 40; DefenseTask.AirDefenseTask.MaxDefenseRadius = 120; DefenseTask.AirDefenseTask.DrawDefenderRadius = 120; } else { DefenseTask.AirDefenseTask.ExpandDefenseRadius = 25; DefenseTask.AirDefenseTask.MainDefenseRadius = 30; DefenseTask.AirDefenseTask.MaxDefenseRadius = 120; DefenseTask.AirDefenseTask.DrawDefenderRadius = 80; } if (EarlyPool.Get().Detected&& !Expanded.Get().Detected&& Completed(UnitTypes.ZEALOT) < 2) { foreach (Agent agent in bot.UnitManager.Agents.Values) { if (agent.Unit.UnitType == UnitTypes.NEXUS && agent.Unit.BuildProgress < 0.99) { agent.Order(Abilities.CANCEL); } } } }
public override void Produce(Bot bot, Agent agent) { if (Count(UnitTypes.PROBE) >= 24 && Count(UnitTypes.NEXUS) < 2 && Minerals() < 450) { return; } if (agent.Unit.UnitType == UnitTypes.NEXUS && Minerals() >= 50 && Count(UnitTypes.PROBE) < Math.Min(70, 20 * Completed(UnitTypes.NEXUS)) && (Count(UnitTypes.NEXUS) >= 2 || Count(UnitTypes.PROBE) < 18 + 2 * Completed(UnitTypes.ASSIMILATOR))) { if (Count(UnitTypes.PROBE) < 13 || Count(UnitTypes.PYLON) > 0) { agent.Order(1006); } } else if (agent.Unit.UnitType == UnitTypes.GATEWAY) { if (Count(UnitTypes.ZEALOT) >= 6 && Count(UnitTypes.NEXUS) < 2 && Minerals() < 500) { return; } if (Attacking && Count(UnitTypes.NEXUS) < 3) { return; } if (SmellCheese && !Expanded.Get().Detected) { if (Minerals() >= 100 && (Completed(UnitTypes.CYBERNETICS_CORE) == 0 || Count(UnitTypes.ZEALOT) <= Math.Max(8, Count(UnitTypes.ADEPT)))) { agent.Order(916); } else if (Completed(UnitTypes.CYBERNETICS_CORE) > 0 && Minerals() >= 100 && Gas() >= 25) { agent.Order(922); } } else { if (Gas() >= 50 && Minerals() >= 125 && Count(UnitTypes.STALKER) < DesiredStalkers && Completed(UnitTypes.CYBERNETICS_CORE) > 0) { agent.Order(917); } else if (Minerals() >= 450 && Gas() < 100 && Count(UnitTypes.ZEALOT) < 20 && Completed(UnitTypes.ROBOTICS_FACILITY) > 0) { agent.Order(916); } else if (Minerals() >= 50 && Gas() >= 150 && Completed(UnitTypes.TEMPLAR_ARCHIVE) > 0) { agent.Order(919); } else if (Minerals() >= 350 && Count(UnitTypes.ZEALOT) < 20) { agent.Order(916); } else if (Minerals() >= 100 && Count(UnitTypes.ZEALOT) < 10) { agent.Order(916); } else if (Minerals() >= 450) { agent.Order(916); } } } else if (agent.Unit.UnitType == UnitTypes.ROBOTICS_FACILITY) { if (Attacking && Count(UnitTypes.NEXUS) < 3) { return; } if ((Count(UnitTypes.OBSERVER) == 0 || (Count(UnitTypes.IMMORTAL) >= 10 && Count(UnitTypes.DISRUPTOR) >= 4)) && Count(UnitTypes.OBSERVER) < 2 && Minerals() >= 25 && Gas() >= 75) { agent.Order(977); } else if (Minerals() >= 150 && Gas() >= 150 && Count(UnitTypes.IMMORTAL) >= 3 && Count(UnitTypes.DISRUPTOR) < 4) { agent.Order(994); } else if (Minerals() >= 275 && Gas() >= 100 && Count(UnitTypes.IMMORTAL) < DesiredImmortals) { agent.Order(979); } } else if (agent.Unit.UnitType == UnitTypes.TEMPLAR_ARCHIVE) { } else if (agent.Unit.UnitType == UnitTypes.TWILIGHT_COUNSEL) { if (!Bot.Main.Observation.Observation.RawData.Player.UpgradeIds.Contains(130) && Minerals() >= 100 && Gas() >= 100 && Completed(UnitTypes.ADEPT) > 0) { agent.Order(1594); } else if (!Bot.Main.Observation.Observation.RawData.Player.UpgradeIds.Contains(86) && Minerals() >= 100 && Gas() >= 100) { agent.Order(1592); } } }
public override void Produce(Bot bot, Agent agent) { if (agent.Unit.UnitType == UnitTypes.COMMAND_CENTER && Completed(UnitTypes.BARRACKS) > 0 && Count(UnitTypes.SCV) >= 16 && (agent.Base == Main || agent.Base == Natural)) { if (Minerals() >= 150) { agent.Order(1516); } } else if (agent.Unit.UnitType == UnitTypes.COMMAND_CENTER && Completed(UnitTypes.ENGINEERING_BAY) > 0 && Count(UnitTypes.SCV) >= 16 && Gas() >= 150 && agent.Base != Main && agent.Base != Natural) { if (Minerals() >= 150) { agent.Order(1450); } } else if (UnitTypes.ResourceCenters.Contains(agent.Unit.UnitType)) { if (Count(UnitTypes.SCV) < Math.Min(60, 20 * Count(UnitTypes.COMMAND_CENTER)) && Minerals() >= 50 && FoodLeft() >= 1) { agent.Order(524); } } else if (agent.Unit.UnitType == UnitTypes.BARRACKS) { if (Minerals() >= 50 && FoodLeft() >= 1 && Count(UnitTypes.MARINE) < 4 && (!Expanded.Get().Detected || Count(UnitTypes.BUNKER) > 0)) { agent.Order(560); } } else if (agent.Unit.UnitType == UnitTypes.FACTORY) { if (!bot.UnitManager.Agents.ContainsKey(agent.Unit.AddOnTag)) { if ((Count(UnitTypes.FACTORY_REACTOR) == 0 || Count(UnitTypes.FACTORY_TECH_LAB) >= 3) && Count(UnitTypes.FACTORY_REACTOR) < 2) { agent.Order(455); } else { if (InitialAttackDone || Count(UnitTypes.HELLBAT) + Count(UnitTypes.HELLION) >= 8) { agent.Order(454); } else if (Minerals() >= 100 && FoodLeft() >= 2) { if (Completed(UnitTypes.ARMORY) > 0) { agent.Order(596); } else { agent.Order(595); } } } } else if (bot.UnitManager.Agents[agent.Unit.AddOnTag].Unit.UnitType == UnitTypes.FACTORY_TECH_LAB) { if (BlueFlameStarted < 0 && bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.QUEEN) >= 3 && Count(UnitTypes.HELLBAT) + Count(UnitTypes.HELLION) > 0) { return; } if (bot.Frame <= 22.4 * 5 && !MechDestroyExpandsTask.Task.Stopped && Minerals() >= 100 && FoodLeft() >= 2) { if (Completed(UnitTypes.ARMORY) > 0) { agent.Order(596); } else { agent.Order(595); } } if (!DefendMutas && RoachHydra && Count(UnitTypes.THOR) >= Count(UnitTypes.SIEGE_TANK) * 3 + 3) { if (Minerals() >= 150 && Gas() >= 125 && FoodLeft() >= 3) { agent.Order(591); } } else if (Count(UnitTypes.SIEGE_TANK) < DesiredTanks) { if (Minerals() >= 150 && Gas() >= 125 && FoodLeft() >= 3) { agent.Order(591); } } else if (Minerals() >= 150 && Gas() >= 100 && FoodLeft() >= 3 && (Count(UnitTypes.CYCLONE) < 1 || DefendMutas || ManyLings) && (Count(UnitTypes.CYCLONE) < 3 || DefendMutas) && Count(UnitTypes.CYCLONE) < 5) { agent.Order(597); } else if (Completed(UnitTypes.ARMORY) > 0 && Minerals() >= 300 && Gas() >= 200 && FoodLeft() >= 6 && Count(UnitTypes.THOR) < 8) { agent.Order(594); } else if (Minerals() >= 100 && FoodLeft() >= 2 && Count(UnitTypes.THOR) >= 8) { if (Completed(UnitTypes.ARMORY) > 0) { agent.Order(596); } else { agent.Order(595); } } } else if (bot.UnitManager.Agents[agent.Unit.AddOnTag].Unit.UnitType == UnitTypes.FACTORY_REACTOR) { if (Count(UnitTypes.WIDOW_MINE) < DesiredMines && InitialAttackDone && Count(UnitTypes.HELLBAT) + Count(UnitTypes.HELLION) >= (!MechDestroyExpandsTask.Task.Stopped ? 12 : 4) && (Count(UnitTypes.WIDOW_MINE) < 4 || Count(UnitTypes.HELLBAT) + Count(UnitTypes.HELLION) >= 10)) { if (Minerals() >= 75 && Gas() >= 25 && FoodLeft() >= 2) { agent.Order(614); } } else if (!UltralisksDetected || Count(UnitTypes.HELLBAT) + Count(UnitTypes.HELLION) < 8) { if (Minerals() >= 100 && FoodLeft() >= 2 && (!MechDestroyExpandsTask.Task.Stopped || Gas() < 200 || Minerals() >= 400 || Count(UnitTypes.HELLBAT) + Count(UnitTypes.HELLION) < MinimumHellbats)) { if (Completed(UnitTypes.ARMORY) > 0) { agent.Order(596); } else { agent.Order(595); } } } } } else if (agent.Unit.UnitType == UnitTypes.STARPORT) { if (!bot.UnitManager.Agents.ContainsKey(agent.Unit.AddOnTag)) { if (Count(UnitTypes.VIKING_FIGHTER) > 0) { if (Count(UnitTypes.STARPORT_REACTOR) == 0 || Count(UnitTypes.STARPORT_TECH_LAB) > 0) { if (Minerals() >= 50 && Gas() >= 25) { agent.Order(488); } } else if (Minerals() >= 50 && Gas() >= 50) { agent.Order(487); } } else if (Minerals() > 150 && Gas() >= 75 && FoodLeft() >= 2) { agent.Order(624); } } else if (bot.UnitManager.Agents[agent.Unit.AddOnTag].Unit.UnitType == UnitTypes.STARPORT_REACTOR) { if ((Count(UnitTypes.VIKING_FIGHTER) < MinVikings || Count(UnitTypes.MEDIVAC) >= (DefendMutas ? 2 : 4)) && Count(UnitTypes.VIKING_FIGHTER) < MaxVikings) { if (Minerals() > 150 && Gas() >= 75 && FoodLeft() >= 2) { agent.Order(624); } } else if (Count(UnitTypes.MEDIVAC) < (DefendMutas ? 2 : 4) && Count(UnitTypes.THOR) > 0 && !UltralisksDetected) { if (Minerals() >= 100 && Gas() >= 100 && FoodLeft() >= 2) { agent.Order(620); } } else if (Count(UnitTypes.THOR) > 0) { if (Minerals() >= 500 && Gas() >= 300 && FoodLeft() >= 3) { agent.Order(626); } } } else if (bot.UnitManager.Agents[agent.Unit.AddOnTag].Unit.UnitType == UnitTypes.STARPORT_TECH_LAB) { if (Minerals() > 100 && Gas() >= 200 && Count(UnitTypes.RAVEN) < 2 && FoodLeft() >= 2) { agent.Order(622); } else if (Minerals() > 150 && Gas() >= 75 && FoodLeft() >= 2 && Count(UnitTypes.RAVEN) >= 2 && Count(UnitTypes.VIKING_FIGHTER) < MaxVikings) { agent.Order(624); } else if (Count(UnitTypes.THOR) > 0) { if (Minerals() >= 500 && Gas() >= 300 && FoodLeft() >= 3) { agent.Order(626); } } } } else if (agent.Unit.UnitType == UnitTypes.ARMORY && Count(UnitTypes.THOR) > 0) { if (!Bot.Main.Observation.Observation.RawData.Player.UpgradeIds.Contains(116) && Gas() >= 100 && Minerals() >= 100) { agent.Order(864); } else if (!Bot.Main.Observation.Observation.RawData.Player.UpgradeIds.Contains(30) && Gas() >= 100 && Minerals() >= 100) { agent.Order(855); } else if (!Bot.Main.Observation.Observation.RawData.Player.UpgradeIds.Contains(117) && Gas() >= 175 && Minerals() >= 175) { agent.Order(865); } else if (!Bot.Main.Observation.Observation.RawData.Player.UpgradeIds.Contains(31) && Gas() >= 175 && Minerals() >= 175) { agent.Order(856); } else if (!Bot.Main.Observation.Observation.RawData.Player.UpgradeIds.Contains(118) && Gas() >= 250 && Minerals() >= 250) { agent.Order(866); } else if (!Bot.Main.Observation.Observation.RawData.Player.UpgradeIds.Contains(32) && Gas() >= 250 && Minerals() >= 250) { agent.Order(857); } } else if (agent.Unit.UnitType == UnitTypes.FACTORY_TECH_LAB) { if (Count(UnitTypes.HELLBAT) + Count(UnitTypes.HELLION) > 0 && !Bot.Main.Observation.Observation.RawData.Player.UpgradeIds.Contains(19)) { if (Gas() >= 150 && Minerals() >= 150) { agent.Order(761); } } else if (Count(UnitTypes.CYCLONE) > 0 && !Bot.Main.Observation.Observation.RawData.Player.UpgradeIds.Contains(144)) { if (Gas() >= 150 && Minerals() >= 150) { agent.Order(769); } } else if (Count(UnitTypes.WIDOW_MINE) > 0 && !Bot.Main.Observation.Observation.RawData.Player.UpgradeIds.Contains(122)) { if (Gas() >= 75 && Minerals() >= 75) { agent.Order(764); } } } }
private BuildList MainBuild() { BuildList result = new BuildList(); result.Building(UnitTypes.NEXUS); result.If(() => Bot.Main.Frame >= 22.4 * 17); if (WallIn.Wall.Count >= 5) { result.Building(UnitTypes.PYLON, Natural, WallIn.Wall[4].Pos, true); result.Building(UnitTypes.GATEWAY, Natural, WallIn.Wall[0].Pos, true, () => Completed(UnitTypes.PYLON) > 0); result.Building(UnitTypes.GATEWAY, Natural, WallIn.Wall[3].Pos, true, () => Completed(UnitTypes.PYLON) > 0 && EarlyPool.Get().Detected); //result.Building(UnitTypes.GATEWAY, Natural, WallIn.Wall[1].Pos, true, () => Completed(UnitTypes.PYLON) > 0 && EarlyPool.Get().Detected); } else { result.Building(UnitTypes.PYLON); result.Building(UnitTypes.GATEWAY, () => Completed(UnitTypes.PYLON) > 0); result.Building(UnitTypes.GATEWAY, () => Completed(UnitTypes.PYLON) > 0 && EarlyPool.Get().Detected); } result.If(() => Count(UnitTypes.GATEWAY) > 0); //result.Building(UnitTypes.ASSIMILATOR, () => !EarlyPool.Get().Detected || Expanded.Get().Detected || Count(UnitTypes.ZEALOT) >= 6); result.Building(UnitTypes.ASSIMILATOR, () => Bot.Main.Frame >= 22.4 * 53); result.Building(UnitTypes.NEXUS, () => (!EarlyPool.Get().Detected || Completed(UnitTypes.ADEPT) + Completed(UnitTypes.ZEALOT) >= 3 || RoachRushDetected) && (!RoachRushDetected || Completed(UnitTypes.IMMORTAL) > 0)); if (WallIn.Wall.Count >= 5) { result.Building(UnitTypes.CYBERNETICS_CORE, Natural, WallIn.Wall[1].Pos, true); } else { result.Building(UnitTypes.CYBERNETICS_CORE); } //result.Building(UnitTypes.CYBERNETICS_CORE, () => EarlyPool.Get().Detected && Count(UnitTypes.ZEALOT) >= 6); result.If(() => Count(UnitTypes.ADEPT) >= 2 || AdeptHarassMainTask.Task.Sent); result.Building(UnitTypes.ASSIMILATOR, () => RoachRushDetected); result.Building(UnitTypes.ROBOTICS_FACILITY, () => RoboArmy); if (WallIn.Wall.Count >= 5) { result.Building(UnitTypes.GATEWAY, Natural, WallIn.Wall[3].Pos, true, () => !EarlyPool.Get().Detected); } else { result.Building(UnitTypes.GATEWAY, () => !EarlyPool.Get().Detected); } if (ShieldBatteryPos == null) { result.Building(UnitTypes.SHIELD_BATTERY, Natural, NaturalDefensePos, () => (EarlyPool.Get().Detected&& !RoachRushDetected) || (RoachRushDetected && Count(UnitTypes.STALKER) > 0)); } else { result.Building(UnitTypes.SHIELD_BATTERY, Natural, ShieldBatteryPos, true, () => (EarlyPool.Get().Detected&& !RoachRushDetected) || (RoachRushDetected && Count(UnitTypes.STALKER) > 0)); } result.Building(UnitTypes.ASSIMILATOR, 2, () => (!EarlyPool.Get().Detected || Count(UnitTypes.ZEALOT) >= 4) && (!RoachRushDetected || Count(UnitTypes.IMMORTAL) > 0)); result.Building(UnitTypes.TWILIGHT_COUNSEL, () => !RoboArmy || Completed(UnitTypes.IMMORTAL) > 0); result.Building(UnitTypes.GATEWAY, Main, () => !EarlyPool.Get().Detected); result.Building(UnitTypes.TEMPLAR_ARCHIVE, () => !RoboArmy); result.Building(UnitTypes.GATEWAY, Main, () => !EarlyPool.Get().Detected); result.Building(UnitTypes.ASSIMILATOR, () => Count(UnitTypes.ZEALOT) >= 8 || Minerals() >= 450); result.Building(UnitTypes.GATEWAY, Main, () => !EarlyPool.Get().Detected); result.Building(UnitTypes.PYLON, Natural, () => Count(UnitTypes.CYBERNETICS_CORE) > 0 && Natural.ResourceCenter != null); result.Building(UnitTypes.NEXUS); result.If(() => TimingAttackTask.Task.AttackSent || InitialAttackDone || Minerals() >= 600 || RoachRushDetected || (EarlyPool.Get().Detected&& !Expanded.Get().Detected) || (EarlyPool.Get().Detected&& Count(UnitTypes.ARCHON) > 0)); result.Building(UnitTypes.ROBOTICS_FACILITY, () => (!EarlyPool.Get().Detected || Completed(UnitTypes.ADEPT) + Completed(UnitTypes.ZEALOT) >= 8) && !RoachRushDetected); result.Building(UnitTypes.PYLON); result.Building(UnitTypes.FORGE, () => !RoboArmy || Count(UnitTypes.ROBOTICS_FACILITY) >= 2); result.Upgrade(UpgradeType.ProtossGroundWeapons); result.Upgrade(UpgradeType.ProtossGroundArmor); result.Building(UnitTypes.ASSIMILATOR, () => !RoboArmy || Minerals() >= 600); result.Building(UnitTypes.PYLON); result.Building(UnitTypes.ROBOTICS_BAY, () => UseColosus && (TimingAttackTask.Task.AttackSent || RoachRushDetected)); result.Building(UnitTypes.NEXUS); result.Building(UnitTypes.ROBOTICS_FACILITY, () => Completed(UnitTypes.ADEPT) + Completed(UnitTypes.ZEALOT) >= 10 || InitialAttackDone || RoachRushDetected); result.Building(UnitTypes.ASSIMILATOR, 4, () => Minerals() >= 700 && Gas() < 200); result.Building(UnitTypes.ROBOTICS_FACILITY, () => InitialAttackDone || RoachRushDetected); result.If(() => Count(UnitTypes.IMMORTAL) + Count(UnitTypes.ARCHON) >= 3 && Count(UnitTypes.ZEALOT) + Count(UnitTypes.ADEPT) + Count(UnitTypes.STALKER) >= 10); result.Building(UnitTypes.ASSIMILATOR, 2); result.Building(UnitTypes.ASSIMILATOR, 2); result.If(() => Count(UnitTypes.IMMORTAL) + Count(UnitTypes.ARCHON) + Count(UnitTypes.ADEPT) + Count(UnitTypes.COLOSUS) + Count(UnitTypes.STALKER) + Count(UnitTypes.ZEALOT) >= 15); result.Building(UnitTypes.ASSIMILATOR, 2); result.Building(UnitTypes.GATEWAY, Main, 2); result.Building(UnitTypes.NEXUS); result.Building(UnitTypes.ASSIMILATOR, 2); result.If(() => Count(UnitTypes.IMMORTAL) + Count(UnitTypes.ARCHON) + Count(UnitTypes.ADEPT) + Count(UnitTypes.COLOSUS) + Count(UnitTypes.STALKER) + Count(UnitTypes.ZEALOT) >= 40 || Minerals() >= 650); result.Building(UnitTypes.NEXUS); return(result); }
public override void OnFrame(Bot bot) { if (bot.Observation.ActionErrors != null) { foreach (ActionError error in bot.Observation.ActionErrors) { DebugUtil.WriteLine("Error with ability " + error.AbilityId + ": " + error.Result); } } if (!EcoCheeseSuspected && Expanded.Get().Detected&& bot.Frame <= 22.4 * 60 * 2 && bot.EnemyStrategyAnalyzer.Count(UnitTypes.GATEWAY) == 0) { EcoCheeseSuspected = true; } if (bot.EnemyStrategyAnalyzer.Count(UnitTypes.STALKER) + bot.EnemyStrategyAnalyzer.Count(UnitTypes.ADEPT) > 0 || bot.EnemyStrategyAnalyzer.Count(UnitTypes.ZEALOT) >= 3) { EcoCheeseSuspected = false; } if (!CannonDefenseDetected && bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.PHOTON_CANNON) + bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.FORGE) >= 0 && bot.Frame < 22.4 * 60 * 4) { CannonDefenseDetected = true; } if (!TempestDetected && bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.TEMPEST) > 0) { TempestDetected = true; } MechDestroyExpandsTask.Task.RequiredSize = 4; MechDestroyExpandsTask.Task.MaxSize = 4; MechDestroyExpandsTask.Task.RetreatSize = 0; MechDestroyExpandsTask.Task.UnitType = UnitTypes.HELLION; if (bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.STALKER) + bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.IMMORTAL) + bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.VOID_RAY) > 0 && bot.EnemyStrategyAnalyzer.Count(UnitTypes.NEXUS) >= 2) { MechDestroyExpandsTask.Task.Stopped = true; } BunkerDefendersTask.Task.LeaveBunkers = EcoCheeseSuspected; MarineHarassController.Disabled = !EcoCheeseSuspected; /* * if ((bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.STALKER) >= 7 || (bot.EnemyStrategyAnalyzer.Count(UnitTypes.GATEWAY) >= 3 && bot.EnemyStrategyAnalyzer.Count(UnitTypes.CYBERNETICS_CORE) > 0)) * && bot.Frame < 22.4 * 60f * 3.5) * FourGateStalkerSuspected = true; */ StalkerEmergency = FourGateStalkerSuspected && (Completed(UnitTypes.SIEGE_TANK) < 2 || Completed(UnitTypes.MARAUDER) < 4) && Completed(UnitTypes.MARAUDER) + Completed(UnitTypes.MARINE) + Completed(UnitTypes.SIEGE_TANK) + Completed(UnitTypes.CYCLONE) < 15; if (FourGateStalkerSuspected && ((Completed(UnitTypes.SIEGE_TANK) >= 2 && Completed(UnitTypes.MARAUDER) >= 3) || Count(UnitTypes.COMMAND_CENTER) >= 2)) { IdleTask.Task.OverrideTarget = SC2Util.Point((bot.MapAnalyzer.GetMainRamp().X + Natural.BaseLocation.Pos.X) / 2f, (bot.MapAnalyzer.GetMainRamp().Y + Natural.BaseLocation.Pos.Y) / 2f); } else { IdleTask.Task.OverrideTarget = null; } SiegeAtRampTask.Task.Stopped = !FourGateStalkerSuspected || Count(UnitTypes.THOR) > 0; SiegeBelowRampTask.Task.Stopped = !FourGateStalkerSuspected || Count(UnitTypes.THOR) > 0; if (FourGateStalkerSuspected && Completed(UnitTypes.SIEGE_TANK) < 2 && Completed(UnitTypes.THOR) < 2 && Count(UnitTypes.COMMAND_CENTER) > Completed(UnitTypes.COMMAND_CENTER) && Bot.Main.EnemyStrategyAnalyzer.TotalCount(UnitTypes.STARGATE) == 0) { foreach (Agent agent in bot.UnitManager.Agents.Values) { if (agent.Unit.UnitType == UnitTypes.COMMAND_CENTER && agent.Unit.BuildProgress < 0.99) { agent.Order(Abilities.CANCEL); } } } bot.TargetManager.TargetCannons = true; if (!OraclesDetected && bot.EnemyStrategyAnalyzer.Count(UnitTypes.ORACLE) > 0) { OraclesDetectedFrame = bot.Frame; } OraclesDetected = bot.Frame - OraclesDetectedFrame < 30 * 22.4; if (Bot.Main.EnemyStrategyAnalyzer.TotalCount(UnitTypes.COLOSUS) + Bot.Main.EnemyStrategyAnalyzer.TotalCount(UnitTypes.ROBOTICS_BAY) + Bot.Main.EnemyStrategyAnalyzer.TotalCount(UnitTypes.ROBOTICS_FACILITY) > 0) { CollosusSuspected = true; } if (CollosusSuspected || bot.EnemyStrategyAnalyzer.Count(UnitTypes.TEMPEST) > 0 || CannonsDetected) { DesiredVikings = 10; } else if (SkyTossDetected) { DesiredVikings = 5; } foreach (Task task in DefenseSquadTask.Tasks) { task.Stopped = !OraclesDetected; if (!OraclesDetected) { task.Clear(); } task.Priority = 8; } if (ZealotRushConfirmed) { TimingAttackTask.Task.RequiredSize = 20; TimingAttackTask.Task.RetreatSize = 6; } else if (EcoCheeseSuspected) { TimingAttackTask.Task.RequiredSize = 3; TimingAttackTask.Task.RetreatSize = 0; } else if (Completed(UnitTypes.COMMAND_CENTER) < 2 || FourGateStalkerSuspected || bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.TEMPEST) > 0) { TimingAttackTask.Task.RequiredSize = 40; TimingAttackTask.Task.RetreatSize = 10; } else if (CollosusSuspected) { if (Completed(UnitTypes.VIKING_FIGHTER) == 0) { TimingAttackTask.Task.Clear(); TimingAttackTask.Task.Stopped = true; } else { TimingAttackTask.Task.Stopped = false; } TimingAttackTask.Task.RequiredSize = 40; } else if (WorkerRushDetected) { TimingAttackTask.Task.RequiredSize = 8; TimingAttackTask.Task.RetreatSize = 0; } else if (DTsSuspected) { TimingAttackTask.Task.RequiredSize = 25; TimingAttackTask.Task.RetreatSize = 8; } else { TimingAttackTask.Task.RequiredSize = 30; TimingAttackTask.Task.RetreatSize = 10; } bot.DrawText("Attack sent: " + TimingAttackTask.Task.AttackSent); bot.DrawText("RequiredSize: " + TimingAttackTask.Task.RequiredSize); if (!GatewayPushDetected) { if (bot.EnemyStrategyAnalyzer.Count(UnitTypes.CYBERNETICS_CORE) > 0 && bot.EnemyStrategyAnalyzer.Count(UnitTypes.GATEWAY) >= 3) { GatewayPushDetected = true; } if (bot.EnemyStrategyAnalyzer.Count(UnitTypes.ADEPT) > 0) { GatewayPushDetected = true; } if (bot.EnemyStrategyAnalyzer.Count(UnitTypes.STALKER) >= 3) { GatewayPushDetected = true; } } if (GatewayPushDetected) { WorkerScoutTask.Task.Stopped = true; WorkerScoutTask.Task.Clear(); } if (bot.EnemyStrategyAnalyzer.Count(UnitTypes.GATEWAY) > 0 && bot.Frame >= 22.4 * 90 && bot.Frame < 22.4 * 110) { WorkerScoutTask.Task.Stopped = true; WorkerScoutTask.Task.Clear(); } if (bot.EnemyStrategyAnalyzer.Count(UnitTypes.ASSIMILATOR) + bot.EnemyStrategyAnalyzer.Count(UnitTypes.CYBERNETICS_CORE) > 0 && bot.Frame >= 22.4 * 75 && bot.Frame < 22.4 * 110) { WorkerScoutTask.Task.Stopped = true; WorkerScoutTask.Task.Clear(); } if ((ZealotRushSuspected || bot.EnemyStrategyAnalyzer.Count(UnitTypes.PHOTON_CANNON) > 0 || WorkerRushDetected) && bot.Frame >= 22.4 * 110) { WorkerScoutTask.Task.Stopped = true; WorkerScoutTask.Task.Clear(); } if (TempestDetected && Count(UnitTypes.VIKING_FIGHTER) + Count(UnitTypes.THOR) * 2 >= 10) { DefenseTask.AirDefenseTask.ExpandDefenseRadius = 40; DefenseTask.AirDefenseTask.MainDefenseRadius = 40; DefenseTask.AirDefenseTask.MaxDefenseRadius = 120; DefenseTask.AirDefenseTask.DrawDefenderRadius = 120; } else if (FourGateStalkerSuspected) { DefenseTask.AirDefenseTask.ExpandDefenseRadius = 15; DefenseTask.GroundDefenseTask.ExpandDefenseRadius = 15; DefenseTask.GroundDefenseTask.MainDefenseRadius = 20; } else { DefenseTask.AirDefenseTask.ExpandDefenseRadius = 20; DefenseTask.GroundDefenseTask.ExpandDefenseRadius = 20; } DefenseTask.AirDefenseTask.MaxDefenseRadius = 80; DefenseTask.GroundDefenseTask.MaxDefenseRadius = 80; RepairTask.Task.WallIn = WallIn; if (CannonDefenseDetected) { TransformTask.Task.HellbatsToHellions(); } else { TransformTask.Task.HellionsToHellbats(); } TransformTask.Task.ThorsToSingleTarget(); if (!ZealotRushConfirmed && Bot.Main.EnemyRace == Race.Protoss && bot.Frame < 22.4 * 60 * 4 && Bot.Main.EnemyStrategyAnalyzer.TotalCount(UnitTypes.ZEALOT) >= 5) { ZealotRushConfirmed = true; } if (ZealotRushConfirmed && Completed(UnitTypes.HELLION) + Completed(UnitTypes.HELLBAT) + Completed(UnitTypes.MARAUDER) < 6) { foreach (Agent agent in bot.UnitManager.Agents.Values) { if (agent.Unit.UnitType == UnitTypes.COMMAND_CENTER && agent.Unit.BuildProgress < 0.99 && agent.DistanceSq(Main.BaseLocation.Pos) >= 4 * 4) { agent.Order(Abilities.CANCEL); } } } if (!ZealotRushSuspected && Bot.Main.EnemyRace == Race.Protoss) { if ((Bot.Main.Frame >= 22.4 * 60 * 1.5 && !Bot.Main.EnemyStrategyAnalyzer.NoProxyGatewayConfirmed) || (Bot.Main.Frame < 22.4 * 60 * 1.5 && ThreeGate.Get().Detected)) { ZealotRushSuspected = true; } } if (!CannonsDetected) { if (bot.EnemyStrategyAnalyzer.Count(UnitTypes.PHOTON_CANNON) > 0 || bot.EnemyStrategyAnalyzer.Count(UnitTypes.FORGE) > 0) { CannonsDetected = true; } } if (WorkerRushDefenseTask.Task.WorkerRushHappening) { WorkerRushDetected = true; } if (ScanTimingsSet && bot.OrbitalAbilityManager.ScanCommands.Count == 0) { bot.OrbitalAbilityManager.SaveEnergy = 0; } else { bot.OrbitalAbilityManager.SaveEnergy = 50; } if (bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.FORGE) + bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.PHOTON_CANNON) > 0 && bot.Frame >= 22.4 * 60f * 2.5 && !ScanTimingsSet) { ScanTimingsSet = true; if (!EarlyScanSet) { EarlyScanSet = true; bot.OrbitalAbilityManager.ScanCommands.Add(new ScanCommand() { Pos = bot.TargetManager.PotentialEnemyStartLocations[0], FromFrame = (int)(22.4 * 60 * 3.5) }); } } if (bot.Frame >= (int)(22.4 * 60f * 2.5) && !EarlyScanSet && bot.EnemyStrategyAnalyzer.Count(UnitTypes.GATEWAY) == 1 && bot.EnemyStrategyAnalyzer.Count(UnitTypes.FORGE) == 0 && bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.STALKER) == 0 && bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.ADEPT) == 0 && bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.ADEPT_PHASE_SHIFT) == 0) { EarlyScanSet = true; bot.OrbitalAbilityManager.ScanCommands.Add(new ScanCommand() { Pos = bot.TargetManager.PotentialEnemyStartLocations[0], FromFrame = (int)(22.4 * 60 * 3) }); } if (bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.GATEWAY) >= 2 && (bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.CYBERNETICS_CORE) + bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.ASSIMILATOR) + bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.STALKER) + bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.ADEPT) + bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.ADEPT_PHASE_SHIFT) > 0) && bot.Frame >= 22.4 * 60f * 2.5 && !ScanTimingsSet) { ScanTimingsSet = true; if (!EarlyScanSet) { EarlyScanSet = true; bot.OrbitalAbilityManager.ScanCommands.Add(new ScanCommand() { Pos = bot.TargetManager.PotentialEnemyStartLocations[0], FromFrame = (int)(22.4 * 60 * 3) }); } bot.OrbitalAbilityManager.ScanCommands.Add(new ScanCommand() { Pos = bot.TargetManager.PotentialEnemyStartLocations[0], FromFrame = (int)(22.4 * 60 * 11.5) }); bot.OrbitalAbilityManager.ScanCommands.Add(new ScanCommand() { Pos = bot.MapAnalyzer.GetEnemyNatural().Pos, FromFrame = (int)(22.4 * 60 * 11.5 + 22.4) }); } if (!GatewayPushDetected && !ScanTimingsSet && bot.Frame >= 22.4 * 60f * 2.75) { ScanTimingsSet = true; bot.OrbitalAbilityManager.ScanCommands.Add(new ScanCommand() { Pos = bot.TargetManager.PotentialEnemyStartLocations[0], FromFrame = (int)(22.4 * 60 * 4) }); bot.OrbitalAbilityManager.ScanCommands.Add(new ScanCommand() { Pos = bot.TargetManager.PotentialEnemyStartLocations[0], FromFrame = (int)(22.4 * 60 * 5.5) }); bot.OrbitalAbilityManager.ScanCommands.Add(new ScanCommand() { Pos = bot.MapAnalyzer.GetEnemyNatural().Pos, FromFrame = (int)(22.4 * 60 * 5.5 + 22.4) }); } if (bot.EnemyStrategyAnalyzer.Count(UnitTypes.DARK_SHRINE) + bot.EnemyStrategyAnalyzer.Count(UnitTypes.DARK_TEMPLAR) + bot.EnemyStrategyAnalyzer.Count(UnitTypes.TWILIGHT_COUNSEL) > 0) { DTsSuspected = true; } if (bot.EnemyStrategyAnalyzer.Count(UnitTypes.STARGATE) + bot.EnemyStrategyAnalyzer.Count(UnitTypes.VOID_RAY) + bot.EnemyStrategyAnalyzer.Count(UnitTypes.CARRIER) + bot.EnemyStrategyAnalyzer.Count(UnitTypes.INTERCEPTOR) + bot.EnemyStrategyAnalyzer.Count(UnitTypes.TEMPEST) + bot.EnemyStrategyAnalyzer.Count(UnitTypes.PHOENIX) + bot.EnemyStrategyAnalyzer.Count(UnitTypes.ORACLE) > 0) { SkyTossDetected = true; } if (bot.EnemyStrategyAnalyzer.Count(UnitTypes.PHOTON_CANNON) + bot.EnemyStrategyAnalyzer.Count(UnitTypes.SHIELD_BATTERY) >= 6 && bot.EnemyStrategyAnalyzer.Count(UnitTypes.ROBOTICS_FACILITY) == 0 && bot.EnemyStrategyAnalyzer.Count(UnitTypes.GATEWAY) < 4) { SkyTossDetected = true; } if (bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.TEMPEST) > 0) { TimingAttackTask.Task.BeforeControllers = new List <CustomController>(); TransformTask.Task.Priority = 10; } }
private BuildList MainBuild() { BuildList result = new BuildList(); result.Building(UnitTypes.NEXUS); result.Building(UnitTypes.PYLON, Main, WallIn.Wall[1].Pos, true); result.Building(UnitTypes.GATEWAY, Main, WallIn.Wall[0].Pos, true, () => Completed(UnitTypes.PYLON) > 0); result.Building(UnitTypes.ASSIMILATOR); result.Building(UnitTypes.CYBERNETICS_CORE); result.Building(UnitTypes.ASSIMILATOR); result.If(() => Count(UnitTypes.STALKER) > 0 || Minerals() >= 550); result.Building(UnitTypes.NEXUS); result.Building(UnitTypes.STARGATE); result.Building(UnitTypes.PYLON, Natural, () => Natural.Owner == Bot.Main.PlayerId && !Natural.UnderAttack); result.Building(UnitTypes.ASSIMILATOR); result.Building(UnitTypes.SHIELD_BATTERY, Natural, 2, () => Bot.Main.Frame >= 3 * 60 * 22.4 && !Expanded.Get().Detected&& Completed(Natural, UnitTypes.PYLON) > 0 && !Natural.UnderAttack && !CannonDefenseDetected); result.Building(UnitTypes.NEXUS); result.Building(UnitTypes.ASSIMILATOR); result.Building(UnitTypes.STARGATE); result.Building(UnitTypes.TWILIGHT_COUNSEL); result.Building(UnitTypes.PYLON); result.Building(UnitTypes.ASSIMILATOR, 2); result.Building(UnitTypes.FLEET_BEACON); result.Building(UnitTypes.ASSIMILATOR); result.Building(UnitTypes.NEXUS); result.Building(UnitTypes.ROBOTICS_FACILITY); result.Building(UnitTypes.ASSIMILATOR, 2); result.Building(UnitTypes.ASSIMILATOR, 4, () => Minerals() >= 700 && Gas() < 200); result.Building(UnitTypes.ASSIMILATOR, 2); result.Building(UnitTypes.ASSIMILATOR, 2); result.If(() => Count(UnitTypes.STALKER) >= 20); result.Building(UnitTypes.ASSIMILATOR, 2); result.Building(UnitTypes.NEXUS); result.Building(UnitTypes.ASSIMILATOR, 2); result.Building(UnitTypes.NEXUS); return(result); }
public override void OnFrame(Bot bot) { WorkerTask.Task.EvacuateThreatenedBases = true; if ((FourGateDetected || DoubleRoboAllIn) && Completed(UnitTypes.IMMORTAL) < 2) { foreach (Agent agent in bot.Units()) { if (agent.Unit.UnitType != UnitTypes.NEXUS) { continue; } if (agent.Unit.BuildProgress >= 0.99) { continue; } agent.Order(Abilities.CANCEL); } } if (Completed(UnitTypes.NEXUS) == 1 && TotalEnemyCount(UnitTypes.ROBOTICS_BAY) + TotalEnemyCount(UnitTypes.ROBOTICS_FACILITY) > 0) { DoubleRoboAllIn = true; } foreach (Agent agent in bot.UnitManager.Agents.Values) { if (bot.Frame % 224 != 0) { break; } if (agent.Unit.UnitType != UnitTypes.GATEWAY) { continue; } if (Count(UnitTypes.NEXUS) < 2 && TimingAttackTask.Task.Units.Count == 0) { agent.Order(Abilities.MOVE, Main.BaseLocation.Pos); } else { agent.Order(Abilities.MOVE, bot.TargetManager.PotentialEnemyStartLocations[0]); } } if (EnemyCount(UnitTypes.PHOENIX) <= 3) { DefenseTask.AirDefenseTask.IgnoreEnemyTypes.Add(UnitTypes.PHOENIX); } else { DefenseTask.AirDefenseTask.IgnoreEnemyTypes.Remove(UnitTypes.PHOENIX); } if (StrategyAnalysis.WorkerRush.Get().Detected && Count(UnitTypes.ZEALOT) < 2) { GasWorkerTask.WorkersPerGas = 0; } else { BalanceGas(); } ForceFieldRampTask.Task.Stopped = !FourGateDetected; if (ForceFieldRampTask.Task.Stopped) { ForceFieldRampTask.Task.Clear(); } SecondRobo = TotalEnemyCount(UnitTypes.STARGATE) + TotalEnemyCount(UnitTypes.VOID_RAY) + TotalEnemyCount(UnitTypes.ORACLE) == 0 && (TotalEnemyCount(UnitTypes.ROBOTICS_FACILITY) + TotalEnemyCount(UnitTypes.ROBOTICS_BAY) + TotalEnemyCount(UnitTypes.COLOSUS) + TotalEnemyCount(UnitTypes.IMMORTAL) > 0 || EnemyCount(UnitTypes.GATEWAY) + EnemyCount(UnitTypes.WARP_GATE) >= 3 ); ScoutTask.Task.ScoutType = UnitTypes.PHOENIX; ScoutTask.Task.Target = bot.TargetManager.PotentialEnemyStartLocations[0]; if (TotalEnemyCount(UnitTypes.STARGATE) + TotalEnemyCount(UnitTypes.DARK_SHRINE) + TotalEnemyCount(UnitTypes.VOID_RAY) + TotalEnemyCount(UnitTypes.ORACLE) + TotalEnemyCount(UnitTypes.ROBOTICS_FACILITY) == 0 && !SecondRobo) { foreach (Agent agent in bot.Units()) { if (agent.Unit.UnitType != UnitTypes.SENTRY) { continue; } if (agent.Unit.Energy < 75) { continue; } // Hallucinate scouting phoenix. agent.Order(154); } } if (StrategyAnalysis.WorkerRush.Get().Detected && Count(UnitTypes.ZEALOT) < 2) { foreach (Agent agent in bot.UnitManager.Agents.Values) { if (agent.Unit.UnitType == UnitTypes.ASSIMILATOR && agent.Unit.BuildProgress < 0.99) { agent.Order(Abilities.CANCEL); } } } if (!FourGateDetected && EnemyCount(UnitTypes.GATEWAY) + EnemyCount(UnitTypes.WARP_GATE) >= 3 && bot.Frame < 22.4 * 60 * 4) { FourGateDetected = true; } if (TotalEnemyCount(UnitTypes.VOID_RAY) + TotalEnemyCount(UnitTypes.STARGATE) + TotalEnemyCount(UnitTypes.ORACLE) > 0) { FourGateDetected = false; } bot.TargetManager.TargetCannons = true; if (WorkerScoutTask.Task.BaseCircled()) { WorkerScoutTask.Task.Stopped = true; WorkerScoutTask.Task.Clear(); } WorkerScoutTask.Task.StartFrame = 600; ObserverScoutTask.Task.Priority = 6; bot.NexusAbilityManager.Stopped = Count(UnitTypes.STALKER) == 0 && bot.Frame >= 120 * 22.4; bot.NexusAbilityManager.PriotitizedAbilities.Add(917); if (EnemyExpandFrame >= 1000000 && Expanded.Get().Detected) { EnemyExpandFrame = bot.Frame; } if ((DoubleRoboAllIn || FourGateDetected) && Completed(UnitTypes.IMMORTAL) >= 4) { TimingAttackTask.Task.RequiredSize = 10; } else { TimingAttackTask.Task.RequiredSize = 24; } if (Count(UnitTypes.NEXUS) <= 1) { IdleTask.Task.OverrideTarget = OverrideMainDefenseTarget; } else if (Count(UnitTypes.NEXUS) >= 3) { IdleTask.Task.OverrideTarget = OverrideDefenseTarget; } else { IdleTask.Task.OverrideTarget = null; } if (FourGateDetected) { DefenseTask.GroundDefenseTask.ExpandDefenseRadius = 25; DefenseTask.GroundDefenseTask.MainDefenseRadius = 25; DefenseTask.GroundDefenseTask.MaxDefenseRadius = 120; DefenseTask.GroundDefenseTask.DrawDefenderRadius = 80; } else { DefenseTask.GroundDefenseTask.ExpandDefenseRadius = 30; DefenseTask.GroundDefenseTask.MainDefenseRadius = 30; DefenseTask.GroundDefenseTask.MaxDefenseRadius = 120; DefenseTask.GroundDefenseTask.DrawDefenderRadius = 80; } if (TotalEnemyCount(UnitTypes.TEMPEST) > 0) { DefenseTask.AirDefenseTask.ExpandDefenseRadius = 50; DefenseTask.AirDefenseTask.MainDefenseRadius = 50; DefenseTask.AirDefenseTask.MaxDefenseRadius = 120; DefenseTask.AirDefenseTask.DrawDefenderRadius = 80; } else { DefenseTask.AirDefenseTask.ExpandDefenseRadius = 30; DefenseTask.AirDefenseTask.MainDefenseRadius = 30; DefenseTask.AirDefenseTask.MaxDefenseRadius = 120; DefenseTask.AirDefenseTask.DrawDefenderRadius = 80; } }
public override void OnFrame(Bot bot) { BalanceGas(); if (ProxyPylon && ProxyTask.Task.UnitCounts.ContainsKey(UnitTypes.PYLON) && ProxyTask.Task.UnitCounts[UnitTypes.PYLON] > 0) { ProxyPylon = false; ProxyTask.Task.Stopped = true; ProxyTask.Task.Clear(); } IdleTask.Task.AttackMove = true; bot.TargetManager.CloseTo = null; bot.TargetManager.PrefferDistant = true; foreach (Agent agent in bot.UnitManager.Agents.Values) { if (agent.Unit.UnitType == UnitTypes.MOTHERSHIP) { bot.TargetManager.CloseTo = SC2Util.To2D(agent.Unit.Pos); bot.TargetManager.PrefferDistant = false; bot.TargetManager.IncludeAllEnemies = true; break; } } if (WorkerScoutTask.Task.BaseCircled()) { WorkerScoutTask.Task.Stopped = true; WorkerScoutTask.Task.Clear(); } if (!ProxyDetected && Defensive) { float proxyDist = 100 * 100; foreach (Unit enemy in bot.Enemies()) { if (enemy.UnitType == UnitTypes.PYLON) { float dist = SC2Util.DistanceSq(enemy.Pos, bot.MapAnalyzer.StartLocation); if (dist < proxyDist) { ProxyDetected = true; } } } } ForceFieldRampTask.Task.Stopped = !ProxyDetected || Completed(UnitTypes.STALKER) >= 20; if (ForceFieldRampTask.Task.Stopped) { ForceFieldRampTask.Task.Clear(); } if (TotalEnemyCount(UnitTypes.ZEALOT) + TotalEnemyCount(UnitTypes.PHOTON_CANNON) > 0) { HuntProxyTask.Task.Stopped = true; HuntProxyTask.Task.Clear(); } if ((ProxyDetected) && Completed(UnitTypes.STALKER) < 15) { foreach (Agent agent in bot.Units()) { if (agent.Unit.UnitType != UnitTypes.NEXUS) { continue; } if (agent.Unit.BuildProgress >= 0.99) { continue; } agent.Order(Abilities.CANCEL); } } BlinkForwardController.Stopped = !EnemyTempestOpener || Completed(UnitTypes.MOTHERSHIP) > 0; if (TotalEnemyCount(UnitTypes.ROBOTICS_FACILITY) + TotalEnemyCount(UnitTypes.ROBOTICS_BAY) > 0) { EnemyStargateOpener = false; EnemyTempestOpener = false; EnemyVoidRayOpener = false; } if (!StalkerAggressionSuspected && Defensive && bot.Frame >= 22.4 * 60 * 4.5 && Expanded.Get().Detected && TotalEnemyCount(UnitTypes.STARGATE) + TotalEnemyCount(UnitTypes.ROBOTICS_FACILITY) + TotalEnemyCount(UnitTypes.ROBOTICS_BAY) + TotalEnemyCount(UnitTypes.IMMORTAL) + TotalEnemyCount(UnitTypes.FLEET_BEACON) + +TotalEnemyCount(UnitTypes.VOID_RAY) + TotalEnemyCount(UnitTypes.TEMPEST) == 0) { StalkerAggressionSuspected = true; } if (TotalEnemyCount(UnitTypes.STARGATE) + TotalEnemyCount(UnitTypes.ROBOTICS_FACILITY) + TotalEnemyCount(UnitTypes.ROBOTICS_BAY) + TotalEnemyCount(UnitTypes.IMMORTAL) + TotalEnemyCount(UnitTypes.FLEET_BEACON) + +TotalEnemyCount(UnitTypes.VOID_RAY) + TotalEnemyCount(UnitTypes.TEMPEST) > 0) { StalkerAggressionSuspected = false; } if (!EnemyStargateOpener && Defensive && TotalEnemyCount(UnitTypes.ROBOTICS_FACILITY) + TotalEnemyCount(UnitTypes.ROBOTICS_BAY) == 0 && TotalEnemyCount(UnitTypes.STARGATE) + TotalEnemyCount(UnitTypes.VOID_RAY) + TotalEnemyCount(UnitTypes.FLEET_BEACON) + TotalEnemyCount(UnitTypes.TEMPEST) > 0 && bot.Frame <= 22.4 * 60 * 4.5) { EnemyStargateOpener = true; } if (!EnemyVoidRayOpener && !EnemyTempestOpener && EnemyStargateOpener && (TotalEnemyCount(UnitTypes.VOID_RAY) > 0 || Expanded.Get().Detected) && TotalEnemyCount(UnitTypes.ROBOTICS_FACILITY) + TotalEnemyCount(UnitTypes.ROBOTICS_BAY) == 0) { EnemyVoidRayOpener = true; } if (!EnemyVoidRayOpener && !EnemyTempestOpener && EnemyStargateOpener && TotalEnemyCount(UnitTypes.TEMPEST) + TotalEnemyCount(UnitTypes.FLEET_BEACON) > 0 && TotalEnemyCount(UnitTypes.ROBOTICS_FACILITY) + TotalEnemyCount(UnitTypes.ROBOTICS_BAY) == 0) { EnemyTempestOpener = true; } ObserverScoutTask.Task.Priority = 6; ArmyObserverTask.Task.IgnoreAllyUnitTypes.Add(UnitTypes.DARK_TEMPLAR); if (TotalEnemyCount(UnitTypes.STARGATE) + TotalEnemyCount(UnitTypes.DARK_SHRINE) + TotalEnemyCount(UnitTypes.ROBOTICS_FACILITY) + TotalEnemyCount(UnitTypes.VOID_RAY) == 0 && !ProxyDetected) { foreach (Agent agent in bot.Units()) { if (agent.Unit.UnitType != UnitTypes.SENTRY) { continue; } if (agent.Unit.Energy < 75) { continue; } // Hallucinate scouting phoenix. agent.Order(154); } } ScoutTask.Task.ScoutType = UnitTypes.PHOENIX; if (Completed(UnitTypes.PHOENIX) == 0) { ScoutTask.Task.Target = bot.TargetManager.PotentialEnemyStartLocations[0]; } else { foreach (Agent agent in bot.UnitManager.Agents.Values) { if (agent.Unit.UnitType != UnitTypes.PHOENIX) { continue; } if (bot.TargetManager.PotentialEnemyStartLocations.Count == 0 || agent.DistanceSq(bot.TargetManager.PotentialEnemyStartLocations[0]) >= 10 * 10) { continue; } ScoutTask.Task.Target = bot.MapAnalyzer.GetEnemyNatural().Pos; break; } } bot.NexusAbilityManager.Stopped = Completed(UnitTypes.PYLON) == 0; bot.NexusAbilityManager.PriotitizedAbilities.Add(1006); SaveWorkersTask.Task.Stopped = bot.Frame >= 22.4 * 60 * 7 || EnemyCount(UnitTypes.CYCLONE) == 0 || !Natural.UnderAttack; if (SaveWorkersTask.Task.Stopped) { SaveWorkersTask.Task.Clear(); } DefenseTask.GroundDefenseTask.IncludePhoenixes = true; if (TimingAttackTask.Task.Units.Count > 0) { DefenseTask.AirDefenseTask.IgnoreEnemyTypes.Add(UnitTypes.OBSERVER); } else { DefenseTask.AirDefenseTask.IgnoreEnemyTypes.Remove(UnitTypes.OBSERVER); } WorkerTask.Task.EvacuateThreatenedBases = true; TimingAttackTask.Task.DefendOtherAgents = false; if (EnemyVoidRayOpener && Completed(UnitTypes.TEMPEST) + Completed(UnitTypes.CARRIER) < 10) { TimingAttackTask.Task.RetreatSize = 15; TimingAttackTask.Task.RequiredSize = 45; } else if (TotalEnemyCount(UnitTypes.PHOTON_CANNON) > 0 && ProxyDetected && Completed(UnitTypes.IMMORTAL) >= 4) { TimingAttackTask.Task.RetreatSize = 6; TimingAttackTask.Task.RequiredSize = 15; } else if (Completed(UnitTypes.MOTHERSHIP) == 0 || Completed(UnitTypes.TEMPEST) + Completed(UnitTypes.CARRIER) < 6) { TimingAttackTask.Task.RetreatSize = 15; TimingAttackTask.Task.RequiredSize = 35; } else if (Completed(UnitTypes.MOTHERSHIP) == 1 && Completed(UnitTypes.TEMPEST) + Completed(UnitTypes.CARRIER) >= 8) { TimingAttackTask.Task.RetreatSize = 0; TimingAttackTask.Task.RequiredSize = 8; } else { TimingAttackTask.Task.RetreatSize = 10; TimingAttackTask.Task.RequiredSize = 25; } if (ProxyDetected && TotalEnemyCount(UnitTypes.PHOTON_CANNON) > 0 && Completed(UnitTypes.IMMORTAL) < 3) { DefenseTask.GroundDefenseTask.ExpandDefenseRadius = 18; DefenseTask.GroundDefenseTask.MainDefenseRadius = 18; DefenseTask.GroundDefenseTask.MaxDefenseRadius = 120; DefenseTask.GroundDefenseTask.DrawDefenderRadius = 80; DefenseTask.GroundDefenseTask.BufferZone = 0; DefenseTask.AirDefenseTask.ExpandDefenseRadius = 18; DefenseTask.AirDefenseTask.MainDefenseRadius = 18; DefenseTask.AirDefenseTask.MaxDefenseRadius = 120; DefenseTask.AirDefenseTask.DrawDefenderRadius = 80; DefenseTask.AirDefenseTask.BufferZone = 0; } else if (EnemyTempestOpener || TotalEnemyCount(UnitTypes.TEMPEST) > 0) { DefenseTask.GroundDefenseTask.ExpandDefenseRadius = 30; DefenseTask.GroundDefenseTask.MainDefenseRadius = 30; DefenseTask.GroundDefenseTask.MaxDefenseRadius = 120; DefenseTask.GroundDefenseTask.DrawDefenderRadius = 80; DefenseTask.AirDefenseTask.ExpandDefenseRadius = 30; DefenseTask.AirDefenseTask.MainDefenseRadius = 30; DefenseTask.AirDefenseTask.MaxDefenseRadius = 120; DefenseTask.AirDefenseTask.DrawDefenderRadius = 80; } else { DefenseTask.GroundDefenseTask.ExpandDefenseRadius = 20; DefenseTask.GroundDefenseTask.MainDefenseRadius = 20; DefenseTask.GroundDefenseTask.MaxDefenseRadius = 120; DefenseTask.GroundDefenseTask.DrawDefenderRadius = 80; DefenseTask.AirDefenseTask.ExpandDefenseRadius = 20; DefenseTask.AirDefenseTask.MainDefenseRadius = 20; DefenseTask.AirDefenseTask.MaxDefenseRadius = 120; DefenseTask.AirDefenseTask.DrawDefenderRadius = 80; } }
public override void OnFrame(Bot bot) { ArmyObserverTask.Task.IgnoreAllyUnitTypes.Add(UnitTypes.ADEPT); ObserverScoutTask.Task.Priority = 6; WorkerTask.Task.EvacuateThreatenedBases = true; TimingAttackTask.Task.ExcludeUnitTypes.Add(UnitTypes.ADEPT); if (Count(UnitTypes.ADEPT) >= 6) { StopAdeptHarass = true; } bot.DrawText("ZealotRushSuspected: " + ZealotRushSuspected); foreach (Agent agent in bot.UnitManager.Agents.Values) { if (bot.Frame % 224 != 0) { break; } if (agent.Unit.UnitType != UnitTypes.GATEWAY) { continue; } if (Count(UnitTypes.NEXUS) < 2 && TimingAttackTask.Task.Units.Count == 0) { agent.Order(Abilities.MOVE, Main.BaseLocation.Pos); } else { agent.Order(Abilities.MOVE, bot.TargetManager.PotentialEnemyStartLocations[0]); } } KillImmortals.Stopped = TotalEnemyCount(UnitTypes.ZEALOT) >= 3 || EnemyCount(UnitTypes.PHOTON_CANNON) > 0; if (EnemyCount(UnitTypes.PHOENIX) <= 3) { DefenseTask.AirDefenseTask.IgnoreEnemyTypes.Add(UnitTypes.PHOENIX); } else { DefenseTask.AirDefenseTask.IgnoreEnemyTypes.Remove(UnitTypes.PHOENIX); } if (StrategyAnalysis.WorkerRush.Get().Detected && Count(UnitTypes.ZEALOT) < 2) { GasWorkerTask.WorkersPerGas = 0; } else { BalanceGas(); } if (TotalEnemyCount(UnitTypes.FORGE) > 0 && bot.Frame <= 22.4 * 60 * 2) { EarlyForgeDetected = true; } ScoutTask.Task.ScoutType = UnitTypes.PHOENIX; ScoutTask.Task.Target = bot.TargetManager.PotentialEnemyStartLocations[0]; if (!EarlyExpand && !ZealotRushSuspected && TotalEnemyCount(UnitTypes.STARGATE) + TotalEnemyCount(UnitTypes.DARK_SHRINE) + TotalEnemyCount(UnitTypes.VOID_RAY) == 0) { foreach (Agent agent in bot.Units()) { if (agent.Unit.UnitType != UnitTypes.SENTRY) { continue; } if (agent.Unit.Energy < 75) { continue; } // Hallucinate scouting phoenix. agent.Order(154); } } if (!VoidraysDetected && TotalEnemyCount(UnitTypes.VOID_RAY) > 0) { VoidraysDetected = true; if (TimingAttackTask.Task.Units.Count < 12) { TimingAttackTask.Task.Clear(); } } if (!ZealotRushSuspected && !StrategyAnalysis.WorkerRush.Get().Detected) { if ((Bot.Main.Frame >= 22.4 * 60 * 1.5 && !Bot.Main.EnemyStrategyAnalyzer.NoProxyGatewayConfirmed && TotalEnemyCount(UnitTypes.ASSIMILATOR) + TotalEnemyCount(UnitTypes.CYBERNETICS_CORE) == 0) || (Bot.Main.Frame < 22.4 * 60 * 1.5 && ThreeGate.Get().Detected)) { ZealotRushSuspected = true; } } if (!LowGroundCannons) { foreach (Unit enemy in bot.Enemies()) { if (enemy.UnitType != UnitTypes.PHOTON_CANNON) { continue; } if (bot.MapAnalyzer.MapHeight((int)enemy.Pos.X, (int)enemy.Pos.Y) < bot.MapAnalyzer.MapHeight((int)bot.TargetManager.PotentialEnemyStartLocations[0].X, (int)bot.TargetManager.PotentialEnemyStartLocations[0].Y)) { LowGroundCannons = true; break; } } } if (!CannonDefenseDetected && TotalEnemyCount(UnitTypes.PHOTON_CANNON) + TotalEnemyCount(UnitTypes.FORGE) > 0 && bot.Frame < 22.4 * 60 * 4 && (EarlyForgeDetected || Expanded.Get().Detected || LowGroundCannons)) { CannonDefenseDetected = true; if (TimingAttackTask.Task.Units.Count < 12) { TimingAttackTask.Task.Clear(); } } if (StrategyAnalysis.WorkerRush.Get().Detected && Count(UnitTypes.ZEALOT) < 2) { foreach (Agent agent in bot.UnitManager.Agents.Values) { if (agent.Unit.UnitType == UnitTypes.ASSIMILATOR && agent.Unit.BuildProgress < 0.99) { agent.Order(Abilities.CANCEL); } } } bot.TargetManager.TargetCannons = true; if (ZealotRushSuspected) { bot.TargetManager.TargetGateways = true; WorkerScoutTask.Task.Stopped = true; WorkerScoutTask.Task.Clear(); } if (WorkerScoutTask.Task.BaseCircled()) { WorkerScoutTask.Task.Stopped = true; WorkerScoutTask.Task.Clear(); } if (ZealotRushSuspected || Completed(UnitTypes.IMMORTAL) > 0) { foreach (WorkerDefenseTask task in WorkerDefenseTask.Tasks) { task.Stopped = true; task.Clear(); } } if (ZealotRushSuspected && Completed(UnitTypes.STALKER) >= 12) { foreach (Agent agent in bot.Units()) { if (agent.Unit.UnitType != UnitTypes.GATEWAY) { continue; } if (agent.DistanceSq(WallIn.Wall[2].Pos) >= 2) { continue; } KillOwnUnitTask.Task.TargetTag = agent.Unit.Tag; break; } } WorkerScoutTask.Task.StartFrame = 600; ObserverScoutTask.Task.Priority = 6; bot.NexusAbilityManager.Stopped = Count(UnitTypes.STALKER) == 0 && bot.Frame >= 120 * 22.4; bot.NexusAbilityManager.PriotitizedAbilities.Add(917); if (EnemyExpandFrame >= 1000000 && Expanded.Get().Detected) { EnemyExpandFrame = bot.Frame; } if (EnemyExpandFrame < 90 * 22.4) { EarlyExpand = true; } if (EarlyExpand) { TimingAttackTask.Task.RequiredSize = 12; } else if (VoidraysDetected || (TotalEnemyCount(UnitTypes.PHOTON_CANNON) + TotalEnemyCount(UnitTypes.FORGE) > 0 && !LowGroundCannons && !EarlyExpand)) { TimingAttackTask.Task.RequiredSize = 36; } else if (ZealotRushSuspected || (CannonDefenseDetected && EarlyExpand)) { TimingAttackTask.Task.RequiredSize = 12; } else { TimingAttackTask.Task.RequiredSize = 36; } TimingAttackTask.Task.RetreatSize = 0; if (TotalEnemyCount(UnitTypes.PHOTON_CANNON) + TotalEnemyCount(UnitTypes.FORGE) > 0 && !LowGroundCannons && !EarlyExpand && TimingAttackTask.Task.Units.Count < 18 && TimingAttackTask.Task.RequiredSize > 18) { TimingAttackTask.Task.Clear(); } FallBackController.Stopped = ZealotRushSuspected; ForwardProbeTask.Task.Stopped = Completed(UnitTypes.STALKER) + Count(UnitTypes.ADEPT) + Completed(UnitTypes.IMMORTAL) < Math.Max(8, TimingAttackTask.Task.RequiredSize) && (!CannonDefenseDetected || !StargateDetected || EarlyExpand); if (ForwardProbeTask.Task.Stopped) { ForwardProbeTask.Task.Clear(); } if (Count(UnitTypes.NEXUS) <= 1) { IdleTask.Task.OverrideTarget = OverrideMainDefenseTarget; } else if (Count(UnitTypes.NEXUS) >= 3) { IdleTask.Task.OverrideTarget = OverrideDefenseTarget; } else { IdleTask.Task.OverrideTarget = null; } if (ZealotRushSuspected) { DefenseTask.GroundDefenseTask.BufferZone = 0; DefenseTask.GroundDefenseTask.ExpandDefenseRadius = 20; DefenseTask.GroundDefenseTask.MainDefenseRadius = 20; DefenseTask.GroundDefenseTask.MaxDefenseRadius = 120; DefenseTask.GroundDefenseTask.DrawDefenderRadius = 80; } else { DefenseTask.GroundDefenseTask.ExpandDefenseRadius = 30; DefenseTask.GroundDefenseTask.MainDefenseRadius = 30; DefenseTask.GroundDefenseTask.MaxDefenseRadius = 120; DefenseTask.GroundDefenseTask.DrawDefenderRadius = 80; } if (TotalEnemyCount(UnitTypes.TEMPEST) > 0) { DefenseTask.AirDefenseTask.ExpandDefenseRadius = 50; DefenseTask.AirDefenseTask.MainDefenseRadius = 50; DefenseTask.AirDefenseTask.MaxDefenseRadius = 120; DefenseTask.AirDefenseTask.DrawDefenderRadius = 80; } else { DefenseTask.AirDefenseTask.ExpandDefenseRadius = 30; DefenseTask.AirDefenseTask.MainDefenseRadius = 30; DefenseTask.AirDefenseTask.MaxDefenseRadius = 120; DefenseTask.AirDefenseTask.DrawDefenderRadius = 80; } StargateDetected = TotalEnemyCount(UnitTypes.STARGATE) + TotalEnemyCount(UnitTypes.VOID_RAY) + TotalEnemyCount(UnitTypes.TEMPEST) + TotalEnemyCount(UnitTypes.CARRIER) + TotalEnemyCount(UnitTypes.FLEET_BEACON) > 0 || TotalEnemyCount(UnitTypes.PHOENIX) >= 3; EarlyNexus = !EarlyExpand; }
public override void OnFrame(Bot bot) { bot.TaskManager.CombatSimulation.SimulationLength = 0; if (Completed(UnitTypes.WARP_PRISM) > 0) { StopWarpPrisms = true; } if (ProxySuspected) { bot.TargetManager.TargetAllBuildings = true; MassSentriesTask.Task.RequiredSize = 15; MassSentriesTask.Task.RetreatSize = 6; } else if (bot.EnemyRace == Race.Protoss && !Stalker.Get().DetectedPreviously) { MassSentriesTask.Task.RequiredSize = 50; MassSentriesTask.Task.RetreatSize = 10; } else if (bot.EnemyRace == Race.Terran && SiegeTank.Get().DetectedPreviously) { MassSentriesTask.Task.RequiredSize = 50; MassSentriesTask.Task.RetreatSize = 10; } else if (!WarpPrismDrops) { MassSentriesTask.Task.RequiredSize = 25; MassSentriesTask.Task.RetreatSize = 10; } else if (MassSentriesTask.Task.AttackSent || Completed(UnitTypes.WARP_PRISM) > 0) { MassSentriesTask.Task.RequiredSize = 20; MassSentriesTask.Task.RetreatSize = 10; } else { MassSentriesTask.Task.RequiredSize = 30; MassSentriesTask.Task.RetreatSize = 10; } TrainStep.WarpInLocation = null; if (Completed(UnitTypes.WARP_PRISM_PHASING) > 0) { foreach (Agent agent in bot.Units()) { if (agent.Unit.UnitType != UnitTypes.WARP_PRISM_PHASING) { continue; } TrainStep.WarpInLocation = SC2Util.To2D(agent.Unit.Pos); break; } } if (Bot.Main.Frame <= 2) { SentryWarpInTask.Task.Stopped = true; } else if (MassSentriesTask.Task.AttackSent) { SentryWarpInTask.Task.Stopped = false; } bot.DrawText("SentryWarpInTask Stopped: " + SentryWarpInTask.Task.Stopped); DefenseTask.GroundDefenseTask.UseForceFields = true; if (NaturalWall.Wall.Count >= 4 && Count(UnitTypes.NEXUS) < 2) { DefenseTask.GroundDefenseTask.MainDefenseRadius = 40; DefenseTask.GroundDefenseTask.ExpandDefenseRadius = 25; IdleTask.Task.OverrideTarget = NaturalDefensePos; } else { DefenseTask.GroundDefenseTask.MainDefenseRadius = 20; DefenseTask.GroundDefenseTask.ExpandDefenseRadius = 25; IdleTask.Task.OverrideTarget = null; } if (WorkerScoutTask.Task.BaseCircled() && (bot.EnemyRace != Race.Zerg || !DefenseMode)) { WorkerScoutTask.Task.Stopped = true; WorkerScoutTask.Task.Clear(); } if (!DefenseMode && TotalEnemyCount(UnitTypes.ROACH_WARREN) > 0 && bot.Frame <= 22.4 * 90 && !Expanded.Get().Detected) { DefenseMode = true; } if (!DefenseMode && TotalEnemyCount(UnitTypes.BARRACKS) == 0 && bot.Frame >= 22.4 * 90 && bot.Frame <= 22.4 * 120 && bot.EnemyRace == Race.Terran && !Expanded.Get().Detected) { DefenseMode = true; ProxySuspected = true; } if (!DefenseMode && FourRax.Get().Detected&& bot.Frame <= 22.4 * 90 && !Expanded.Get().Detected) { DefenseMode = true; } if (!DefenseMode && TotalEnemyCount(UnitTypes.SPAWNING_POOL) > 0 && bot.Frame <= 22.4 * 80 && !Expanded.Get().Detected) { DefenseMode = true; } if (Expanded.Get().Detected) { DefenseMode = false; } KillOwnUnitTask.Task.Priority = 6; if (Count(Main, UnitTypes.FORGE) > 0 && Completed(UnitTypes.SENTRY) >= 18 && NaturalWall.Wall.Count >= 4) { foreach (Agent agent in bot.Units()) { if (agent.Unit.UnitType != UnitTypes.FORGE) { continue; } if (agent.DistanceSq(NaturalWall.Wall[0].Pos) <= 4) { KillOwnUnitTask.Task.TargetTag = agent.Unit.Tag; break; } } } if (NaturalWall.Wall.Count >= 4) { if (Count(Main, UnitTypes.FORGE) > 0 && Completed(UnitTypes.SENTRY) >= 18) { bot.buildingPlacer.LimitBuildArea = null; } else { bot.buildingPlacer.LimitBuildArea = MainAndNatural; } } if (Completed(UnitTypes.SENTRY) >= 15) { DefenseMode = false; } ForceFieldRampTask.Task.Stopped = (!SkipNatural && !DefenseMode) || NaturalWall.Wall.Count >= 4; if (ForceFieldRampTask.Task.Stopped) { ForceFieldRampTask.Task.Clear(); } if (!TyckleFightChatSent && StrategyAnalysis.WorkerRush.Get().Detected) { TyckleFightChatSent = true; bot.Chat("TICKLE FIGHT! :D"); } if (!MessageSent) { if (MassSentriesTask.Task.AttackSent) { MessageSent = true; bot.Chat("Prepare to be TICKLED! :D"); } } foreach (Agent agent in bot.UnitManager.Agents.Values) { if (bot.Frame % 224 != 0) { break; } if (agent.Unit.UnitType != UnitTypes.GATEWAY) { continue; } if (MassSentriesTask.Task.Units.Count == 0) { agent.Order(Abilities.MOVE, Main.BaseLocation.Pos); } else { agent.Order(Abilities.MOVE, bot.TargetManager.PotentialEnemyStartLocations[0]); } } }
public override void OnFrame(Bot bot) { BalanceGas(); if (bot.Observation.ActionErrors != null && bot.Observation.ActionErrors.Count > 0) { FileUtil.Debug("Errors for frame: " + bot.Frame); foreach (ActionError error in bot.Observation.ActionErrors) { FileUtil.Debug(error.Result + " ability: " + error.AbilityId); } FileUtil.Debug(""); } bot.NexusAbilityManager.PriotitizedAbilities.Add(917); if (bot.EnemyStrategyAnalyzer.Count(UnitTypes.BATTLECRUISER) > 0) { BattlecruisersDetected = true; } if (FourRax.Get().Detected) { FourRaxSuspected = true; } if (!FourRaxSuspected) { Point2D enemyRamp = bot.MapAnalyzer.GetEnemyRamp(); int enemyBarrackWallCount = 0; foreach (Unit enemy in bot.Enemies()) { if (enemyRamp == null) { break; } if (enemy.UnitType == UnitTypes.BARRACKS && SC2Util.DistanceSq(enemy.Pos, enemyRamp) <= 5.5 * 5.5) { enemyBarrackWallCount++; } } if (enemyBarrackWallCount >= 2) { WorkerScoutTask.Stopped = true; WorkerScoutTask.Clear(); FourRaxSuspected = true; } } /* * if (BattlecruisersDetected || * (bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.WIDOW_MINE) >= 12 && bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.MARINE) < 80)) * { * attackTask.RequiredSize = 30; * attackTask.RetreatSize = 8; * } * else if (Count(UnitTypes.ARCHON) + Count(UnitTypes.IMMORTAL) >= 14) * { * attackTask.RequiredSize = 35; * attackTask.RetreatSize = 10; * } * else * { * attackTask.RequiredSize = 40; * attackTask.RetreatSize = 10; * } */ attackTask.RequiredSize = 4; if (Count(UnitTypes.ZEALOT) + Count(UnitTypes.ADEPT) + Count(UnitTypes.STALKER) + Count(UnitTypes.IMMORTAL) >= attackTask.RequiredSize) { Attacking = true; } foreach (WorkerDefenseTask task in WorkerDefenseTask.Tasks) { task.Stopped = Completed(UnitTypes.ZEALOT) >= 5; } foreach (DefenseSquadTask task in StalkerDefenseSquads) { task.Stopped = (bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.REAPER) < 3 && bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.BANSHEE) == 0 || bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.MARINE) + bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.MARAUDER) >= 10); task.MaxDefenders = Math.Min(5, Completed(UnitTypes.STALKER) / Math.Max(1, Count(UnitTypes.NEXUS))); task.Priority = 10; } if (bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.REAPER) >= 3 || bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.BANSHEE) > 0) { DefenseTask.AirDefenseTask.IgnoreEnemyTypes.Add(UnitTypes.VIKING_FIGHTER); DefenseTask.GroundDefenseTask.IgnoreEnemyTypes.Add(UnitTypes.REAPER); bot.buildingPlacer.SpreadCannons = true; attackTask.DefendOtherAgents = false; } FearSpinesController.Stopped = !SpinePushDetected; if (bot.EnemyRace == Race.Zerg) { if (bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.MUTALISK) + bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.BROOD_LORD) + bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.CORRUPTOR) + bot.EnemyStrategyAnalyzer.Count(UnitTypes.SPIRE) + bot.EnemyStrategyAnalyzer.Count(UnitTypes.GREATER_SPIRE) > 0) { DesiredStalkers = 15; } else { DesiredStalkers = 2; } } if (Count(UnitTypes.NEXUS) >= 3) { IdleTask.Task.OverrideTarget = OverrideDefenseTarget; } else { IdleTask.Task.OverrideTarget = null; } DefenseTask.GroundDefenseTask.ExpandDefenseRadius = 30; DefenseTask.GroundDefenseTask.MainDefenseRadius = 30; DefenseTask.GroundDefenseTask.MaxDefenseRadius = 120; DefenseTask.GroundDefenseTask.DrawDefenderRadius = 80; DefenseTask.AirDefenseTask.ExpandDefenseRadius = 30; DefenseTask.AirDefenseTask.MainDefenseRadius = 30; DefenseTask.AirDefenseTask.MaxDefenseRadius = 120; DefenseTask.AirDefenseTask.DrawDefenderRadius = 80; if (EarlyPool.Get().Detected&& !Expanded.Get().Detected&& Completed(UnitTypes.ZEALOT) < 2) { foreach (Agent agent in bot.UnitManager.Agents.Values) { if (agent.Unit.UnitType == UnitTypes.NEXUS && agent.Unit.BuildProgress < 0.99) { agent.Order(Abilities.CANCEL); } } } }
public void OnFrame(Bot bot) { EnemyCounts = new Dictionary <uint, int>(); foreach (Unit unit in bot.Enemies()) { if (!CountedEnemies.ContainsKey(unit.Tag) || CountedEnemies[unit.Tag] != unit.UnitType) { if (!CountedEnemies.ContainsKey(unit.Tag)) { CountedEnemies.Add(unit.Tag, unit.UnitType); } else { CountedEnemies[unit.Tag] = unit.UnitType; } if (!TotalEnemyCounts.ContainsKey(unit.UnitType)) { TotalEnemyCounts.Add(unit.UnitType, 1); } else { TotalEnemyCounts[unit.UnitType]++; } } EncounteredEnemies.Add(unit.UnitType); if (!EnemyCounts.ContainsKey(unit.UnitType)) { EnemyCounts.Add(unit.UnitType, 1); } else { EnemyCounts[unit.UnitType]++; } } foreach (Strategy strategy in Strategies) { strategy.OnFrame(); } if (!NoProxyTerranConfirmed && bot.EnemyRace == Race.Terran && Expanded.Get().Detected) { NoProxyTerranConfirmed = true; } if (!NoProxyTerranConfirmed && bot.EnemyRace == Race.Terran) { foreach (Unit unit in bot.Enemies()) { if (unit.UnitType == UnitTypes.BARRACKS && SC2Util.DistanceSq(bot.MapAnalyzer.StartLocation, unit.Pos) >= 40 * 40) { NoProxyTerranConfirmed = true; break; } } } if (!NoProxyGatewayConfirmed && bot.EnemyRace == Race.Protoss && Expanded.Get().Detected) { NoProxyGatewayConfirmed = true; } if (!NoProxyGatewayConfirmed && bot.EnemyRace == Race.Protoss) { foreach (Unit unit in bot.Enemies()) { if (unit.UnitType == UnitTypes.GATEWAY && SC2Util.DistanceSq(bot.MapAnalyzer.StartLocation, unit.Pos) >= 40 * 40) { NoProxyGatewayConfirmed = true; break; } } } }
public override void OnFrame(Bot bot) { if (FourRaxSuspected && Gas() >= 200) { GasWorkerTask.WorkersPerGas = 1; } else if (FourRaxSuspected && Minerals() <= 200 && Count(UnitTypes.STALKER) < 10) { GasWorkerTask.WorkersPerGas = 2; } else { BalanceGas(); } if (WorkerScoutTask.Task.BaseCircled()) { WorkerScoutTask.Task.Stopped = true; WorkerScoutTask.Task.Clear(); } CloakedBanshee = TotalEnemyCount(UnitTypes.BANSHEE) > 0; WaitForDetectionController.Stopped = !CloakedBanshee; bot.DrawText("CloakedBanshee: " + CloakedBanshee); WorkerScoutTask.Task.StartFrame = 600; ObserverScoutTask.Task.Priority = 6; /* * if (TotalEnemyCount(UnitTypes.BANSHEE) > 0 || FourRaxSuspected) * ForwardProbeTask.Task.Stopped = true; * else if (Completed(UnitTypes.IMMORTAL) >= 2) * ForwardProbeTask.Task.Stopped = false; * else if (Completed(UnitTypes.STALKER) + Count(UnitTypes.IMMORTAL) < 4) * ForwardProbeTask.Task.Stopped = true; * * if (ForwardProbeTask.Task.Stopped) * ForwardProbeTask.Task.Clear(); */ bot.NexusAbilityManager.Stopped = Count(UnitTypes.STALKER) == 0 && bot.Frame >= 120 * 22.4; bot.NexusAbilityManager.PriotitizedAbilities.Add(917); if (bot.EnemyStrategyAnalyzer.Count(UnitTypes.BATTLECRUISER) > 0) { BattlecruisersDetected = true; } if (FourRax.Get().Detected) { FourRaxSuspected = true; } if (ProxyDetected.Get().Detected) { FourRaxSuspected = true; } if (WorkerScoutTask.Task.BaseCircled() && bot.Frame < 22.4 * 60 * 2 && TotalEnemyCount(UnitTypes.BARRACKS) == 0) { FourRaxSuspected = true; } if (!FourRaxSuspected) { Point2D enemyRamp = bot.MapAnalyzer.GetEnemyRamp(); int enemyBarrackWallCount = 0; foreach (Unit enemy in bot.Enemies()) { if (enemyRamp == null) { break; } if (enemy.UnitType == UnitTypes.BARRACKS && SC2Util.DistanceSq(enemy.Pos, enemyRamp) <= 5.5 * 5.5) { enemyBarrackWallCount++; } } if (enemyBarrackWallCount >= 2) { WorkerScoutTask.Task.Stopped = true; WorkerScoutTask.Task.Clear(); FourRaxSuspected = true; } } if (FourRaxSuspected) { bot.TargetManager.TargetAllBuildings = true; FallBackController.Stopped = true; } bot.TargetManager.SkipPlanetaries = true; ForceFieldRampTask.Task.Stopped = !FourRaxSuspected || Completed(UnitTypes.STALKER) >= 18; if (ForceFieldRampTask.Task.Stopped) { ForceFieldRampTask.Task.Clear(); } if (FourRaxSuspected && Completed(UnitTypes.STALKER) < 10) { foreach (Agent agent in bot.Units()) { if (agent.Unit.UnitType != UnitTypes.NEXUS) { continue; } if (agent.Unit.BuildProgress >= 0.99) { continue; } agent.Order(Abilities.CANCEL); } } bot.DrawText("Defending units: " + DefenseTask.GroundDefenseTask.Units.Count); bot.DrawText("Is defending: " + DefenseTask.GroundDefenseTask.IsDefending()); if (FourRaxSuspected) { TimingAttackTask.Task.RequiredSize = 18; } else { TimingAttackTask.Task.RequiredSize = 4; TimingAttackTask.Task.RetreatSize = 0; } foreach (WorkerDefenseTask task in WorkerDefenseTask.Tasks) { task.Stopped = Completed(UnitTypes.ZEALOT) >= 5; } if (bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.REAPER) >= 3 || bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.BANSHEE) > 0) { TimingAttackTask.Task.DefendOtherAgents = false; } if (Count(UnitTypes.NEXUS) <= 1) { IdleTask.Task.OverrideTarget = OverrideMainDefenseTarget; } else if (Count(UnitTypes.NEXUS) >= 3) { IdleTask.Task.OverrideTarget = OverrideDefenseTarget; } else { IdleTask.Task.OverrideTarget = null; } if (FourRaxSuspected && Completed(UnitTypes.STALKER) < 18) { DefenseTask.GroundDefenseTask.BufferZone = 0; DefenseTask.GroundDefenseTask.ExpandDefenseRadius = 20; DefenseTask.GroundDefenseTask.MainDefenseRadius = 20; DefenseTask.GroundDefenseTask.MaxDefenseRadius = 120; DefenseTask.GroundDefenseTask.DrawDefenderRadius = 80; } else { DefenseTask.GroundDefenseTask.ExpandDefenseRadius = 30; DefenseTask.GroundDefenseTask.MainDefenseRadius = 30; DefenseTask.GroundDefenseTask.MaxDefenseRadius = 120; DefenseTask.GroundDefenseTask.DrawDefenderRadius = 80; } DefenseTask.AirDefenseTask.ExpandDefenseRadius = 30; DefenseTask.AirDefenseTask.MainDefenseRadius = 30; DefenseTask.AirDefenseTask.MaxDefenseRadius = 120; DefenseTask.AirDefenseTask.DrawDefenderRadius = 80; if (EarlyPool.Get().Detected&& !Expanded.Get().Detected&& Completed(UnitTypes.ZEALOT) < 2) { foreach (Agent agent in bot.UnitManager.Agents.Values) { if (agent.Unit.UnitType == UnitTypes.NEXUS && agent.Unit.BuildProgress < 0.99) { agent.Order(Abilities.CANCEL); } } } }
public override void OnFrame(Bot bot) { /* * if (bot.Frame == 0) * { * FileUtil.WriteToFile("ArmyAnalysis.txt", "Started game against " + bot.OpponentID + " on map " + bot.GameInfo.MapName, false); * FileUtil.WriteToFile("ArmyAnalysis.txt", "", false); * } * if (bot.Frame % 224 == 0) * { * List<uint> myUnitTypes = new List<uint>() { UnitTypes.ZEALOT, UnitTypes.ADEPT, UnitTypes.STALKER, UnitTypes.ARCHON, UnitTypes.IMMORTAL, UnitTypes.COLOSUS }; * List<uint> enemyUnitTypes = new List<uint>() { UnitTypes.ZERGLING, UnitTypes.QUEEN, UnitTypes.BANELING, UnitTypes.ROACH, UnitTypes.RAVAGER, UnitTypes.HYDRALISK, UnitTypes.MUTALISK, UnitTypes.CORRUPTOR, UnitTypes.BROOD_LORD, UnitTypes.LURKER}; * * List<string> myUnitResults = new List<string>(); * foreach (uint myUnitType in myUnitTypes) * { * int completed = Completed(myUnitType); * if (completed == 0) * continue; * myUnitResults.Add(UnitTypes.LookUp[myUnitType].Name + ":" + completed); * } * List<string> enemyUnitResults = new List<string>(); * foreach (uint enemyUnitType in enemyUnitTypes) * { * int completed = EnemyCount(enemyUnitType); * if (completed == 0) * continue; * enemyUnitResults.Add(UnitTypes.LookUp[enemyUnitType].Name + ":" + completed); * } * * * FileUtil.WriteToFile("ArmyAnalysis.txt", "State at: " + (int)((bot.Frame / 22.4) / 60) + ":" + (int)(bot.Frame / 22.4) % 60, false); * FileUtil.WriteToFile("ArmyAnalysis.txt", "MyUnits: {" + string.Join(", ", myUnitResults) + "}", false); * FileUtil.WriteToFile("ArmyAnalysis.txt", "EnemyUnits: {" + string.Join(", ", enemyUnitResults) + "}", false); * FileUtil.WriteToFile("ArmyAnalysis.txt", "SimulationResult me: " + bot.TaskManager.CombatSimulation.MyStartResources + "-> " + bot.TaskManager.CombatSimulation.MyFinalResources + " his: " + bot.TaskManager.CombatSimulation.EnemyStartResources + "-> " + bot.TaskManager.CombatSimulation.EnemyFinalResources, false); * FileUtil.WriteToFile("ArmyAnalysis.txt", "", false); * * } */ if (!EnemyAttackPerformed && (EarlyPool.Get().Detected || RoachRushDetected)) { int enemyCount = 0; foreach (Unit enemy in bot.Enemies()) { if (enemy.UnitType != UnitTypes.ZERGLING && enemy.UnitType != UnitTypes.ROACH) { continue; } if (SC2Util.DistanceSq(enemy.Pos, bot.MapAnalyzer.StartLocation) <= 60 * 60) { enemyCount += enemy.UnitType == UnitTypes.ZERGLING ? 1 : 3; } } if (enemyCount > 6) { EnemyAttackPerformed = true; } } FearSpinesController.Stopped = Completed(UnitTypes.IMMORTAL) >= 2; ScoutTask.Task.ScoutType = UnitTypes.PHOENIX; ScoutTask.Task.Target = bot.TargetManager.PotentialEnemyStartLocations[0]; if (!TimingAttackTask.Task.AttackSent) { foreach (Agent agent in bot.Units()) { if (agent.Unit.UnitType != UnitTypes.SENTRY) { continue; } if (agent.Unit.Energy < 75) { continue; } // Hallucinate scouting phoenix. agent.Order(154); } } bot.DrawText("early pool detected: " + EarlyPool.Get().Detected); if (EarlyPool.Get().Detected) { AdeptHarassMainTask.Task.Sent = true; } if (!ActiveHatchery) { foreach (Unit enemy in Bot.Main.Enemies()) { if (enemy.UnitType != UnitTypes.HATCHERY) { continue; } if (enemy.IsActive) { ActiveHatchery = true; } break; } } if (!RoachRushDetected && CounterRoaches) { if (Bot.Main.Frame < 22.4 * 60 * 4.5 && TotalEnemyCount(UnitTypes.ROACH_WARREN) > 0) { RoachRushDetected = true; } if (Bot.Main.Frame < 22.4 * 60 * 2.5 && TotalEnemyCount(UnitTypes.LAIR) > 0) { RoachRushDetected = true; } if (Bot.Main.Frame < 22.4 * 60 * 2.5 && ActiveHatchery && EarlyPool.Get().Detected) { RoachRushDetected = true; } else if (Bot.Main.Frame < 22.4 * 60 * 5 && TotalEnemyCount(UnitTypes.ROACH) > 0) { RoachRushDetected = true; } else if (Bot.Main.Frame < 22.4 * 60 * 5 && EnemyCount(UnitTypes.ROACH_WARREN) > 0) { foreach (Unit enemy in bot.Enemies()) { if (enemy.UnitType == UnitTypes.ROACH_WARREN && enemy.BuildProgress > 0.99) { RoachRushDetected = true; break; } } } } RoboArmy = RoachRushDetected || TotalEnemyCount(UnitTypes.ROACH) + TotalEnemyCount(UnitTypes.RAVAGER) + TotalEnemyCount(UnitTypes.HYDRALISK) >= 15; bot.DrawText("RoboArmy: " + RoboArmy); if (!WarpPrismTask.Task.WarpInObjectiveSet() && TimingAttackTask.Task.Units.Count > 0 && Bot.Main.Frame % 112 == 0) { int desiredZealots = Math.Min(Minerals() / 100, Math.Min(Completed(UnitTypes.WARP_GATE), 10 - Count(UnitTypes.ZEALOT))); if (desiredZealots > 0) { WarpPrismTask.Task.AddWarpInObjective(UnitTypes.ZEALOT, desiredZealots); } } //if (Minerals() >= 600) // InitialAttackDone = true; if (!InitialAttackDone && TimingAttackTask.Task.AttackSent) { int immortalArchonCount = 0; foreach (Agent agent in TimingAttackTask.Task.Units) { if (agent.Unit.UnitType == UnitTypes.ARCHON || agent.Unit.UnitType == UnitTypes.IMMORTAL) { immortalArchonCount++; } } if (immortalArchonCount <= 1) { InitialAttackDone = true; for (int i = TimingAttackTask.Task.Units.Count - 1; i >= 0; i--) { if (TimingAttackTask.Task.Units[i].Unit.UnitType == UnitTypes.IMMORTAL || TimingAttackTask.Task.Units[i].Unit.UnitType == UnitTypes.ARCHON) { TimingAttackTask.Task.ClearAt(i); } } } } if (!InitialRoachCounterDone && RoachRushDetected && TimingAttackTask.Task.AttackSent) { if (Completed(UnitTypes.STALKER) + Completed(UnitTypes.ZEALOT) + Completed(UnitTypes.IMMORTAL) + Completed(UnitTypes.ARCHON) + Completed(UnitTypes.COLOSUS) < 8) { InitialRoachCounterDone = true; } } ArchonMergeTask.Task.StopAndClear(InitialAttackDone && Count(UnitTypes.ARCHON) >= 3); for (int i = IdleTask.Task.Units.Count - 1; i >= 0; i--) { Agent agent = IdleTask.Task.Units[i]; if (TimingAttackTask.Task.Units.Count > 0 && UnitTypes.CombatUnitTypes.Contains(agent.Unit.UnitType) && agent.DistanceSq(Main.BaseLocation.Pos) >= 50 * 50) { IdleTask.Task.RemoveAt(i); TimingAttackTask.Task.Add(agent); } } //if (EnemyCount(UnitTypes.ZERGLING) >= 20) FallBackController.Stopped = true; if (RoachRushDetected) { BalanceGas(); } else if (Bot.Main.Frame < 22.4 * 60 * 2 && Count(UnitTypes.NEXUS) < 2) { GasWorkerTask.WorkersPerGas = 1; } else if (Bot.Main.Frame < 22.4 * 60 * 2 && Count(UnitTypes.ASSIMILATOR) < 2) { GasWorkerTask.WorkersPerGas = 2; } else { BalanceGas(); } bool gatewayExists = false; foreach (Agent agent in Bot.Main.Units()) { if (agent.Unit.UnitType == UnitTypes.GATEWAY || agent.Unit.UnitType == UnitTypes.WARP_GATE) { gatewayExists = true; } } if (gatewayExists && Count(UnitTypes.ASSIMILATOR) == 0) { ConstructionTask.Task.DedicatedNaturalProbe = false; if (ConstructionTask.Task.NaturalProbe != null && !WorkerScoutTask.Task.Done && WorkerScoutTask.Task.Units.Count == 0) { for (int i = 0; i < ConstructionTask.Task.Units.Count; i++) { if (ConstructionTask.Task.Units[i] == ConstructionTask.Task.NaturalProbe) { ConstructionTask.Task.RemoveAt(i); WorkerScoutTask.Task.Add(ConstructionTask.Task.NaturalProbe); ConstructionTask.Task.NaturalProbe = null; break; } } } } else { ConstructionTask.Task.DedicatedNaturalProbe = Count(UnitTypes.CYBERNETICS_CORE) == 0; } if (ProxyPylon && ProxyTask.Task.UnitCounts.ContainsKey(UnitTypes.PYLON) && ProxyTask.Task.UnitCounts[UnitTypes.PYLON] > 0) { ProxyPylon = false; ProxyTask.Task.Stopped = true; ProxyTask.Task.Clear(); } int wallDone = 0; foreach (WallBuilding building in WallIn.Wall) { if (!BuildingType.LookUp.ContainsKey(building.Type)) { wallDone++; continue; } foreach (Agent agent in bot.UnitManager.Agents.Values) { if (agent.DistanceSq(building.Pos) <= 1 * 1) { wallDone++; break; } } } // Cancel nexus when the enemy has an early pool. if ((EarlyPool.Get().Detected&& !Expanded.Get().Detected&& Completed(UnitTypes.ZEALOT) + Completed(UnitTypes.ADEPT) < 2 && !RoachRushDetected) || (RoachRushDetected && Completed(UnitTypes.IMMORTAL) == 0)) { CancelBuilding(UnitTypes.NEXUS); } //StutterForwardController.Stopped = Count(UnitTypes.NEXUS) >= 3 || TimingAttackTask.Task.Units.Count > 0 || Completed(UnitTypes.ZEALOT) > 0; StutterForwardController.Stopped = true; HodorTask.Task.Stopped = Count(UnitTypes.NEXUS) >= 3 || TimingAttackTask.Task.Units.Count > 0 || wallDone < WallIn.Wall.Count || Completed(UnitTypes.HIGH_TEMPLAR) + Count(UnitTypes.ARCHON) > 0 || (Count(UnitTypes.ADEPT) >= 2 && !AdeptHarassMainTask.Task.Sent) || (EnemyCount(UnitTypes.ZERGLING) == 0 && EnemyCount(UnitTypes.ROACH) > 0 || EnemyCount(UnitTypes.NYDUS_CANAL) > 0); if (HodorTask.Task.Stopped) { HodorTask.Task.Clear(); } if (CounterRoaches) { WorkerScoutTask.Task.StopAndClear((!gatewayExists || WorkerScoutTask.Task.BaseCircled()) && (!EarlyPool.Get().Detected || RoachRushDetected)); } else { WorkerScoutTask.Task.StopAndClear((!gatewayExists || WorkerScoutTask.Task.BaseCircled())); } if (WallIn.Wall.Count >= 5) { HodorTask.Task.Target = WallIn.Wall[2].Pos; } else { HodorTask.Task.Stopped = true; HodorTask.Task.Clear(); } foreach (Agent agent in bot.UnitManager.Agents.Values) { if (bot.Frame % 224 != 0) { break; } if (agent.Unit.UnitType != UnitTypes.GATEWAY) { continue; } if (Count(UnitTypes.NEXUS) < 3 && TimingAttackTask.Task.Units.Count == 0 && (Count(UnitTypes.ADEPT) < 2 || AdeptHarassMainTask.Task.Sent)) { agent.Order(Abilities.MOVE, Natural.BaseLocation.Pos); } else { agent.Order(Abilities.MOVE, bot.TargetManager.PotentialEnemyStartLocations[0]); } } if (!MassZerglings && !EarlyPool.Get().Detected && bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.ZERGLING) >= 60 && bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.ROACH) == 0 && bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.HYDRALISK) == 0) { MassZerglings = true; //TimingAttackTask.Task.Clear(); } bot.DrawText("Zergling count: " + bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.ZERGLING)); ObserverScoutTask.Task.Priority = 6; if (EarlyPool.Get().Detected) { bot.NexusAbilityManager.Stopped = Count(UnitTypes.ZEALOT) == 0; bot.NexusAbilityManager.PriotitizedAbilities.Add(TrainingType.LookUp[UnitTypes.ZEALOT].Ability); } else { bot.NexusAbilityManager.OnlyChronoPrioritizedUnits = Count(UnitTypes.CYBERNETICS_CORE) > 0 && !AdeptHarassMainTask.Task.Sent; bot.NexusAbilityManager.Stopped = Count(UnitTypes.ADEPT) + Count(UnitTypes.ZEALOT) + Count(UnitTypes.IMMORTAL) + Count(UnitTypes.ARCHON) == 0 && Count(UnitTypes.CYBERNETICS_CORE) > 0; bot.NexusAbilityManager.PriotitizedAbilities.Add(TrainingType.LookUp[UnitTypes.ADEPT].Ability); } bot.DrawText("TimingAttackTask: " + TimingAttackTask.Task.Units.Count + "/" + TimingAttackTask.Task.RequiredSize); bot.DrawText("GroundDefense: " + DefenseTask.GroundDefenseTask.Units.Count); bot.DrawText("Roach rush: " + RoachRushDetected); bot.DrawText("InitialRoachCounterDone : " + InitialRoachCounterDone); if (RoachRushDetected) { if (InitialRoachCounterDone) { TimingAttackTask.Task.RequiredSize = 30; } else { TimingAttackTask.Task.RequiredSize = 12; } } else if (InitialAttackDone) { TimingAttackTask.Task.RequiredSize = 30; } else if (EarlyPool.Get().Detected && !Expanded.Get().Detected) { TimingAttackTask.Task.RequiredSize = 24; } else if (Completed(UnitTypes.ARCHON) < 3) { TimingAttackTask.Task.RequiredSize = 24; } else { TimingAttackTask.Task.RequiredSize = 10; } TimingAttackTask.Task.RetreatSize = 0; foreach (WorkerDefenseTask task in WorkerDefenseTask.Tasks) { task.Stopped = Completed(UnitTypes.ZEALOT) + Completed(UnitTypes.IMMORTAL) + Completed(UnitTypes.ADEPT) >= 2; } if (bot.Frame >= 22.4 * 60 * 2.75 && bot.Frame <= 22.4 * 60 * 4.75 && !EnemyAttackPerformed && (EarlyPool.Get().Detected || RoachRushDetected) && DefendNydus) { IdleTask.Task.OverrideTarget = NydusPos; } else if (Count(UnitTypes.NEXUS) >= 3 || (Completed(UnitTypes.HIGH_TEMPLAR) + Count(UnitTypes.ARCHON) > 0) || (Count(UnitTypes.ADEPT) >= 2 && !AdeptHarassMainTask.Task.Sent)) { IdleTask.Task.OverrideTarget = OverrideDefenseTarget; } else { IdleTask.Task.OverrideTarget = NaturalDefensePos; } ArchonMergeTask.Task.MergePos = OverrideDefenseTarget; if (RoachRushDetected && (Completed(UnitTypes.IMMORTAL) == 0 || Completed(UnitTypes.IMMORTAL) + Completed(UnitTypes.STALKER) < 6)) { DefenseTask.GroundDefenseTask.BufferZone = 0; DefenseTask.GroundDefenseTask.ExpandDefenseRadius = 30; DefenseTask.GroundDefenseTask.MainDefenseRadius = 30; DefenseTask.GroundDefenseTask.MaxDefenseRadius = 120; DefenseTask.GroundDefenseTask.DrawDefenderRadius = 80; } else { DefenseTask.GroundDefenseTask.BufferZone = 5; DefenseTask.GroundDefenseTask.ExpandDefenseRadius = 30; DefenseTask.GroundDefenseTask.MainDefenseRadius = EarlyPool.Get().Detected ? 50 : 30; DefenseTask.GroundDefenseTask.MaxDefenseRadius = 120; DefenseTask.GroundDefenseTask.DrawDefenderRadius = 80; } DefenseTask.AirDefenseTask.ExpandDefenseRadius = 30; DefenseTask.AirDefenseTask.MainDefenseRadius = 30; DefenseTask.AirDefenseTask.MaxDefenseRadius = 120; DefenseTask.AirDefenseTask.DrawDefenderRadius = 80; }
public override void OnFrame(Bot bot) { if (SpinePushDetected) { TimingAttackTask.Task.RequiredSize = 30; TimingAttackTask.Task.RetreatSize = 10; } else { TimingAttackTask.Task.RequiredSize = 45; TimingAttackTask.Task.RetreatSize = 15; } MorphingTask.Task.Priority = 10; if (!SmellCheese || Completed(UnitTypes.ROACH) >= 10 || Natural.Owner == bot.PlayerId) { IdleTask.Task.OverrideTarget = null; } else { IdleTask.Task.OverrideTarget = Main.BaseLocation.Pos; } if (SmellCheese && Completed(UnitTypes.ROACH) < 15) { DefenseTask.GroundDefenseTask.MainDefenseRadius = 20; DefenseTask.GroundDefenseTask.ExpandDefenseRadius = 20; DefenseTask.GroundDefenseTask.MaxDefenseRadius = 120; DefenseTask.AirDefenseTask.MainDefenseRadius = 20; DefenseTask.AirDefenseTask.ExpandDefenseRadius = 20; DefenseTask.AirDefenseTask.MaxDefenseRadius = 120; foreach (WorkerDefenseTask task in WorkerDefenseTask.Tasks) { task.DefenseRadius = 8; } } else { IdleTask.Task.OverrideTarget = null; DefenseTask.GroundDefenseTask.MainDefenseRadius = 30; DefenseTask.GroundDefenseTask.ExpandDefenseRadius = 30; DefenseTask.GroundDefenseTask.MaxDefenseRadius = 120; DefenseTask.AirDefenseTask.MainDefenseRadius = 30; DefenseTask.AirDefenseTask.ExpandDefenseRadius = 30; DefenseTask.AirDefenseTask.MaxDefenseRadius = 120; } foreach (WorkerDefenseTask task in WorkerDefenseTask.Tasks) { task.Stopped = SmellCheese && (Completed(UnitTypes.SPINE_CRAWLER) >= 2 || Completed(UnitTypes.ROACH) >= 4 || Completed(UnitTypes.ZERGLING) >= 10); } if (!SpinePushDetected && SmellCheese) { foreach (Unit enemy in bot.Enemies()) { if (enemy.UnitType != UnitTypes.QUEEN && enemy.UnitType != UnitTypes.SPINE_CRAWLER && enemy.UnitType != UnitTypes.SPINE_CRAWLER_UPROOTED) { continue; } if (SC2Util.DistanceSq(enemy.Pos, bot.MapAnalyzer.StartLocation) <= 50 * 50) { SpinePushDetected = true; break; } } } if (Completed(UnitTypes.DRONE) <= 10) { GasWorkerTask.WorkersPerGas = 0; } else { BalanceGas(); } //SmellCheese = EarlyPool.Get().Detected && !Expanded.Get().Detected && Completed(UnitTypes.ROACH) < 2; if (Bot.Main.EnemyStrategyAnalyzer.TotalCount(UnitTypes.ZERGLING) >= 5 && bot.Frame <= 22.4 * 60 * 2) { SmellCheese = true; } if (Bot.Main.EnemyStrategyAnalyzer.Count(UnitTypes.SPAWNING_POOL) > 0 && bot.Frame <= 22.4 * 60 * 1.4 && !Expanded.Get().Detected) { SmellCheese = true; } if (SmellCheese && Count(UnitTypes.ROACH) + Count(UnitTypes.RAVAGER) < 13) { /* * TimingAttackTask.RetreatSize = 5; * TimingAttackTask.RequiredSize = 25; */ foreach (Agent agent in bot.UnitManager.Agents.Values) { if (agent.Unit.UnitType == UnitTypes.HATCHERY && agent.Unit.BuildProgress < 0.99) { agent.Order(Abilities.CANCEL); } } } if (bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.MUTALISK) + bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.BROOD_LORD) + bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.CORRUPTOR) + bot.EnemyStrategyAnalyzer.Count(UnitTypes.SPIRE) + bot.EnemyStrategyAnalyzer.Count(UnitTypes.GREATER_SPIRE) > 0) { NeedAntiAir = true; } if (Completed(UnitTypes.ROACH_WARREN) > 0 && Count(UnitTypes.RAVAGER) < 8 && Count(UnitTypes.RAVAGER) < Completed(UnitTypes.ROACH) - 8 && (!SmellCheese || Completed(UnitTypes.HATCHERY) >= 2)) { MorphingTask.Task.Morph(UnitTypes.RAVAGER); } if (bot.EnemyStrategyAnalyzer.Count(UnitTypes.QUEEN) + bot.EnemyStrategyAnalyzer.Count(UnitTypes.HYDRALISK) + bot.EnemyStrategyAnalyzer.Count(UnitTypes.MUTALISK) + bot.EnemyStrategyAnalyzer.Count(UnitTypes.CORRUPTOR) > 0 || bot.Frame >= 22.4 * 60 * 5) { OverlordScoutTask.Task.Stopped = true; OverlordScoutTask.Task.Clear(); } bool saveForUpgrades = Completed(UnitTypes.EVOLUTION_CHAMBER) >= 2 && Minerals() < 200 && Gas() < 200 && Count(UnitTypes.ROACH) >= 5 && ((!Bot.Main.Observation.Observation.RawData.Player.UpgradeIds.Contains(57) && !Bot.Main.UnitManager.ActiveOrders.Contains(1190) && !Bot.Main.UnitManager.ActiveOrders.Contains(1189)) || (!Bot.Main.Observation.Observation.RawData.Player.UpgradeIds.Contains(60) && !Bot.Main.UnitManager.ActiveOrders.Contains(1192) && !Bot.Main.UnitManager.ActiveOrders.Contains(1193))); }