Ejemplo n.º 1
0
        public override void OnFrame(Tyr tyr)
        {
            if (RepairTarget == null)
            {
                Clear();
                return;
            }
            List <Agent>            unassignedSCVs   = new List <Agent>();
            Dictionary <ulong, int> alreadyRepairing = new Dictionary <ulong, int>();

            foreach (Agent agent in Units)
            {
                agent.Order(316, RepairTarget.Unit.Tag);
            }
        }
Ejemplo n.º 2
0
 public override void OnFrame(Tyr tyr)
 {
     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.Clear();
                 PlacePylonTask.Stopped = true;
             }
         }
     }
 }
Ejemplo n.º 3
0
 public override void OnFrame(Tyr tyr)
 {
     for (int i = 0; i < units.Count - 1; i++)
     {
         if (MergePos != null &&
             (units[i].DistanceSq(MergePos) >= 2 * 2 || units[i + 1].DistanceSq(MergePos) >= 2 * 2))
         {
             units[i].Order(Abilities.MOVE, MergePos);
             units[i + 1].Order(Abilities.MOVE, MergePos);
         }
         else
         {
             units[i].ArchonMerge(units[i + 1]);
         }
     }
 }
Ejemplo n.º 4
0
        public override void OnFrame(Tyr tyr)
        {
            foreach (Agent agent in units)
            {
                agent.Order(Abilities.MORPH_LURKER);
            }

            for (int i = units.Count - 1; i >= 0; i--)
            {
                if (units[i].Unit.UnitType != UnitTypes.HYDRALISK)
                {
                    IdleTask.Task.Add(units[i]);
                    units.RemoveAt(i);
                }
            }
        }
Ejemplo n.º 5
0
        public override void OnStart(Tyr tyr)
        {
            tyr.TaskManager.Add(new DefenseTask());
            tyr.TaskManager.Add(new TimingAttackTask()
            {
                RequiredSize = RequiredSize
            });
            tyr.TaskManager.Add(new WorkerScoutTask());
            if (ProxyPylon)
            {
                tyr.TaskManager.Add(PlacePylonTask);
            }

            Set += ProtossBuildUtil.Pylons();
            Set += BuildGateways();
        }
Ejemplo n.º 6
0
 public override void OnFrame(Tyr tyr)
 {
     TimingAttackTask.Task.ExcludeUnitTypes.Add(UnitTypes.HELLION);
     if (Completed(UnitTypes.MARINE) >= 20)
     {
         TimingAttackTask.Task.ExcludeUnitTypes.Remove(UnitTypes.MARINE);
         TimingAttackTask.Task.ExcludeUnitTypes.Remove(UnitTypes.SIEGE_TANK);
     }
     else
     {
         TimingAttackTask.Task.ExcludeUnitTypes.Add(UnitTypes.MARINE);
         TimingAttackTask.Task.ExcludeUnitTypes.Add(UnitTypes.SIEGE_TANK);
     }
     TimingAttackTask.Task.RequiredSize = 3;
     TimingAttackTask.Task.RetreatSize  = 0;
 }
Ejemplo n.º 7
0
 public override void OnFrame(Tyr tyr)
 {
     for (int i = units.Count - 1; i >= 0; i--)
     {
         Agent agent = units[i];
         if (agent.DistanceSq(HideBaseTask.Task.HideLocation.BaseLocation.Pos) <= 20 * 20)
         {
             IdleTask.Task.Add(agent);
             units.RemoveAt(i);
         }
         else
         {
             agent.Order(Abilities.MOVE, HideBaseTask.Task.HideLocation.BaseLocation.Pos);
         }
     }
 }
Ejemplo n.º 8
0
 public override void Produce(Tyr tyr, Agent agent)
 {
     if (UnitTypes.ResourceCenters.Contains(agent.Unit.UnitType))
     {
         if (Minerals() >= 100 && Completed(UnitTypes.QUEEN) == 0 &&
             Completed(UnitTypes.SPAWNING_POOL) > 0)
         {
             agent.Order(1632);
         }
         else if (Tyr.Bot.EnemyStrategyAnalyzer.LiftingDetected &&
                  Minerals() >= 150 && Gas() >= 100)
         {
             agent.Order(1216);
         }
     }
 }
Ejemplo n.º 9
0
        public override void OnStart(Tyr tyr)
        {
            MicroControllers.Add(new ZerglingController());
            MicroControllers.Add(new StutterController());
            MicroControllers.Add(new InfestorController());
            MicroControllers.Add(new DodgeBallController());
            MicroControllers.Add(new QueenTransfuseController());
            TimingAttackTask.Task.CustomControllers.Add(new SoftLeashController(UnitTypes.ZERGLING, UnitTypes.HYDRALISK, 12));

            Set += ZergBuildUtil.Overlords();
            Set += WorkerRushDefense();
            Set += Tech();
            Set += Hydralisks();
            Set += Zerglings();
            Set += MainBuild();
        }
Ejemplo n.º 10
0
 public override void OnFrame(Tyr tyr)
 {
     RepairTask.Task.WallIn = WallIn;
     if (tyr.EnemyStrategyAnalyzer.TotalCount(UnitTypes.ZERGLING) >= 20)
     {
         TimingAttackTask.Task.RequiredSize = 20;
     }
     else
     {
         TimingAttackTask.Task.RequiredSize = 10;
     }
     foreach (Task task in WorkerDefenseTask.Tasks)
     {
         task.Stopped = tyr.EnemyStrategyAnalyzer.TotalCount(UnitTypes.ZERGLING) >= 10;
     }
 }
Ejemplo n.º 11
0
        public override void OnFrame(Tyr tyr)
        {
            TimingAttackTask.Task.DefendOtherAgents = false;
            if (Completed(UnitTypes.PHOENIX) >= 2)
            {
                TimingAttackTask.Task.RequiredSize = 12;
            }
            else
            {
                TimingAttackTask.Task.RequiredSize = 20;
            }

            tyr.buildingPlacer.BuildCompact = true;

            DefenseTask.GroundDefenseTask.IncludePhoenixes = EnemyCount(UnitTypes.CYCLONE) > 0;
        }
Ejemplo n.º 12
0
 public override void OnFrame(Tyr tyr)
 {
     foreach (Agent agent in units)
     {
         if (agent.DistanceSq(Target) <= 0.1)
         {
             if (Tyr.Bot.Frame % 23 == 0)
             {
                 agent.Order(18);
             }
         }
         else
         {
             agent.Order(Abilities.ATTACK, Target);
         }
     }
 }
Ejemplo n.º 13
0
        public override void OnFrame(Tyr tyr)
        {
            if (units.Count >= 2)
            {
                units[0].ArchonMerge(units[1]);
            }

            for (int i = units.Count - 1; i >= 0; i--)
            {
                if (units[i].Unit.UnitType != UnitTypes.DARK_TEMPLAR &&
                    units[i].Unit.UnitType != UnitTypes.HIGH_TEMPLAR)
                {
                    IdleTask.Task.Add(units[i]);
                    units.RemoveAt(i);
                }
            }
        }
Ejemplo n.º 14
0
        public override void Produce(Tyr tyr, Agent agent)
        {
            if (agent.Unit.UnitType == UnitTypes.NEXUS &&
                Minerals() >= 50 &&
                (!WorkerRushTask.Stopped || Count(UnitTypes.PROBE) < 20))
            {
                agent.Order(1006);
            }

            if (agent.Unit.UnitType == UnitTypes.STARGATE &&
                Minerals() >= 250 &&
                Gas() >= 150 &&
                FoodUsed() + 4 <= 200)
            {
                agent.Order(950);
            }
        }
Ejemplo n.º 15
0
 public override void OnStart(Tyr tyr)
 {
     MicroControllers.Add(new HitAndRunController());
     MicroControllers.Add(new TargetFireController(GetPriorities()));
     tyr.TaskManager.Add(TimingAttackTask);
     if (tyr.EnemyRace != Race.Protoss)
     {
         tyr.TaskManager.Add(new WorkerScoutTask());
     }
     tyr.TaskManager.Add(new QueenInjectTask(Main));
     tyr.TaskManager.Add(new QueenDefenseTask());
     tyr.TaskManager.Add(new DefenseTask()
     {
         MainDefenseRadius = 20, ExpandDefenseRadius = 15, MaxDefenseRadius = 55
     });
     Set += MainBuild();
 }
Ejemplo n.º 16
0
        public void ExecuteGatherDefenders(Tyr tyr)
        {
            if (mineral == null && tyr.BaseManager.Main.BaseLocation.MineralFields.Count > 0)
            {
                mineral = tyr.BaseManager.Main.BaseLocation.MineralFields[0];
            }

            foreach (Agent agent in Units)
            {
                agent.Order(Abilities.MOVE, mineral.Tag);
            }

            if (tyr.Frame >= GatherDefendersStartFrame + 112)
            {
                State = Defend;
            }
        }
Ejemplo n.º 17
0
        public override void OnFrame(Tyr tyr)
        {
            foreach (Agent agent in units)
            {
                bool closeEnemy = false;
                if (RaiseWall != null)
                {
                    foreach (WallBuilding building in RaiseWall.Wall)
                    {
                        if (SC2Util.DistanceSq(building.Pos, agent.Unit.Pos) < 2)
                        {
                            closeEnemy = true;
                            break;
                        }
                    }
                }

                if (!closeEnemy)
                {
                    foreach (Unit enemy in tyr.Enemies())
                    {
                        if (agent.DistanceSq(enemy) <= 10 * 10 &&
                            !enemy.IsFlying &&
                            enemy.UnitType != UnitTypes.REAPER &&
                            enemy.UnitType != UnitTypes.ADEPT_PHASE_SHIFT &&
                            enemy.UnitType != UnitTypes.KD8_CHARGE &&
                            !UnitTypes.ChangelingTypes.Contains(enemy.UnitType) &&
                            !UnitTypes.WorkerTypes.Contains(enemy.UnitType))
                        {
                            closeEnemy = true;
                            break;
                        }
                    }
                }
                if (agent.Unit.UnitType == UnitTypes.SUPPLY_DEPOT &&
                    !closeEnemy)
                {
                    agent.Order(556);
                }
                else if (agent.Unit.UnitType != UnitTypes.SUPPLY_DEPOT &&
                         closeEnemy)
                {
                    agent.Order(558);
                }
            }
        }
Ejemplo n.º 18
0
        public override void OnFrame(Tyr tyr)
        {
            if (!GetWorkerRushHappening())
            {
                Clear();
                return;
            }

            if (State == GatherDefenders)
            {
                ExecuteGatherDefenders(tyr);
            }
            else
            {
                ExecuteDefend(tyr);
            }
        }
Ejemplo n.º 19
0
        public override void OnFrame(Tyr tyr)
        {
            for (int i = Units.Count - 1; i >= 0; i--)
            {
                Agent agent = Units[i];
                if (agent.DistanceSq(tyr.MapAnalyzer.StartLocation) > 15 * 15)
                {
                    continue;
                }
                ClearAt(i);
            }

            foreach (Agent agent in units)
            {
                agent.Order(Abilities.MOVE, SC2Util.To2D(tyr.MapAnalyzer.StartLocation));
            }
        }
Ejemplo n.º 20
0
        public override void OnFrame(Tyr tyr)
        {
            if (Units.Count > 0)
            {
                tyr.DrawText("Defending workers: " + Units.Count);
            }
            if (target == null)
            {
                Clear();
                return;
            }

            while (Units.Count > desiredDefenders)
            {
                IdleTask.Task.Add(PopAt(Units.Count - 1));
            }

            // Remove probes whose shields have depleted.
            if (tyr.MyRace == Race.Protoss)
            {
                for (int i = units.Count - 1; i >= 0; i--)
                {
                    if (units[i].Unit.Shield <= 1)
                    {
                        IdleTask.Task.Add(units[i]);
                        units[i] = units[units.Count - 1];
                        units.RemoveAt(units.Count - 1);
                    }
                }
            }
            // Remove low health workers.
            for (int i = units.Count - 1; i >= 0; i--)
            {
                if (units[i].Unit.Shield + units[i].Unit.Health <= 5)
                {
                    IdleTask.Task.Add(units[i]);
                    units[i] = units[units.Count - 1];
                    units.RemoveAt(units.Count - 1);
                }
            }

            foreach (Agent agent in units)
            {
                agent.Order(Abilities.ATTACK, SC2Util.To2D(target.Pos));
            }
        }
Ejemplo n.º 21
0
        public void OnStart(Tyr tyr)
        {
            float   dist       = 0;
            Point2D crossSpawn = null;

            foreach (Point2D enemy in tyr.TargetManager.PotentialEnemyStartLocations)
            {
                int enemyDist = (int)SC2Util.DistanceSq(enemy, tyr.MapAnalyzer.StartLocation);
                if (enemyDist > dist)
                {
                    crossSpawn = enemy;
                    dist       = enemyDist;
                }
            }

            int[,] enemyDistances = tyr.MapAnalyzer.Distances(crossSpawn);
        }
Ejemplo n.º 22
0
        public override void OnFrame(Tyr tyr)
        {
            if (units.Count <= RetreatSize)
            {
                Clear();
                return;
            }
            Agent defendAgent = null;

            if (DefendOtherAgents)
            {
                foreach (Agent agent in units)
                {
                    foreach (Unit enemy in tyr.Enemies())
                    {
                        if (!UnitTypes.CombatUnitTypes.Contains(enemy.UnitType))
                        {
                            continue;
                        }

                        if (SC2Util.DistanceSq(agent.Unit.Pos, enemy.Pos) <= 9 * 9)
                        {
                            defendAgent = agent;
                            break;
                        }
                    }
                    if (defendAgent != null)
                    {
                        break;
                    }
                }
            }

            foreach (Agent agent in units)
            {
                if (defendAgent != null && SC2Util.DistanceSq(agent.Unit.Pos, defendAgent.Unit.Pos) >= 3 * 3 && SC2Util.DistanceSq(agent.Unit.Pos, defendAgent.Unit.Pos) <= 40 * 40)
                {
                    tyr.MicroController.Attack(agent, SC2Util.To2D(defendAgent.Unit.Pos));
                }
                else
                {
                    tyr.MicroController.Attack(agent, tyr.TargetManager.AttackTarget);
                }
            }
        }
Ejemplo n.º 23
0
        public override void OnFrame(Tyr tyr)
        {
            if (tyr.EnemyStrategyAnalyzer.CannonRushDetected)
            {
                attackTask.RequiredSize = 5;
            }
            else if (Completed(UnitTypes.IMMORTAL) >= 4)
            {
                attackTask.RequiredSize = 15;
            }
            else
            {
                attackTask.RequiredSize = 20;
            }

            attackTask.RetreatSize = Tyr.Bot.EnemyRace == Race.Terran ? 0 : 6;

            attackTask.DefendOtherAgents = false;

            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;

            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);
                    }
                }
            }
        }
Ejemplo n.º 24
0
        public override void OnFrame(Tyr tyr)
        {
            if (units.Count <= RetreatSize)
            {
                CurrentState = State.Advance;
                Clear();
                return;
            }

            bool canAttackGround = false;

            foreach (Agent agent in Units)
            {
                if (agent.CanAttackGround())
                {
                    canAttackGround = true;
                }
            }

            if (!canAttackGround)
            {
                CurrentState = State.Advance;
                Clear();
                return;
            }

            tyr.DrawText("SiegeTask state: " + CurrentState);

            if (CurrentState == State.Advance)
            {
                Advance(tyr);
            }
            else if (CurrentState == State.SiegeUp)
            {
                SiegeUp(tyr);
            }
            else if (CurrentState == State.LeapFrog)
            {
                LeapFrog(tyr);
            }
            else if (CurrentState == State.Kill)
            {
                Kill(tyr);
            }
        }
Ejemplo n.º 25
0
 public override void Produce(Tyr tyr, Agent agent)
 {
     if (UnitTypes.ResourceCenters.Contains(agent.Unit.UnitType))
     {
         if (Count(UnitTypes.SCV) < 16 &&
             Minerals() >= 50)
         {
             agent.Order(524);
         }
     }
     else if (agent.Unit.UnitType == UnitTypes.BARRACKS)
     {
         if (Minerals() >= 50)
         {
             agent.Order(560);
         }
     }
 }
Ejemplo n.º 26
0
        public override void OnStart(Tyr tyr)
        {
            tyr.TaskManager.Add(new DefenseTask());
            tyr.TaskManager.Add(attackTask);
            tyr.TaskManager.Add(new WorkerScoutTask());
            tyr.TaskManager.Add(new ObserverScoutTask());
            tyr.TaskManager.Add(new OracleHarassTask());
            if (tyr.BaseManager.Pocket != null)
            {
                tyr.TaskManager.Add(new ScoutProxyTask(tyr.BaseManager.Pocket.BaseLocation.Pos));
            }
            MicroControllers.Add(new StutterController());
            MicroControllers.Add(new HTController());

            Set += ProtossBuildUtil.Pylons();
            Set += Nexii();
            Set += MainBuild();
        }
Ejemplo n.º 27
0
        public override void OnStart(Tyr tyr)
        {
            MicroControllers.Add(new CorruptorController());
            MicroControllers.Add(new QueenTransfuseController());
            MicroControllers.Add(new InfestorController());
            MicroControllers.Add(new KillParasitedController());
            MicroControllers.Add(new InfestorController());
            MicroControllers.Add(StutterController);
            MicroControllers.Add(StutterForwardController);

            Set += ZergBuildUtil.Overlords();
            Set += DTSpores();
            Set += ReaperSpines();
            Set += BansheeSpores();
            Set += DefendFourRax();
            Set += Units();
            Set += AntiLifting();
        }
Ejemplo n.º 28
0
        public override void OnFrame(Tyr tyr)
        {
            TimingAttackTask.Task.RequiredSize = RequiredSize;

            tyr.NexusAbilityManager.PriotitizedAbilities.Add(TrainingType.LookUp[UnitTypes.ORACLE].Ability);

            HideUnitsTask.Task.UnitType = UnitTypes.ORACLE;
            if (Completed(UnitTypes.ORACLE) >= 6 || tyr.EnemyStrategyAnalyzer.TotalCount(UnitTypes.ZERGLING) >= 10)
            {
                HideUnitsTask.Task.Stopped = true;
                HideUnitsTask.Task.Clear();
            }
            if (Completed(UnitTypes.ORACLE) >= 6)
            {
                OraclesDone = true;
            }
            HideUnitsTask.Task.Target = SC2Util.To2D(tyr.MapAnalyzer.StartLocation);
        }
Ejemplo n.º 29
0
        public override void OnFrame(Tyr tyr)
        {
            if (units.Count == 0)
            {
                return;
            }

            if (Target == null)
            {
                Clear();
                return;
            }

            foreach (Agent agent in units)
            {
                agent.Order(Abilities.ATTACK, Target.Tag);
            }
        }
Ejemplo n.º 30
0
 public override void OnFrame(Tyr tyr)
 {
     foreach (Agent agent in units)
     {
         if (agent.FleeEnemies(false))
         {
             continue;
         }
         Attack(agent, tyr.TargetManager.AttackTarget);
     }
     for (int i = units.Count - 1; i >= 0; i--)
     {
         if (units[i].Unit.Shield >= units[i].Unit.ShieldMax / 2)
         {
             ClearAt(i);
         }
     }
 }