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); }
public override Build OverrideBuild() { if (EnemyMain == null) { EnemyMain = Bot.Main.TargetManager.PotentialEnemyStartLocations[0]; } if (!InBaseBarracks && !Proxy) { foreach (Unit unit in Bot.Main.Enemies()) { if (unit.UnitType != UnitTypes.BARRACKS && unit.UnitType != UnitTypes.FACTORY) { continue; } if (SC2Util.DistanceSq(unit.Pos, EnemyMain) <= 40 * 40) { InBaseBarracks = true; } else { Proxy = true; } } } if (InBaseBarracks) { if (PvTStalkerImmortal == null) { PvTStalkerImmortal = new PvTStalkerImmortal(); PvTStalkerImmortal.OnStart(Bot.Main); PvTStalkerImmortal.InitializeTasks(); } return(PvTStalkerImmortal); } else { if (OneBaseStalkerImmortal == null) { OneBaseStalkerImmortal = new OneBaseStalkerImmortal() { Scouting = true }; OneBaseStalkerImmortal.OnStart(Bot.Main); OneBaseStalkerImmortal.InitializeTasks(); } return(OneBaseStalkerImmortal); } }