Ejemplo n.º 1
0
        public override void OnFrame(Tyr tyr)
        {
            if (tyr.EnemyRace == Race.Protoss)
            {
                TimingAttackTask.Task.RequiredSize = 45;
                TimingAttackTask.Task.RetreatSize  = 8;
            }
            else
            {
                TimingAttackTask.Task.RequiredSize = 70;
                TimingAttackTask.Task.RetreatSize  = 20;
            }

            tyr.DrawText("Extractors: " + Count(UnitTypes.EXTRACTOR));

            DefenseTask.Task.MainDefenseRadius   = 20;
            DefenseTask.Task.ExpandDefenseRadius = 14;
            DefenseTask.Task.MaxDefenseRadius    = 55;

            IdleTask.Task.FearEnemies = true;

            GoingBroodlords = tyr.EnemyRace == Race.Protoss && Completed(UnitTypes.HYDRALISK_DEN) > 0 && Completed(UnitTypes.LURKER_DEN) > 0 && Count(UnitTypes.HATCHERY) + Count(UnitTypes.LAIR) + Count(UnitTypes.HIVE) >= 2;
            if (tyr.EnemyRace != Race.Protoss)
            {
                tyr.DrawScreen("Wrong race.", 12, 0.65f, 0.18f);
            }
            else if (Completed(UnitTypes.HYDRALISK_DEN) == 0)
            {
                tyr.DrawScreen("No hydra den", 12, 0.65f, 0.18f);
            }
            else if (Completed(UnitTypes.LURKER_DEN) == 0)
            {
                tyr.DrawScreen("No lurker den", 12, 0.65f, 0.18f);
            }
            else if (Count(UnitTypes.HATCHERY) + Count(UnitTypes.LAIR) + Count(UnitTypes.HIVE) < 2)
            {
                tyr.DrawScreen("Not enough bases. Hatch: " + Count(UnitTypes.HATCHERY) + " Lair: " + Count(UnitTypes.LAIR) + " Hive: " + Count(UnitTypes.HIVE), 12, 0.65f, 0.18f);
            }
            else if (GoingBroodlords)
            {
                tyr.DrawScreen("Going broodlords", 12, 0.65f, 0.18f);
            }
            else
            {
                tyr.DrawScreen("Not going broodlords", 12, 0.65f, 0.18f);
            }

            if (tyr.EnemyRace == Race.Protoss)
            {
                RequiredZerglings = 0;
            }

            if (Count(UnitTypes.HYDRALISK) - 10 >= (Count(UnitTypes.LURKER) + Count(UnitTypes.LURKER_BURROWED)) * 2)
            {
                MorphingTask.Task.Morph(UnitTypes.LURKER);
            }

            if (Completed(UnitTypes.LAIR) > 0 &&
                Count(UnitTypes.OVERSEER) < 2)
            {
                MorphingTask.Task.Morph(UnitTypes.OVERSEER);
            }

            if (FoodUsed()
                + Tyr.Bot.UnitManager.Count(UnitTypes.HATCHERY) * 2
                + Tyr.Bot.UnitManager.Count(UnitTypes.LAIR) * 2
                + Tyr.Bot.UnitManager.Count(UnitTypes.HIVE) * 2
                >= ExpectedAvailableFood() - 2)
            {
                MorphingTask.Task.Morph(UnitTypes.OVERLORD);
            }
            else if (Count(UnitTypes.DRONE) >= 14 && Count(UnitTypes.SPAWNING_POOL) == 0)
            {
            }
            else if (ExpectedAvailableFood() > FoodUsed() + 2 &&
                     Count(UnitTypes.DRONE) < 45 - Completed(UnitTypes.EXTRACTOR) &&
                     (Count(UnitTypes.DRONE) < 40 - Completed(UnitTypes.EXTRACTOR) || Count(UnitTypes.HATCHERY) >= 3) &&
                     (Count(UnitTypes.ZERGLING) >= RequiredZerglings || Count(UnitTypes.DRONE) <= 18) &&
                     (Count(UnitTypes.LAIR) > 0 || Count(UnitTypes.DRONE) <= 24))
            {
                MorphingTask.Task.Morph(UnitTypes.DRONE);
            }
            else if (Completed(UnitTypes.SPAWNING_POOL) > 0 &&
                     Count(UnitTypes.ZERGLING) < RequiredZerglings &&
                     ExpectedAvailableFood() > FoodUsed() + 4 &&
                     (Count(UnitTypes.SPINE_CRAWLER) >= 2 || Minerals() >= 200))
            {
                MorphingTask.Task.Morph(UnitTypes.ZERGLING);
            }
            else if (Completed(UnitTypes.HYDRALISK_DEN) > 0 &&
                     (Count(UnitTypes.HYDRALISK) < 15 || Count(UnitTypes.LURKER_DEN) > 0) &&
                     (Count(UnitTypes.HYDRALISK) - 20 < Count(UnitTypes.LURKER) * 2 || Gas() >= 150) &&
                     ExpectedAvailableFood() > FoodUsed() + 4 &&
                     !GoingBroodlords)
            {
                MorphingTask.Task.Morph(UnitTypes.HYDRALISK);
            }
        }