public override void OnFrame(Tyr tyr) { TimingAttackTask.Task.RequiredSize = RequiredSize; TimingAttackTask.Task.UnitType = UnitTypes.TEMPEST; tyr.buildingPlacer.BuildCompact = true; float Z = 0; foreach (Agent agent in tyr.Units()) { Z = System.Math.Max(Z, agent.Unit.Pos.Z); } tyr.DrawSphere(new SC2APIProtocol.Point() { X = WallIn.Wall[3].Pos.X, Y = WallIn.Wall[3].Pos.Y, Z = Z }); DefenseTask.GroundDefenseTask.MainDefenseRadius = 40; DefenseTask.GroundDefenseTask.DrawDefenderRadius = 100; if (tyr.Frame % 224 == 0) { foreach (Agent agent in tyr.UnitManager.Agents.Values) { if (agent.Unit.UnitType == UnitTypes.GATEWAY) { agent.Order(Abilities.MOVE, Natural.BaseLocation.Pos); break; } } } }
public void OnFrame(Tyr tyr) { foreach (Agent agent in tyr.Units()) { if (agent.PreviousUnit == null) { continue; } float damageTaken = agent.PreviousUnit.Health + agent.PreviousUnit.Shield - agent.Unit.Health - agent.Unit.Shield; if (damageTaken < 17.5) { continue; } bool cycloneClose = false; int enemiesClose = 0; foreach (Unit enemy in Tyr.Bot.Enemies()) { if (!UnitTypes.CombatUnitTypes.Contains(enemy.UnitType)) { continue; } if (agent.DistanceSq(enemy) > 15.5 * 15.5) { continue; } enemiesClose++; if (enemy.UnitType == UnitTypes.CYCLONE) { cycloneClose = true; } } if (cycloneClose && enemiesClose < 8) { CollectionUtil.Set(LastHitFrame, agent.Unit.Tag, tyr.Frame); } } }
public override void OnFrame(Tyr tyr) { TimingAttackTask.Task.DefendOtherAgents = false; if (TotalEnemyCount(UnitTypes.BANSHEE) == 0 && Completed(UnitTypes.IMMORTAL) >= (DoubleRobo ? 4 : 2)) { TimingAttackTask.Task.RequiredSize = 4; } else { TimingAttackTask.Task.RequiredSize = RequiredSize; } if (!ImmortalNearEnemy) { foreach (Agent agent in tyr.Units()) { if (agent.Unit.UnitType == UnitTypes.IMMORTAL && agent.DistanceSq(tyr.TargetManager.PotentialEnemyStartLocations[0]) <= 20 * 20) { ImmortalNearEnemy = true; } } } tyr.DrawText("Immortal near enemey: " + ImmortalNearEnemy); if (AggressiveMicro && (ImmortalNearEnemy || tyr.Frame >= 22.4 * 60 * 5) && EnemyCount(UnitTypes.ZEALOT) == 0) { StutterForwardController.Stopped = false; StutterController.Stopped = true; } else { StutterForwardController.Stopped = true; StutterController.Stopped = false; } KillImmortals.Stopped = EnemyCount(UnitTypes.ZEALOT) >= 0; KillStalkers.Stopped = EnemyCount(UnitTypes.ZEALOT) >= 0; ScoutTask.Task.ScoutType = UnitTypes.PHOENIX; ScoutTask.Task.Target = tyr.TargetManager.PotentialEnemyStartLocations[0]; if (Count(UnitTypes.PHOENIX) > 0) { PhoenixScoutSent = true; } if (!PhoenixScoutSent && tyr.EnemyRace != SC2APIProtocol.Race.Zerg) { foreach (Agent agent in tyr.Units()) { if (agent.Unit.UnitType != UnitTypes.SENTRY) { continue; } if (agent.Unit.Energy < 75) { continue; } // Hallucinate scouting phoenix. agent.Order(154); } } }
public override void OnFrame(Tyr tyr) { WorkerTask.Task.EvacuateThreatenedBases = true; if ((FourGateDetected || DoubleRoboAllIn) && Completed(UnitTypes.IMMORTAL) < 2) { foreach (Agent agent in tyr.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 tyr.UnitManager.Agents.Values) { if (tyr.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, tyr.TargetManager.PotentialEnemyStartLocations[0]); } } if (EnemyCount(UnitTypes.PHOENIX) <= 3) { DefenseTask.AirDefenseTask.IgnoreEnemyTypes.Add(UnitTypes.PHOENIX); } else { DefenseTask.AirDefenseTask.IgnoreEnemyTypes.Remove(UnitTypes.PHOENIX); } if (tyr.EnemyStrategyAnalyzer.WorkerRushDetected && 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 = tyr.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 tyr.Units()) { if (agent.Unit.UnitType != UnitTypes.SENTRY) { continue; } if (agent.Unit.Energy < 75) { continue; } // Hallucinate scouting phoenix. agent.Order(154); } } if (tyr.EnemyStrategyAnalyzer.WorkerRushDetected && Count(UnitTypes.ZEALOT) < 2) { foreach (Agent agent in tyr.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 && tyr.Frame < 22.4 * 60 * 4) { FourGateDetected = true; } if (TotalEnemyCount(UnitTypes.VOID_RAY) + TotalEnemyCount(UnitTypes.STARGATE) + TotalEnemyCount(UnitTypes.ORACLE) > 0) { FourGateDetected = false; } tyr.TargetManager.TargetCannons = true; if (WorkerScoutTask.Task.BaseCircled()) { WorkerScoutTask.Task.Stopped = true; WorkerScoutTask.Task.Clear(); } WorkerScoutTask.Task.StartFrame = 600; ObserverScoutTask.Task.Priority = 6; tyr.NexusAbilityManager.Stopped = Count(UnitTypes.STALKER) == 0 && tyr.Frame >= 120 * 22.4; tyr.NexusAbilityManager.PriotitizedAbilities.Add(917); if (EnemyExpandFrame >= 1000000 && tyr.EnemyStrategyAnalyzer.Expanded) { EnemyExpandFrame = tyr.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(Tyr tyr) { if (!ChatMessageSent) { if (Completed(UnitTypes.TEMPEST) > 0) { tyr.Chat("This build is dedicated to Andyman!"); ChatMessageSent = true; } } if (HideLocation == null) { HideLocation = ProxyTask.Task.GetHideLocation(); } if (HideLocation != null) { if (ProxyTask.Task.UnitCounts.ContainsKey(UnitTypes.PYLON) && ProxyTask.Task.UnitCounts[UnitTypes.PYLON] > 0 && ProxyTask.Task.UnitCounts.ContainsKey(UnitTypes.STARGATE) && ProxyTask.Task.UnitCounts[UnitTypes.STARGATE] > 0) { float dist = 10 * 10; Unit fleeEnemy = null; foreach (Unit enemy in tyr.Enemies()) { if (!UnitTypes.CanAttackAir(enemy.UnitType)) { continue; } float newDist = SC2Util.DistanceSq(enemy.Pos, HideLocation); if (newDist > dist) { continue; } dist = newDist; fleeEnemy = enemy; } if (fleeEnemy != null) { TempestController.RetreatPos = new PotentialHelper(HideLocation, 6).From(fleeEnemy.Pos).Get(); } else { TempestController.RetreatPos = HideLocation; } } else { TempestController.RetreatPos = null; } } if (TempestController.RetreatPos == null) { TempestController.RetreatPos = ProxyTask.Task.GetHideLocation(); } DepoweredStargates = 0; foreach (Agent agent in tyr.Units()) { if (agent.Unit.UnitType == UnitTypes.STARGATE && !agent.Unit.IsPowered && agent.Unit.BuildProgress >= 0.99) { DepoweredStargates++; } } tyr.DrawText("DepoweredStargates: " + DepoweredStargates); tyr.NexusAbilityManager.PriotitizedAbilities.Add(1568); ProxyTask.Task.EvadeEnemies = true; tyr.buildingPlacer.BuildCompact = true; tyr.TargetManager.PrefferDistant = false; tyr.TargetManager.TargetAllBuildings = true; TrainStep.WarpInLocation = ProxyTask.Task.GetHideLocation(); DefendRegionTask.Task.DefenseLocation = ProxyTask.Task.GetHideLocation(); TimingAttackTask.Task.RequiredSize = 1; TimingAttackTask.Task.RetreatSize = 0; TimingAttackTask.Task.UnitType = UnitTypes.TEMPEST; if (tyr.Frame >= 22.4 * 60 * 4) { ProxyTask.Task.Stopped = true; } else { ProxyTask.Task.Stopped = Count(UnitTypes.GATEWAY) == 0; if (ProxyTask.Task.Stopped) { ProxyTask.Task.Clear(); } } if (UpgradeType.LookUp[UpgradeType.WarpGate].Progress() >= 0.5 && IdleTask.Task.OverrideTarget == null && (tyr.EnemyRace != Race.Protoss || tyr.Frame >= 22.4 * 4 * 60)) { IdleTask.Task.OverrideTarget = tyr.MapAnalyzer.Walk(ProxyTask.Task.GetHideLocation(), tyr.MapAnalyzer.EnemyDistances, 10); } foreach (Agent agent in tyr.UnitManager.Agents.Values) { if (tyr.Frame % 224 != 0) { break; } if (agent.Unit.UnitType != UnitTypes.GATEWAY) { continue; } agent.Order(Abilities.MOVE, agent.From(tyr.MapAnalyzer.GetMainRamp(), 4)); } }
public override void OnFrame(Tyr tyr) { WorkerTask.Task.EvacuateThreatenedBases = true; foreach (Agent agent in tyr.UnitManager.Agents.Values) { if (tyr.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, tyr.TargetManager.PotentialEnemyStartLocations[0]); } } if (TotalEnemyCount(UnitTypes.ZEALOT) >= 3 || EnemyCount(UnitTypes.PHOTON_CANNON) > 0) { KillImmortals.Stopped = true; KillStalkers.Stopped = true; KillRobos.Stopped = true; } else { KillImmortals.Stopped = false; KillStalkers.Stopped = false; KillRobos.Stopped = false; } EnemyArmy = System.Math.Max(EnemyArmy, EnemyCount(UnitTypes.ZEALOT) + EnemyCount(UnitTypes.STALKER)); tyr.DrawText("Enemy army: " + EnemyArmy); if (EnemyCount(UnitTypes.PHOENIX) <= 3) { DefenseTask.AirDefenseTask.IgnoreEnemyTypes.Add(UnitTypes.PHOENIX); } else { DefenseTask.AirDefenseTask.IgnoreEnemyTypes.Remove(UnitTypes.PHOENIX); } if (tyr.EnemyStrategyAnalyzer.WorkerRushDetected && Count(UnitTypes.ZEALOT) < 2) { GasWorkerTask.WorkersPerGas = 0; } else { BalanceGas(); } if (TotalEnemyCount(UnitTypes.FORGE) > 0 && tyr.Frame <= 22.4 * 60 * 2) { EarlyForgeDetected = true; } ScoutTask.Task.ScoutType = UnitTypes.PHOENIX; ScoutTask.Task.Target = tyr.TargetManager.PotentialEnemyStartLocations[0]; if (CannonDefenseDetected && TotalEnemyCount(UnitTypes.STARGATE) + TotalEnemyCount(UnitTypes.DARK_SHRINE) + TotalEnemyCount(UnitTypes.VOID_RAY) == 0) { foreach (Agent agent in tyr.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 && !tyr.EnemyStrategyAnalyzer.WorkerRushDetected) { if ((Tyr.Bot.Frame >= 22.4 * 60 * 1.5 && !Tyr.Bot.EnemyStrategyAnalyzer.NoProxyGatewayConfirmed && TotalEnemyCount(UnitTypes.ASSIMILATOR) + TotalEnemyCount(UnitTypes.CYBERNETICS_CORE) == 0) || (Tyr.Bot.Frame < 22.4 * 60 * 1.5 && Tyr.Bot.EnemyStrategyAnalyzer.ThreeGateDetected)) { ZealotRushSuspected = true; } } if (!LowGroundCannons) { foreach (Unit enemy in tyr.Enemies()) { if (enemy.UnitType != UnitTypes.PHOTON_CANNON) { continue; } if (tyr.MapAnalyzer.MapHeight((int)enemy.Pos.X, (int)enemy.Pos.Y) < tyr.MapAnalyzer.MapHeight((int)tyr.TargetManager.PotentialEnemyStartLocations[0].X, (int)tyr.TargetManager.PotentialEnemyStartLocations[0].Y)) { LowGroundCannons = true; break; } } } if (!CannonDefenseDetected && TotalEnemyCount(UnitTypes.PHOTON_CANNON) + TotalEnemyCount(UnitTypes.FORGE) > 0 && tyr.Frame < 22.4 * 60 * 4 && (EarlyForgeDetected || tyr.EnemyStrategyAnalyzer.Expanded || LowGroundCannons)) { CannonDefenseDetected = true; if (TimingAttackTask.Task.Units.Count < 12) { TimingAttackTask.Task.Clear(); } } if (tyr.EnemyStrategyAnalyzer.WorkerRushDetected && Count(UnitTypes.ZEALOT) < 2) { foreach (Agent agent in tyr.UnitManager.Agents.Values) { if (agent.Unit.UnitType == UnitTypes.ASSIMILATOR && agent.Unit.BuildProgress < 0.99) { agent.Order(Abilities.CANCEL); } } } tyr.TargetManager.TargetCannons = true; if (ZealotRushSuspected) { tyr.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 tyr.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; tyr.NexusAbilityManager.Stopped = Count(UnitTypes.STALKER) == 0 && tyr.Frame >= 120 * 22.4; tyr.NexusAbilityManager.PriotitizedAbilities.Add(917); if (EnemyExpandFrame >= 1000000 && tyr.EnemyStrategyAnalyzer.Expanded) { EnemyExpandFrame = tyr.Frame; } if (EnemyExpandFrame < 3 * 60 * 22.4) { EarlyExpand = true; } if (VoidraysDetected || (TotalEnemyCount(UnitTypes.PHOTON_CANNON) + TotalEnemyCount(UnitTypes.FORGE) > 0 && !LowGroundCannons && !EarlyExpand)) { TimingAttackTask.Task.RequiredSize = 24; } else if (ZealotRushSuspected || (CannonDefenseDetected && EarlyExpand)) { TimingAttackTask.Task.RequiredSize = 12; } else { TimingAttackTask.Task.RequiredSize = 4; } TimingAttackTask.Task.RetreatSize = 0; if (EnemyCount(UnitTypes.ZEALOT) + EnemyCount(UnitTypes.STALKER) >= 6 && tyr.Frame < 22.4 * 60 * 5) { CancelElevator = true; WarpPrismElevatorTask.Task.Cancelled = true; } if (EnemyCount(UnitTypes.IMMORTAL) + EnemyCount(UnitTypes.VOID_RAY) > 0) { CancelElevator = true; WarpPrismElevatorTask.Task.Cancelled = true; } if (TotalEnemyCount(UnitTypes.PHOTON_CANNON) + TotalEnemyCount(UnitTypes.FORGE) > 0 && !LowGroundCannons && !EarlyExpand && TimingAttackTask.Task.Units.Count < 18 && TimingAttackTask.Task.RequiredSize > 18) { TimingAttackTask.Task.Clear(); } if (CannonDefenseDetected && !CancelElevator) { TimingAttackTask.Task.Stopped = true; TimingAttackTask.Task.Clear(); ShieldRegenTask.Task.Stopped = true; ShieldRegenTask.Task.Clear(); WarpPrismElevatorTask.Task.Stopped = false; tyr.TargetManager.PrefferDistant = false; tyr.TargetManager.TargetAllBuildings = true; PotentialHelper potential = new PotentialHelper(tyr.TargetManager.PotentialEnemyStartLocations[0], 6); potential.From(tyr.MapAnalyzer.GetEnemyRamp()); StutterController.Toward = potential.Get(); tyr.DrawSphere(new Point() { X = StutterController.Toward.X, Y = StutterController.Toward.Y, Z = tyr.MapAnalyzer.StartLocation.Z }); EvadeCannonsController.Stopped = Completed(UnitTypes.STALKER) + Completed(UnitTypes.IMMORTAL) >= 12; EvadeCannonsController.FleeToward = StutterController.Toward; FallBackController.Stopped = true; } else { TimingAttackTask.Task.Stopped = false; WarpPrismElevatorTask.Task.Stopped = true; tyr.TargetManager.PrefferDistant = true; ShieldRegenTask.Task.Stopped = false; tyr.TargetManager.TargetAllBuildings = false; StutterController.Toward = null; EvadeCannonsController.Stopped = true; 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; } //EarlyNexus = CannonDefenseDetected; EarlyNexus = false; StargateDetected = TotalEnemyCount(UnitTypes.STARGATE) + TotalEnemyCount(UnitTypes.VOID_RAY) + TotalEnemyCount(UnitTypes.PHOENIX) + TotalEnemyCount(UnitTypes.TEMPEST) + TotalEnemyCount(UnitTypes.CARRIER) + TotalEnemyCount(UnitTypes.FLEET_BEACON) > 0; }
public void OnFrame(Tyr tyr) { foreach (Agent observer in tyr.Units()) { if (observer.Unit.UnitType != UnitTypes.OBSERVER) { continue; } if (BansheeLocation != null && Tyr.Bot.Frame - BansheeSeenFrame < 22.4 * 10 && observer.DistanceSq(BansheeLocation) <= 4 * 4) { BansheeSeenFrame = -1000000; } if (LastHitLocation != null && Tyr.Bot.Frame - LastHitFrame < 22.4 * 20 && observer.DistanceSq(LastHitLocation) <= 4 * 4) { LastHitFrame = -1000000; } } float dist = 40 * 40; if (Tyr.Bot.Frame - BansheeSeenFrame < 22.4 * 10) { dist = SC2Util.DistanceSq(BansheeLocation, tyr.MapAnalyzer.StartLocation); } foreach (Unit enemy in tyr.Enemies()) { if (enemy.UnitType != UnitTypes.BANSHEE) { continue; } float newDist = SC2Util.DistanceSq(enemy.Pos, tyr.MapAnalyzer.StartLocation); if (newDist > dist) { continue; } BansheeLocation = SC2Util.To2D(enemy.Pos); BansheeSeenFrame = tyr.Frame; dist = newDist; } foreach (Agent agent in tyr.Units()) { if (agent.PreviousUnit == null) { continue; } float damageTaken = agent.PreviousUnit.Health + agent.PreviousUnit.Shield - agent.Unit.Health - agent.Unit.Shield; if (damageTaken < 9) { continue; } if (agent.DistanceSq(Tyr.Bot.MapAnalyzer.StartLocation) > 50 * 50) { continue; } bool enemyClose = false; foreach (Unit enemy in Tyr.Bot.Enemies()) { if (!UnitTypes.CombatUnitTypes.Contains(enemy.UnitType)) { continue; } if (agent.DistanceSq(enemy) > 15.5 * 15.5) { continue; } enemyClose = true; break; } if (enemyClose) { continue; } LastHitLocation = SC2Util.To2D(agent.Unit.Pos); LastHitFrame = tyr.Frame; } }
public override void OnFrame(Tyr tyr) { BalanceGas(); ReaperDefenseTask.Stopped = Completed(UnitTypes.STALKER) < 4 || TimingAttackTask.Task.AttackSent || Completed(UnitTypes.PHOENIX) > 0; if (ReaperDefenseTask.Stopped) { ReaperDefenseTask.Clear(); } if (ReaperDefenseTask.Stopped) { DefenseTask.GroundDefenseTask.IgnoreEnemyTypes.Remove(UnitTypes.REAPER); } else { DefenseTask.GroundDefenseTask.IgnoreEnemyTypes.Add(UnitTypes.REAPER); } tyr.NexusAbilityManager.Stopped = Count(UnitTypes.STALKER) == 0; tyr.NexusAbilityManager.PriotitizedAbilities.Add(917); if (TotalEnemyCount(UnitTypes.BANSHEE) > 0) { StutterForwardController.Stopped = false; StutterController.Stopped = true; } else { StutterForwardController.Stopped = true; StutterController.Stopped = false; } SaveWorkersTask.Task.Stopped = tyr.Frame >= 22.4 * 60 * 7 || EnemyCount(UnitTypes.CYCLONE) == 0 || !Natural.UnderAttack; if (SaveWorkersTask.Task.Stopped) { SaveWorkersTask.Task.Clear(); } if (tyr.Observation.Chat != null && SendAirUnitsText == -1) { foreach (ChatReceived chat in tyr.Observation.Chat) { if (chat.PlayerId == tyr.PlayerId) { continue; } if (chat.Message.ToLower().Contains("air")) { SendAirUnitsText = tyr.Frame + 67; } } } if (tyr.Frame == SendAirUnitsText) { tyr.Chat("Yes, I am going for air units! How do you like my Phoenixes? :D"); } foreach (Agent agent in tyr.Units()) { if (LiftedTextSent) { break; } if (agent.Unit.UnitType != UnitTypes.PHOENIX) { continue; } if (agent.PreviousUnit == null) { continue; } if (agent.PreviousUnit.Energy - agent.Unit.Energy >= 45) { LiftedTextSent = true; tyr.Chat("I love your micro! Those flying Cyclones look especially scary!"); } } foreach (ActionError error in tyr.Observation.ActionErrors) { DebugUtil.WriteLine("Error with ability " + error.AbilityId + ": " + error.Result); } if (!MedivacsSpotted && EnemyCount(UnitTypes.MEDIVAC) > 0) { MedivacsSpotted = true; MedivacsSpottedFrame = tyr.Frame; } DefenseTask.GroundDefenseTask.IncludePhoenixes = EnemyCount(UnitTypes.CYCLONE) > 0; if (MedivacsSpotted && tyr.Frame - MedivacsSpottedFrame <= 22.4 * 30) { IdleTask.Task.OverrideTarget = DefendDropsPos; DefenseTask.AirDefenseTask.IgnoreEnemyTypes.Add(UnitTypes.MEDIVAC); } else { IdleTask.Task.OverrideTarget = null; DefenseTask.AirDefenseTask.IgnoreEnemyTypes.Remove(UnitTypes.MEDIVAC); } WorkerTask.Task.EvacuateThreatenedBases = true; if (!BansheesDetected && tyr.Frame >= 22.4 * 60 * 6 && tyr.Frame < 22.4 * 60 * 9.5 && !MedivacsSpotted) { TimedObserverTask.Task.Target = ScoutingPylonPos; TimedObserverTask.Task.Priority = 11; } else { if (Tyr.Bot.Frame - tyr.EnemyBansheesManager.BansheeSeenFrame <= 22.4 * 10 && tyr.EnemyBansheesManager.BansheeLocation != null) { TimedObserverTask.Task.Target = tyr.EnemyBansheesManager.BansheeLocation; } else if (Tyr.Bot.Frame - tyr.EnemyBansheesManager.LastHitFrame <= 22.4 * 20) { TimedObserverTask.Task.Target = tyr.EnemyBansheesManager.LastHitLocation; } else { TimedObserverTask.Task.Target = SC2Util.To2D(tyr.MapAnalyzer.StartLocation); } TimedObserverTask.Task.Priority = 3; } TimingAttackTask.Task.DefendOtherAgents = false; TimingAttackTask.Task.RequiredSize = 25; TimingAttackTask.Task.RetreatSize = 0; if (!BansheesDetected && TotalEnemyCount(UnitTypes.BANSHEE) > 0) { BansheesDetected = true; } if (!BansheesDetected && TotalEnemyCount(UnitTypes.STARPORT_TECH_LAB) + TotalEnemyCount(UnitTypes.STARPORT) > 0 && tyr.Frame < 22.4 * 60 * 5) { BansheesDetected = true; } 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 (BansheesDetected && EnemyCount(UnitTypes.VIKING_ASSUALT) + EnemyCount(UnitTypes.VIKING_FIGHTER) >= 3) { BuildTempest = true; } tyr.TargetManager.SkipPlanetaries = true; }
public override void OnFrame(Tyr tyr) { 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; tyr.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(); */ tyr.NexusAbilityManager.Stopped = Count(UnitTypes.STALKER) == 0 && tyr.Frame >= 120 * 22.4; tyr.NexusAbilityManager.PriotitizedAbilities.Add(917); if (tyr.EnemyStrategyAnalyzer.Count(UnitTypes.BATTLECRUISER) > 0) { BattlecruisersDetected = true; } if (tyr.EnemyStrategyAnalyzer.FourRaxDetected) { FourRaxSuspected = true; } if (ProxyDetected.Get().Detected) { FourRaxSuspected = true; } if (WorkerScoutTask.Task.BaseCircled() && tyr.Frame < 22.4 * 60 * 2 && TotalEnemyCount(UnitTypes.BARRACKS) == 0) { FourRaxSuspected = true; } if (!FourRaxSuspected) { Point2D enemyRamp = tyr.MapAnalyzer.GetEnemyRamp(); int enemyBarrackWallCount = 0; foreach (Unit enemy in tyr.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) { tyr.TargetManager.TargetAllBuildings = true; FallBackController.Stopped = true; } tyr.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 tyr.Units()) { if (agent.Unit.UnitType != UnitTypes.NEXUS) { continue; } if (agent.Unit.BuildProgress >= 0.99) { continue; } agent.Order(Abilities.CANCEL); } } tyr.DrawText("Defending units: " + DefenseTask.GroundDefenseTask.Units.Count); tyr.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 (tyr.EnemyStrategyAnalyzer.TotalCount(UnitTypes.REAPER) >= 3 || tyr.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 (Tyr.Bot.EnemyStrategyAnalyzer.EarlyPool && !Tyr.Bot.EnemyStrategyAnalyzer.Expanded && Completed(UnitTypes.ZEALOT) < 2) { foreach (Agent agent in tyr.UnitManager.Agents.Values) { if (agent.Unit.UnitType == UnitTypes.NEXUS && agent.Unit.BuildProgress < 0.99) { agent.Order(Abilities.CANCEL); } } } }
public override void OnFrame(Tyr tyr) { DetermineCannonLocation(); if (CannonLocation == null) { return; } bool firstPylonDone = false; bool secondPylonDone = false; Point2D firstPylonPos = new Point2D() { X = CannonLocation.X + 1, Y = CannonLocation.Y - 1 }; Point2D secondPylonPos = new Point2D() { X = CannonLocation.X + 1, Y = CannonLocation.Y + 1 }; bool firstCannonDone = false; bool secondCannonDone = false; Point2D firstCannonPos = new Point2D() { X = CannonLocation.X - 1, Y = CannonLocation.Y - 1 }; Point2D secondCannonPos = new Point2D() { X = CannonLocation.X - 1, Y = CannonLocation.Y + 1 }; bool powerAvailable = false; bool cannonCover = false; int totalCannonCount = 0; foreach (Agent agent in tyr.Units()) { if (agent.Unit.UnitType == UnitTypes.PYLON) { if (agent.DistanceSq(firstPylonPos) <= 2) { firstPylonDone = true; if (agent.Unit.BuildProgress >= 0.99) { powerAvailable = true; } } else if (agent.DistanceSq(secondPylonPos) <= 2) { secondPylonDone = true; if (agent.Unit.BuildProgress >= 0.99) { powerAvailable = true; } } } if (agent.Unit.UnitType == UnitTypes.PHOTON_CANNON) { if (agent.DistanceSq(CannonLocation) <= 30 * 30) { totalCannonCount++; } if (agent.DistanceSq(firstCannonPos) <= 2) { firstCannonDone = true; if (agent.Unit.BuildProgress >= 0.99) { cannonCover = true; } } else if (agent.DistanceSq(secondCannonPos) <= 2) { secondCannonDone = true; if (agent.Unit.BuildProgress >= 0.99) { cannonCover = true; } } else if (NextCannonLocation != null && agent.DistanceSq(NextCannonLocation) <= 2) { NextCannonLocation = null; } } } if (firstCannonDone && secondCannonDone && cannonCover && totalCannonCount < 4 && NextCannonLocation == null) { NextCannonLocation = tyr.buildingPlacer.FindPlacement(new PotentialHelper(CannonLocation, 5).To(tyr.TargetManager.PotentialEnemyStartLocations[0]).Get(), new Point2D() { X = 2, Y = 2 }, UnitTypes.PHOTON_CANNON); } foreach (Agent agent in Units) { if (agent.DistanceSq(CannonLocation) >= 20 * 20) { agent.Order(Abilities.MOVE, CannonLocation); continue; } if (!firstPylonDone) { agent.Order(881, firstPylonPos); continue; } if (!secondPylonDone) { agent.Order(881, secondPylonPos); continue; } if (!firstCannonDone) { agent.Order(887, firstCannonPos); continue; } if (!secondCannonDone) { agent.Order(887, secondCannonPos); continue; } if (NextCannonLocation != null) { agent.Order(887, NextCannonLocation); continue; } } }
public override void OnFrame(Tyr tyr) { TimingAttackTask.Task.DefendOtherAgents = false; TimingAttackTask.Task.RequiredSize = RequiredSize; if (!PylonPlaced) { foreach (Agent agent in tyr.UnitManager.Agents.Values) { if (agent.Unit.UnitType == UnitTypes.PYLON && SC2Util.DistanceSq(agent.Unit.Pos, tyr.MapAnalyzer.StartLocation) >= 40 * 40) { PylonPlaced = true; PlacePylonTask.Task.Clear(); PlacePylonTask.Task.Stopped = true; } } } foreach (Agent agent in tyr.Units()) { if (agent.Unit.UnitType != UnitTypes.PHOENIX) { continue; } if (EnemyThird != null && agent.DistanceSq(EnemyThird) <= 8 * 8) { ThirdScouted = true; } if (agent.DistanceSq(tyr.TargetManager.PotentialEnemyStartLocations[0]) <= 8 * 8) { MainScouted = true; } } ScoutTask.Task.ScoutType = UnitTypes.PHOENIX; if (EnemyNatural == null) { EnemyNatural = tyr.MapAnalyzer.GetEnemyNatural().Pos; } if (EnemyThird == null) { EnemyThird = tyr.MapAnalyzer.GetEnemyThird().Pos; } if (!ThirdScouted) { ScoutTask.Task.Target = EnemyThird; } else if (!MainScouted) { ScoutTask.Task.Target = tyr.TargetManager.PotentialEnemyStartLocations[0]; } else { ScoutTask.Task.Target = EnemyNatural; } if (Count(UnitTypes.PHOENIX) > 0) { PhoenixScoutSent = true; } if (!PhoenixScoutSent) { foreach (Agent agent in tyr.Units()) { if (agent.Unit.UnitType != UnitTypes.SENTRY) { continue; } if (agent.Unit.Energy < 75) { continue; } // Hallucinate scouting phoenix. agent.Order(154); } } }