Esempio n. 1
0
        private bool UseRecall()
        {
            if (Recalled)
            {
                return(false);
            }
            int enemyDefendingWorkers = 0;
            int enemyAttackingWorkers = 0;

            foreach (Unit enemy in Bot.Main.Enemies())
            {
                if (!UnitTypes.WorkerTypes.Contains(enemy.UnitType))
                {
                    continue;
                }
                if (SC2Util.DistanceSq(enemy.Pos, Bot.Main.MapAnalyzer.StartLocation) <= 30 * 30)
                {
                    enemyAttackingWorkers++;
                }
                if (SC2Util.DistanceSq(enemy.Pos, Bot.Main.TargetManager.PotentialEnemyStartLocations[0]) <= 30 * 30)
                {
                    enemyDefendingWorkers++;
                }
            }
            if (Lifting.Get().Detected&& enemyDefendingWorkers == 0)
            {
                return(true);
            }
            if (CounterWorkerRush.Get().Detected &&
                enemyDefendingWorkers == 0 &&
                Bot.Main.Frame >= 22.4 * 60)
            {
                return(true);
            }

            if (enemyAttackingWorkers >= 5)
            {
                return(true);
            }
            return(false);
        }
Esempio n. 2
0
        public override void OnFrame(Bot bot)
        {
            if (Count(UnitTypes.STALKER) > 0)
            {
                BalanceGas();
            }
            else if (Gas() < 50)
            {
                GasWorkerTask.WorkersPerGas = 3;
            }
            else
            {
                GasWorkerTask.WorkersPerGas = 1;
            }

            TimingAttackTask.Task.RequiredSize = 1;
            TimingAttackTask.Task.RetreatSize  = 0;
            TimingAttackTask.Task.ExcludeUnitTypes.Add(UnitTypes.VOID_RAY);

            if (Lifting.Get().Detected)
            {
                int surfaceEnemies = 0;
                foreach (Unit unit in bot.Enemies())
                {
                    if (!unit.IsFlying)
                    {
                        surfaceEnemies++;
                    }
                }

                if (surfaceEnemies < 3 && WorkerTask.Task.Units.Count < 16)
                {
                    WorkerRushTask.Clear();
                    WorkerRushTask.Stopped = true;
                }
            }

            if (!MessageSent)
            {
                if (bot.Enemies().Count > 0)
                {
                    MessageSent = true;
                    bot.Chat("Prepare to be TICKLED! :D");
                }
            }

            if (bot.Frame - LastReinforcementsFrame >= 100 &&
                WorkerTask.Task.Units.Count >= (Lifting.Get().Detected ? 22 : 12) &&
                !Lifting.Get().Detected &&
                (!CounterWorkerRush.Get().Detected || bot.Frame >= 22.4 * 120) &&
                (!CounterWorkerRush.Get().Detected || !BuildStalkers))
            {
                LastReinforcementsFrame     = bot.Frame;
                WorkerRushTask.TakeWorkers += 6;
            }
            if (UseRecall())
            {
                RecallTask.Task.Location = new PotentialHelper(bot.TargetManager.PotentialEnemyStartLocations[0], 8).To(Main.BaseLocation.Pos).Get();
                Recalled = true;
            }
        }
Esempio n. 3
0
        private BuildList BuildStargatesAgainstLifters()
        {
            BuildList result = new BuildList();

            result.If(() => Lifting.Get().Detected || Bot.Main.Frame >= 22.4 * 60 * 10 || CounterWorkerRush.Get().Detected);
            result.Building(UnitTypes.GATEWAY);
            result.Building(UnitTypes.ASSIMILATOR);
            result.Building(UnitTypes.CYBERNETICS_CORE);
            result.Train(UnitTypes.STALKER, 10, () => BuildStalkers);
            result.Building(UnitTypes.ASSIMILATOR, () => Count(UnitTypes.STALKER) > 0 || !BuildStalkers);
            result.Building(UnitTypes.STARGATE, 2, () => Count(UnitTypes.STALKER) > 0 || !BuildStalkers);

            return(result);
        }