Exemplo n.º 1
0
        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 (FourRax.Get().Detected ||
                (bot.Frame >= 22.4 * 85 && !bot.EnemyStrategyAnalyzer.NoProxyTerranConfirmed && bot.TargetManager.PotentialEnemyStartLocations.Count == 1) ||
                ReaperRush.Get().Detected)
            {
                SmellCheese = true;
                defenseTask.MainDefenseRadius = 21;
            }

            if (!TerranTech.Get().DetectedPreviously &&
                (ReaperRush.Get().DetectedPreviously || FourRax.Get().DetectedPreviously))
            {
                SmellCheese = true;
            }

            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 (SmellCheese)
            {
                attackTask.RequiredSize = 15;
                attackTask.RetreatSize  = 8;
            }

            if (SmellCheese && Completed(UnitTypes.ADEPT) < 8)
            {
                foreach (Agent agent in bot.UnitManager.Agents.Values)
                {
                    if (agent.Unit.UnitType == UnitTypes.NEXUS &&
                        agent.Unit.BuildProgress < 0.99)
                    {
                        agent.Order(Abilities.CANCEL);
                    }
                }
            }

            if (Bio.Get().Detected)
            {
                DefendMech = false;
            }
            else if (Mech.Get().Detected)
            {
                DefendMech = true;
            }
            else if (Bio.Get().DetectedPreviously)
            {
                DefendMech = false;
            }
            else if (Mech.Get().DetectedPreviously)
            {
                DefendMech = true;
            }
            else
            {
                DefendMech = false;
            }
        }