예제 #1
0
        public override void OnStart(Bot bot)
        {
            OverrideDefenseTarget = bot.MapAnalyzer.Walk(NaturalDefensePos, bot.MapAnalyzer.EnemyDistances, 15);

            MicroControllers.Add(StutterForwardController);
            MicroControllers.Add(FallBackController);
            MicroControllers.Add(new FearMinesController());
            MicroControllers.Add(new StalkerController());
            MicroControllers.Add(new DisruptorController());
            MicroControllers.Add(new StutterController());
            MicroControllers.Add(new HTController());
            MicroControllers.Add(new ColloxenController());
            MicroControllers.Add(new TempestController());
            MicroControllers.Add(new AdvanceController());

            if (WallIn == null)
            {
                WallIn = new WallInCreator();
                WallIn.CreateNatural(new List <uint>()
                {
                    UnitTypes.GATEWAY, UnitTypes.GATEWAY, UnitTypes.ZEALOT, UnitTypes.GATEWAY
                });
                ShieldBatteryPos = DetermineShieldBatteryPos();
                WallIn.ReserveSpace();
            }

            Set += ProtossBuildUtil.Pylons(() => Completed(UnitTypes.PYLON) > 0 &&
                                           (Count(UnitTypes.CYBERNETICS_CORE) > 0 || EarlyPool.Get().Detected) &&
                                           (Count(UnitTypes.GATEWAY) >= 2 || !EarlyPool.Get().Detected));
            Set += ExpandBuildings();
            Set += Units();
            Set += MainBuild();
        }
예제 #2
0
파일: TwoBaseRobo.cs 프로젝트: evilz/TyrSc2
        private BuildList MainBuild()
        {
            BuildList result = new BuildList();

            result.Building(UnitTypes.PYLON);
            result.Building(UnitTypes.GATEWAY);
            if (Bot.Main.EnemyRace != Race.Terran)
            {
                result.If(() => { return(!EarlyPool.Get().Detected || Expanded.Get().Detected || Completed(UnitTypes.ZEALOT) >= 2); });
            }
            result.Building(UnitTypes.ASSIMILATOR);
            result.Building(UnitTypes.PYLON, Natural, NaturalDefensePos);
            result.Building(UnitTypes.CYBERNETICS_CORE);
            result.Building(UnitTypes.ASSIMILATOR, 2);
            result.Building(UnitTypes.GATEWAY);
            result.Building(UnitTypes.PYLON);
            result.Building(UnitTypes.PYLON, Natural);
            result.Building(UnitTypes.ROBOTICS_FACILITY);
            result.Building(UnitTypes.PYLON, 2);
            result.Building(UnitTypes.ROBOTICS_BAY, () => { return(!UseImmortals); });
            result.Building(UnitTypes.PYLON, Natural);
            result.Building(UnitTypes.ROBOTICS_FACILITY);
            result.Building(UnitTypes.ASSIMILATOR);
            result.Building(UnitTypes.GATEWAY, 2);
            result.Building(UnitTypes.PYLON, Natural);
            result.Building(UnitTypes.TWILIGHT_COUNSEL);
            result.Building(UnitTypes.PYLON, Natural);
            result.If(() => { return(Count(UnitTypes.COLOSUS) >= 6); });
            result.Building(UnitTypes.GATEWAY, 2);

            return(result);
        }
예제 #3
0
파일: TwoBaseRobo.cs 프로젝트: evilz/TyrSc2
        private BuildList EmergencyGateways()
        {
            BuildList result = new BuildList();

            result.If(() => { return(EarlyPool.Get().Detected&& !Expanded.Get().Detected); });
            result.Building(UnitTypes.PYLON);
            result.Building(UnitTypes.GATEWAY, 2);

            return(result);
        }
예제 #4
0
파일: PvZHjax.cs 프로젝트: evilz/TyrSc2
        private BuildList Units()
        {
            BuildList result = new BuildList();

            result.Train(UnitTypes.PROBE, 19);
            result.Train(UnitTypes.PROBE, 40, () => Count(UnitTypes.NEXUS) >= 2);
            result.Train(UnitTypes.PROBE, 60, () => Count(UnitTypes.NEXUS) >= 3);
            result.Train(UnitTypes.PROBE, 80, () => Count(UnitTypes.NEXUS) >= 4);
            result.If(() => Count(UnitTypes.STALKER) < 5 || Count(UnitTypes.IMMORTAL) < 2 || Count(UnitTypes.NEXUS) >= 2);
            result.If(() => !EarlyPool.Get().Detected || Count(UnitTypes.ZEALOT) < 8 || Count(UnitTypes.NEXUS) >= 2);
            result.If(() => Completed(UnitTypes.CYBERNETICS_CORE) > 0 || (EarlyPool.Get().Detected&& Count(UnitTypes.ZEALOT) + Count(UnitTypes.ADEPT) < 8));
            result.Train(UnitTypes.STALKER, 6, () => RoachRushDetected);
            result.Train(UnitTypes.ZEALOT, 1, () => EarlyPool.Get().Detected&& !RoachRushDetected);
            result.Train(UnitTypes.ADEPT, 2, () => !AdeptHarassMainTask.Task.Sent && !RoachRushDetected);
            result.Upgrade(UpgradeType.WarpGate, () => !EarlyPool.Get().Detected || Count(UnitTypes.ADEPT) + Count(UnitTypes.ZEALOT) >= 4);
            result.Train(UnitTypes.ZEALOT, 1, () => Completed(UnitTypes.NEXUS) < 3);
            result.Train(UnitTypes.ZEALOT, 2, () => EarlyPool.Get().Detected&& !RoachRushDetected);
            result.Train(UnitTypes.ADEPT, 5, () => EarlyPool.Get().Detected&& !RoachRushDetected);
            result.Train(UnitTypes.ZEALOT, 10, () => EarlyPool.Get().Detected&& !RoachRushDetected);
            //result.Train(UnitTypes.WARP_PRISM, 1, () => !InitialAttackDone && !RoachRushDetected);
            result.Train(UnitTypes.SENTRY, 1, () => !TimingAttackTask.Task.AttackSent && !RoachRushDetected && !EarlyPool.Get().Detected&& Count(UnitTypes.ZEALOT) > 0);
            result.Train(UnitTypes.ZEALOT, 6, () => !InitialAttackDone && Count(UnitTypes.TEMPLAR_ARCHIVE) > 0);
            result.Train(UnitTypes.ZEALOT, 8, () => !InitialAttackDone && Count(UnitTypes.HIGH_TEMPLAR) + Count(UnitTypes.ARCHON) * 2 >= 4);
            result.Train(UnitTypes.IMMORTAL, 1);
            result.Train(UnitTypes.OBSERVER, 1, () => RoachRushDetected);
            result.Train(UnitTypes.IMMORTAL, 2);
            result.Train(UnitTypes.WARP_PRISM, 1, () => !RoachRushDetected || (Count(UnitTypes.ROBOTICS_FACILITY) >= 2 && Count(UnitTypes.NEXUS) >= 3));
            result.Train(UnitTypes.IMMORTAL, 3);
            result.Train(UnitTypes.OBSERVER, 1);
            result.Upgrade(UpgradeType.ExtendedThermalLance, () => UseColosus);
            result.Train(UnitTypes.COLOSUS, 3, () => UseColosus);
            result.Train(UnitTypes.IMMORTAL, 6, () => !RoachRushDetected || Count(UnitTypes.NEXUS) >= 3);
            result.Train(UnitTypes.COLOSUS, 4, () => UseColosus && RoboArmy);
            result.Train(UnitTypes.IMMORTAL, 8, () => !RoachRushDetected || Count(UnitTypes.NEXUS) >= 3);
            result.Train(UnitTypes.COLOSUS, 5, () => UseColosus && RoboArmy);
            result.Train(UnitTypes.IMMORTAL, 10, () => !RoachRushDetected || Count(UnitTypes.NEXUS) >= 3);
            result.Train(UnitTypes.COLOSUS, 6, () => UseColosus && RoboArmy);
            result.Train(UnitTypes.IMMORTAL, 12, () => !RoachRushDetected || Count(UnitTypes.NEXUS) >= 3);
            result.Upgrade(UpgradeType.Charge, () => Count(UnitTypes.TEMPLAR_ARCHIVE) > 0 || (Gas() >= 200 && Minerals() >= 300));
            result.Train(UnitTypes.HIGH_TEMPLAR, 2, () => Gas() >= 75 && Count(UnitTypes.HIGH_TEMPLAR) == 1 && !RoboArmy);
            result.Train(UnitTypes.HIGH_TEMPLAR, () => Gas() >= 150 && Count(UnitTypes.ARCHON) * 2 + Count(UnitTypes.HIGH_TEMPLAR) < 6 && !RoboArmy);
            result.Train(UnitTypes.HIGH_TEMPLAR, 6, () => Gas() >= 150 && InitialAttackDone && UseStorm && !RoboArmy);
            result.Upgrade(UpgradeType.PsiStorm, () => InitialAttackDone && UseStorm && !RoboArmy);
            result.Train(UnitTypes.ZEALOT, 5, () => Count(UnitTypes.IMMORTAL) + Count(UnitTypes.ARCHON) >= 2 && (Completed(UnitTypes.WARP_PRISM) == 0 || TimingAttackTask.Task.Units.Count == 0) && RoboArmy);
            result.Train(UnitTypes.ZEALOT, 10, () => Count(UnitTypes.IMMORTAL) >= 4 && Count(UnitTypes.COLOSUS) >= 2 && RoboArmy);
            result.Train(UnitTypes.ZEALOT, 5, () => !InitialAttackDone);
            result.Train(UnitTypes.ZEALOT, 10, () => !InitialAttackDone && Completed(UnitTypes.TWILIGHT_COUNSEL) == 1 && Count(UnitTypes.TEMPLAR_ARCHIVE) == 1 && Completed(UnitTypes.TEMPLAR_ARCHIVE) == 0);
            result.Train(UnitTypes.ZEALOT, 15, () => Count(UnitTypes.IMMORTAL) + Count(UnitTypes.ARCHON) >= 2 && (Completed(UnitTypes.WARP_PRISM) == 0 || TimingAttackTask.Task.Units.Count == 0) && !RoboArmy);
            result.Train(UnitTypes.ZEALOT, 25, () => Count(UnitTypes.IMMORTAL) + Count(UnitTypes.ARCHON) >= 2 && (Completed(UnitTypes.WARP_PRISM) == 0 || TimingAttackTask.Task.Units.Count == 0) && InitialAttackDone && !RoboArmy);
            result.Train(UnitTypes.ZEALOT, 35, () => Count(UnitTypes.IMMORTAL) + Count(UnitTypes.ARCHON) >= 2 && InitialAttackDone && Minerals() >= 400 && !RoboArmy);
            result.Train(UnitTypes.STALKER, 35, () => Count(UnitTypes.IMMORTAL) + Count(UnitTypes.ARCHON) >= 2 && InitialAttackDone && Minerals() >= 400 && RoboArmy);

            return(result);
        }
예제 #5
0
        private BuildList MainBuild()
        {
            BuildList result = new BuildList();

            result.Building(UnitTypes.NEXUS);
            result.If(() => Count(UnitTypes.PROBE) >= 13);
            if (WallIn.Wall.Count >= 5)
            {
                result.Building(UnitTypes.PYLON, Natural, WallIn.Wall[4].Pos, true);
                result.Building(UnitTypes.GATEWAY, Natural, WallIn.Wall[0].Pos, true, () => Completed(UnitTypes.PYLON) > 0 && Count(UnitTypes.PROBE) >= 16);
                result.Building(UnitTypes.GATEWAY, Natural, WallIn.Wall[3].Pos, true, () => Completed(UnitTypes.PYLON) > 0 && EarlyPool.Get().Detected);
                //result.Building(UnitTypes.GATEWAY, Natural, WallIn.Wall[1].Pos, true, () => Completed(UnitTypes.PYLON) > 0 && EarlyPool.Get().Detected);
            }
            else
            {
                result.Building(UnitTypes.PYLON);
                result.Building(UnitTypes.GATEWAY, () => Completed(UnitTypes.PYLON) > 0 && Count(UnitTypes.PROBE) >= 16);
                result.Building(UnitTypes.GATEWAY, () => Completed(UnitTypes.PYLON) > 0 && EarlyPool.Get().Detected);
            }
            result.If(() => Count(UnitTypes.GATEWAY) > 0);
            result.Building(UnitTypes.ASSIMILATOR);
            result.Building(UnitTypes.NEXUS, () => (!EarlyPool.Get().Detected || Completed(UnitTypes.ADEPT) + Completed(UnitTypes.ZEALOT) >= 3) && Count(UnitTypes.PROBE) >= 19);
            result.If(() => Count(UnitTypes.NEXUS) >= 2);
            if (WallIn.Wall.Count >= 5)
            {
                result.Building(UnitTypes.CYBERNETICS_CORE, Natural, WallIn.Wall[1].Pos, true);
            }
            else
            {
                result.Building(UnitTypes.CYBERNETICS_CORE);
            }
            result.Building(UnitTypes.ASSIMILATOR);
            result.Building(UnitTypes.PYLON);
            result.If(() => Count(UnitTypes.STALKER) > 0);
            result.Upgrade(UpgradeType.WarpGate);
            result.Building(UnitTypes.TWILIGHT_COUNSEL);
            result.Building(UnitTypes.ROBOTICS_FACILITY);
            if (WallIn.Wall.Count >= 5)
            {
                result.Building(UnitTypes.GATEWAY, Natural, WallIn.Wall[3].Pos, true, () => !EarlyPool.Get().Detected);
            }
            else
            {
                result.Building(UnitTypes.GATEWAY, () => !EarlyPool.Get().Detected);
            }
            result.Building(UnitTypes.GATEWAY, Main, 2);
            result.Building(UnitTypes.GATEWAY, Main, 2, () => Count(UnitTypes.WARP_PRISM) > 0);
            result.Building(UnitTypes.PYLON, () => Count(UnitTypes.GATEWAY) >= 4);
            result.Building(UnitTypes.PYLON, () => Count(UnitTypes.GATEWAY) >= 5 && Count(UnitTypes.ADEPT) >= 3);

            return(result);
        }
예제 #6
0
파일: TwoBaseRobo.cs 프로젝트: evilz/TyrSc2
        private BuildList Nexii()
        {
            BuildList result = new BuildList();

            result.If(() => { return(Bot.Main.EnemyRace != Race.Terran || Count(UnitTypes.GATEWAY) >= 2); });
            if (Bot.Main.EnemyRace == Race.Zerg)
            {
                result.If(() => { return(!EarlyPool.Get().Detected || Expanded.Get().Detected || Completed(UnitTypes.ZEALOT) >= 2); });
            }
            result.Building(UnitTypes.NEXUS, 2);
            result.If(() => { return(Attacking); });
            result.Building(UnitTypes.NEXUS);

            return(result);
        }
예제 #7
0
        private BuildList EmergencyGateways()
        {
            BuildList result = new BuildList();

            result.If(() => { return(EarlyPool.Get().Detected&& !Expanded.Get().Detected); });
            result.Building(UnitTypes.PYLON, Main, WallIn.Wall[1].Pos, true);
            result.Building(UnitTypes.GATEWAY, Main, WallIn.Wall[0].Pos, true);
            result.Building(UnitTypes.GATEWAY, Main);
            result.If(() => Count(UnitTypes.ZEALOT) >= 4);
            result.Building(UnitTypes.CYBERNETICS_CORE);
            result.If(() => Count(UnitTypes.ZEALOT) >= 6);
            result.Building(UnitTypes.ASSIMILATOR);
            result.If(() => Count(UnitTypes.ZEALOT) >= 8);
            result.Building(UnitTypes.GATEWAY, Main);

            return(result);
        }
예제 #8
0
        private BuildList Units()
        {
            BuildList result = new BuildList();

            result.If(() => Count(UnitTypes.STALKER) < 5 || Count(UnitTypes.IMMORTAL) < 2 || Count(UnitTypes.NEXUS) >= 2);
            result.If(() => !EarlyPool.Get().Detected || Count(UnitTypes.ZEALOT) < 8 || Count(UnitTypes.NEXUS) >= 2);
            result.Train(UnitTypes.TEMPEST);
            result.Train(UnitTypes.IMMORTAL, 3);
            result.Train(UnitTypes.OBSERVER, 1);
            result.Train(UnitTypes.IMMORTAL, 10);
            result.Train(UnitTypes.HIGH_TEMPLAR, () => Gas() >= 100);
            result.Train(UnitTypes.ZEALOT, 6);
            //result.Train(UnitTypes.STALKER, () => TotalEnemyCount(UnitTypes.ROACH) >= 5);
            result.Train(UnitTypes.ZEALOT);

            return(result);
        }
예제 #9
0
파일: PvZHjax.cs 프로젝트: evilz/TyrSc2
        private BuildList ExpandBuildings()
        {
            BuildList result = new BuildList();

            result.If(() => { return(!EarlyPool.Get().Detected); });
            foreach (Base b in Bot.Main.BaseManager.Bases)
            {
                if (b == Main)
                {
                    continue;
                }
                result.Building(UnitTypes.PYLON, b, () => b.ResourceCenter != null && b.ResourceCenter.Unit.BuildProgress >= 0.8);
                result.Building(UnitTypes.GATEWAY, b, 2, () => b.ResourceCenter != null && b.ResourceCenter.Unit.BuildProgress >= 0.95 && Completed(b, UnitTypes.PYLON) >= 1 && Minerals() >= 350);
                result.Building(UnitTypes.PYLON, b, () => b.ResourceCenter != null && b.ResourceCenter.Unit.BuildProgress >= 0.95 && Count(b, UnitTypes.GATEWAY) >= 2 && Minerals() >= 700);
            }

            return(result);
        }
예제 #10
0
        private BuildList Units()
        {
            BuildList result = new BuildList();

            result.If(() => Count(UnitTypes.STALKER) < 5 || Count(UnitTypes.IMMORTAL) < 2 || Count(UnitTypes.NEXUS) >= 2);
            result.If(() => !EarlyPool.Get().Detected || Count(UnitTypes.ZEALOT) < 8 || Count(UnitTypes.NEXUS) >= 2);
            result.Train(UnitTypes.ZEALOT, 1, () => Completed(UnitTypes.NEXUS) < 3);
            result.Train(UnitTypes.ZEALOT, 2, () => Completed(UnitTypes.NEXUS) < 3 && TimingAttackTask.Task.Units.Count == 0 && Count(UnitTypes.STALKER) >= 5);
            result.Train(UnitTypes.ZEALOT, 10, () => EarlyPool.Get().Detected || MassZerglings);
            result.Train(UnitTypes.TEMPEST);
            result.Train(UnitTypes.COLOSUS, 3, () => TotalEnemyCount(UnitTypes.ZERGLING) >= 40 && TotalEnemyCount(UnitTypes.MUTALISK) + TotalEnemyCount(UnitTypes.CORRUPTOR) == 0);
            result.Train(UnitTypes.IMMORTAL, 3, () => TotalEnemyCount(UnitTypes.ZERGLING) <= 60 || TotalEnemyCount(UnitTypes.ROACH) + TotalEnemyCount(UnitTypes.HYDRALISK) > 0);
            result.Train(UnitTypes.OBSERVER, 1);
            result.Train(UnitTypes.IMMORTAL, 10, () => TotalEnemyCount(UnitTypes.ZERGLING) <= 60 || TotalEnemyCount(UnitTypes.ROACH) + TotalEnemyCount(UnitTypes.HYDRALISK) > 0);
            //result.Train(UnitTypes.ADEPT, 4);
            result.Train(UnitTypes.STALKER);

            return(result);
        }
예제 #11
0
파일: MacroToss.cs 프로젝트: evilz/TyrSc2
        private BuildList MainBuild()
        {
            BuildList result = new BuildList();

            result.Building(UnitTypes.NEXUS);
            result.Building(UnitTypes.PYLON, Main, WallIn.Wall[1].Pos, true);
            result.Building(UnitTypes.GATEWAY, Main, WallIn.Wall[0].Pos, true, () => Completed(UnitTypes.PYLON) > 0);
            if (Bot.Main.EnemyRace != Race.Terran)
            {
                result.If(() => { return(!EarlyPool.Get().Detected || Expanded.Get().Detected || Completed(UnitTypes.ZEALOT) + Completed(UnitTypes.ADEPT) >= 15); });
            }
            result.Building(UnitTypes.NEXUS);
            result.Building(UnitTypes.ASSIMILATOR);
            result.Building(UnitTypes.CYBERNETICS_CORE);
            result.Building(UnitTypes.GATEWAY, Main);
            result.Building(UnitTypes.PYLON, Natural);
            result.Building(UnitTypes.ROBOTICS_FACILITY);
            result.Building(UnitTypes.NEXUS);
            result.Building(UnitTypes.PYLON);
            result.Building(UnitTypes.ROBOTICS_FACILITY, () => RobosActive() || Minerals() >= 600 || FoodUsed() >= 190);
            result.Building(UnitTypes.TWILIGHT_COUNSEL);
            result.Building(UnitTypes.FORGE);
            result.Upgrade(UpgradeType.ProtossGroundWeapons);
            result.Building(UnitTypes.FORGE);
            result.Upgrade(UpgradeType.ProtossGroundArmor);
            result.Building(UnitTypes.ASSIMILATOR, 2);
            result.Building(UnitTypes.PYLON);
            result.Building(UnitTypes.ROBOTICS_BAY, () => RobosActive() || Count(UnitTypes.IMMORTAL) >= 3);
            result.If(() => Count(UnitTypes.IMMORTAL) >= 3 && Count(UnitTypes.ZEALOT) >= 10);
            result.Building(UnitTypes.NEXUS);
            result.Building(UnitTypes.ASSIMILATOR, 6);
            result.If(() => Count(UnitTypes.IMMORTAL) >= 10 && Count(UnitTypes.ZEALOT) >= 15);
            result.Building(UnitTypes.NEXUS);
            result.Building(UnitTypes.ASSIMILATOR, 2);
            result.Building(UnitTypes.NEXUS);
            result.Building(UnitTypes.ASSIMILATOR, 2);

            return(result);
        }
예제 #12
0
파일: PvZHjax.cs 프로젝트: evilz/TyrSc2
        private BuildList MainBuild()
        {
            BuildList result = new BuildList();

            result.Building(UnitTypes.NEXUS);
            result.If(() => Bot.Main.Frame >= 22.4 * 17);
            if (WallIn.Wall.Count >= 5)
            {
                result.Building(UnitTypes.PYLON, Natural, WallIn.Wall[4].Pos, true);
                result.Building(UnitTypes.GATEWAY, Natural, WallIn.Wall[0].Pos, true, () => Completed(UnitTypes.PYLON) > 0);
                result.Building(UnitTypes.GATEWAY, Natural, WallIn.Wall[3].Pos, true, () => Completed(UnitTypes.PYLON) > 0 && EarlyPool.Get().Detected);
                //result.Building(UnitTypes.GATEWAY, Natural, WallIn.Wall[1].Pos, true, () => Completed(UnitTypes.PYLON) > 0 && EarlyPool.Get().Detected);
            }
            else
            {
                result.Building(UnitTypes.PYLON);
                result.Building(UnitTypes.GATEWAY, () => Completed(UnitTypes.PYLON) > 0);
                result.Building(UnitTypes.GATEWAY, () => Completed(UnitTypes.PYLON) > 0 && EarlyPool.Get().Detected);
            }
            result.If(() => Count(UnitTypes.GATEWAY) > 0);
            //result.Building(UnitTypes.ASSIMILATOR, () => !EarlyPool.Get().Detected || Expanded.Get().Detected || Count(UnitTypes.ZEALOT) >= 6);
            result.Building(UnitTypes.ASSIMILATOR, () => Bot.Main.Frame >= 22.4 * 53);
            result.Building(UnitTypes.NEXUS, () => (!EarlyPool.Get().Detected || Completed(UnitTypes.ADEPT) + Completed(UnitTypes.ZEALOT) >= 3 || RoachRushDetected) && (!RoachRushDetected || Completed(UnitTypes.IMMORTAL) > 0));
            if (WallIn.Wall.Count >= 5)
            {
                result.Building(UnitTypes.CYBERNETICS_CORE, Natural, WallIn.Wall[1].Pos, true);
            }
            else
            {
                result.Building(UnitTypes.CYBERNETICS_CORE);
            }
            //result.Building(UnitTypes.CYBERNETICS_CORE, () => EarlyPool.Get().Detected && Count(UnitTypes.ZEALOT) >= 6);
            result.If(() => Count(UnitTypes.ADEPT) >= 2 || AdeptHarassMainTask.Task.Sent);
            result.Building(UnitTypes.ASSIMILATOR, () => RoachRushDetected);
            result.Building(UnitTypes.ROBOTICS_FACILITY, () => RoboArmy);
            if (WallIn.Wall.Count >= 5)
            {
                result.Building(UnitTypes.GATEWAY, Natural, WallIn.Wall[3].Pos, true, () => !EarlyPool.Get().Detected);
            }
            else
            {
                result.Building(UnitTypes.GATEWAY, () => !EarlyPool.Get().Detected);
            }
            if (ShieldBatteryPos == null)
            {
                result.Building(UnitTypes.SHIELD_BATTERY, Natural, NaturalDefensePos, () => (EarlyPool.Get().Detected&& !RoachRushDetected) || (RoachRushDetected && Count(UnitTypes.STALKER) > 0));
            }
            else
            {
                result.Building(UnitTypes.SHIELD_BATTERY, Natural, ShieldBatteryPos, true, () => (EarlyPool.Get().Detected&& !RoachRushDetected) || (RoachRushDetected && Count(UnitTypes.STALKER) > 0));
            }
            result.Building(UnitTypes.ASSIMILATOR, 2, () => (!EarlyPool.Get().Detected || Count(UnitTypes.ZEALOT) >= 4) && (!RoachRushDetected || Count(UnitTypes.IMMORTAL) > 0));
            result.Building(UnitTypes.TWILIGHT_COUNSEL, () => !RoboArmy || Completed(UnitTypes.IMMORTAL) > 0);
            result.Building(UnitTypes.GATEWAY, Main, () => !EarlyPool.Get().Detected);
            result.Building(UnitTypes.TEMPLAR_ARCHIVE, () => !RoboArmy);
            result.Building(UnitTypes.GATEWAY, Main, () => !EarlyPool.Get().Detected);
            result.Building(UnitTypes.ASSIMILATOR, () => Count(UnitTypes.ZEALOT) >= 8 || Minerals() >= 450);
            result.Building(UnitTypes.GATEWAY, Main, () => !EarlyPool.Get().Detected);
            result.Building(UnitTypes.PYLON, Natural, () => Count(UnitTypes.CYBERNETICS_CORE) > 0 && Natural.ResourceCenter != null);
            result.Building(UnitTypes.NEXUS);
            result.If(() =>
                      TimingAttackTask.Task.AttackSent ||
                      InitialAttackDone ||
                      Minerals() >= 600 ||
                      RoachRushDetected ||
                      (EarlyPool.Get().Detected&& !Expanded.Get().Detected) ||
                      (EarlyPool.Get().Detected&& Count(UnitTypes.ARCHON) > 0));
            result.Building(UnitTypes.ROBOTICS_FACILITY, () => (!EarlyPool.Get().Detected || Completed(UnitTypes.ADEPT) + Completed(UnitTypes.ZEALOT) >= 8) && !RoachRushDetected);
            result.Building(UnitTypes.PYLON);
            result.Building(UnitTypes.FORGE, () => !RoboArmy || Count(UnitTypes.ROBOTICS_FACILITY) >= 2);
            result.Upgrade(UpgradeType.ProtossGroundWeapons);
            result.Upgrade(UpgradeType.ProtossGroundArmor);
            result.Building(UnitTypes.ASSIMILATOR, () => !RoboArmy || Minerals() >= 600);
            result.Building(UnitTypes.PYLON);
            result.Building(UnitTypes.ROBOTICS_BAY, () => UseColosus && (TimingAttackTask.Task.AttackSent || RoachRushDetected));
            result.Building(UnitTypes.NEXUS);
            result.Building(UnitTypes.ROBOTICS_FACILITY, () => Completed(UnitTypes.ADEPT) + Completed(UnitTypes.ZEALOT) >= 10 || InitialAttackDone || RoachRushDetected);
            result.Building(UnitTypes.ASSIMILATOR, 4, () => Minerals() >= 700 && Gas() < 200);
            result.Building(UnitTypes.ROBOTICS_FACILITY, () => InitialAttackDone || RoachRushDetected);
            result.If(() => Count(UnitTypes.IMMORTAL) + Count(UnitTypes.ARCHON) >= 3 && Count(UnitTypes.ZEALOT) + Count(UnitTypes.ADEPT) + Count(UnitTypes.STALKER) >= 10);
            result.Building(UnitTypes.ASSIMILATOR, 2);
            result.Building(UnitTypes.ASSIMILATOR, 2);
            result.If(() => Count(UnitTypes.IMMORTAL) + Count(UnitTypes.ARCHON) + Count(UnitTypes.ADEPT) + Count(UnitTypes.COLOSUS) + Count(UnitTypes.STALKER) + Count(UnitTypes.ZEALOT) >= 15);
            result.Building(UnitTypes.ASSIMILATOR, 2);
            result.Building(UnitTypes.GATEWAY, Main, 2);
            result.Building(UnitTypes.NEXUS);
            result.Building(UnitTypes.ASSIMILATOR, 2);
            result.If(() => Count(UnitTypes.IMMORTAL) + Count(UnitTypes.ARCHON) + Count(UnitTypes.ADEPT) + Count(UnitTypes.COLOSUS) + Count(UnitTypes.STALKER) + Count(UnitTypes.ZEALOT) >= 40 || Minerals() >= 650);
            result.Building(UnitTypes.NEXUS);

            return(result);
        }
예제 #13
0
        public override void OnFrame(Bot bot)
        {
            BalanceGas();

            ArchonMergeTask.Task.MergePos = OverrideDefenseTarget;

            FallBackController.Stopped       = true;
            StutterForwardController.Stopped = Count(UnitTypes.NEXUS) >= 3 || TimingAttackTask.Task.Units.Count > 0 || Completed(UnitTypes.ZEALOT) > 0;


            if (!AggressiveZerglings && bot.Frame <= 22.4 * 60 * 7)
            {
                int closeEnemyZerglingCount = 0;
                foreach (Unit enemy in bot.Enemies())
                {
                    if (enemy.UnitType != UnitTypes.ZERGLING)
                    {
                        continue;
                    }
                    if (SC2Util.DistanceSq(enemy.Pos, bot.MapAnalyzer.StartLocation) <= 50 * 50)
                    {
                        closeEnemyZerglingCount++;
                    }
                }
                if (AggressiveZerglings)
                {
                    bot.DrawText("Close zerglings: " + closeEnemyZerglingCount);
                }
                if (closeEnemyZerglingCount >= 20)
                {
                    AggressiveZerglings = true;
                }
            }
            if (AggressiveZerglings)
            {
                bot.DrawText("Aggressive zerglings.");
            }

            int wallDone = 0;

            foreach (WallBuilding building in WallIn.Wall)
            {
                if (!BuildingType.LookUp.ContainsKey(building.Type))
                {
                    wallDone++;
                    continue;
                }
                foreach (Agent agent in bot.UnitManager.Agents.Values)
                {
                    if (agent.DistanceSq(building.Pos) <= 1 * 1)
                    {
                        wallDone++;
                        break;
                    }
                }
            }
            bot.DrawText("Wall count: " + wallDone);
            HodorTask.Task.Stopped = Count(UnitTypes.NEXUS) >= 3 ||
                                     TimingAttackTask.Task.Units.Count > 0 ||
                                     (EarlyPool.Get().Detected&& Completed(UnitTypes.ZEALOT) >= 2) ||
                                     wallDone < WallIn.Wall.Count;
            if (HodorTask.Task.Stopped)
            {
                HodorTask.Task.Clear();
            }

            if (EarlyPool.Get().Detected || bot.Frame >= 1800)
            {
                WorkerScoutTask.Task.Stopped = true;
                WorkerScoutTask.Task.Clear();
            }

            if (WallIn.Wall.Count >= 5)
            {
                HodorTask.Task.Target = WallIn.Wall[2].Pos;
            }
            else
            {
                HodorTask.Task.Stopped = true;
                HodorTask.Task.Clear();
            }

            foreach (Agent agent in bot.UnitManager.Agents.Values)
            {
                if (bot.Frame % 224 != 0)
                {
                    break;
                }
                if (agent.Unit.UnitType != UnitTypes.GATEWAY)
                {
                    continue;
                }

                if (Count(UnitTypes.NEXUS) < 3 && TimingAttackTask.Task.Units.Count == 0)
                {
                    agent.Order(Abilities.MOVE, Natural.BaseLocation.Pos);
                }
                else
                {
                    agent.Order(Abilities.MOVE, bot.TargetManager.PotentialEnemyStartLocations[0]);
                }
            }

            if (!MassZerglings &&
                !EarlyPool.Get().Detected &&
                bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.ZERGLING) >= 60 &&
                bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.ROACH) == 0 &&
                bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.HYDRALISK) == 0)
            {
                MassZerglings = true;
                TimingAttackTask.Task.Clear();
            }
            bot.DrawText("Zergling count: " + bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.ZERGLING));

            //WorkerScoutTask.Task.StartFrame = 600;
            ObserverScoutTask.Task.Priority = 6;

            ForwardProbeTask.Task.Stopped = Completed(UnitTypes.STALKER) + Count(UnitTypes.ADEPT) + Count(UnitTypes.IMMORTAL) < 12;

            if (ForwardProbeTask.Task.Stopped)
            {
                ForwardProbeTask.Task.Clear();
            }


            if (EarlyPool.Get().Detected)
            {
                bot.NexusAbilityManager.Stopped = Count(UnitTypes.ZEALOT) == 0;
                bot.NexusAbilityManager.PriotitizedAbilities.Add(916);
            }
            bot.NexusAbilityManager.PriotitizedAbilities.Add(917);

            if (UpgradeType.LookUp[UpgradeType.ProtossGroundWeapons1].Done())
            {
                TimingAttackTask.Task.RequiredSize = 24;
            }
            else
            {
                TimingAttackTask.Task.RequiredSize = 40;
            }
            TimingAttackTask.Task.RetreatSize = 0;

            foreach (WorkerDefenseTask task in WorkerDefenseTask.Tasks)
            {
                task.Stopped = Completed(UnitTypes.ZEALOT) >= 5;
            }


            if (Count(UnitTypes.NEXUS) >= 3)
            {
                IdleTask.Task.OverrideTarget = OverrideDefenseTarget;
            }
            else
            {
                IdleTask.Task.OverrideTarget = NaturalDefensePos;
            }

            DefenseTask.GroundDefenseTask.ExpandDefenseRadius = 30;
            DefenseTask.GroundDefenseTask.MainDefenseRadius   = EarlyPool.Get().Detected ? 50 : 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;
        }
예제 #14
0
        public override void OnFrame(Bot bot)
        {
            WarpPrismTask.Task.ArmyUnitTypes.Add(UnitTypes.ADEPT);

            if (bot.Frame == (int)(22.4 * 60 * 3))
            {
                bot.Chat("Use your stalker to clear the scouting overlord from the third if it is there.");
            }
            if (!AttackMessageSent && Completed(UnitTypes.WARP_PRISM) > 0)
            {
                AttackMessageSent = true;
                bot.Chat("Send your adepts straight to the enemy base.");
            }

            if (!WarpPrismTask.Task.WarpInObjectiveSet() &&
                TimingAttackTask.Task.Units.Count > 0 &&
                Bot.Main.Frame % 22 == 0)
            {
                int          warpInsReady = 0;
                RequestQuery query        = new RequestQuery();
                foreach (Agent agent in bot.Units())
                {
                    if (agent.Unit.UnitType == UnitTypes.WARP_GATE)
                    {
                        query.Abilities.Add(new RequestQueryAvailableAbilities()
                        {
                            UnitTag = agent.Unit.Tag
                        });
                    }
                }
                Task <ResponseQuery> task = bot.GameConnection.SendQuery(query);
                task.Wait();
                ResponseQuery response = task.Result;
                foreach (ResponseQueryAvailableAbilities availableAbilities in response.Abilities)
                {
                    foreach (AvailableAbility ability in availableAbilities.Abilities)
                    {
                        if (ability.AbilityId == TrainingType.LookUp[UnitTypes.ZEALOT].WarpInAbility)
                        {
                            warpInsReady++;
                        }
                    }
                }
                if (Completed(UnitTypes.WARP_GATE) == warpInsReady)
                {
                    int desiredAdepts = Math.Min(Minerals() / 100, Math.Min(Completed(UnitTypes.WARP_GATE), 10 - Count(UnitTypes.ZEALOT)));

                    if (desiredAdepts > 0)
                    {
                        WarpPrismTask.Task.AddWarpInObjective(UnitTypes.ADEPT, desiredAdepts);
                    }
                }
            }

            for (int i = IdleTask.Task.Units.Count - 1; i >= 0; i--)
            {
                Agent agent = IdleTask.Task.Units[i];
                if (TimingAttackTask.Task.Units.Count > 0 &&
                    UnitTypes.CombatUnitTypes.Contains(agent.Unit.UnitType) &&
                    agent.DistanceSq(Main.BaseLocation.Pos) >= 50 * 50)
                {
                    IdleTask.Task.RemoveAt(i);
                    TimingAttackTask.Task.Add(agent);
                }
            }

            if (Count(UnitTypes.STALKER) > 0)
            {
                BalanceGas();
            }
            else
            {
                GasWorkerTask.WorkersPerGas = 2;
            }

            bool gatewayExists = false;

            foreach (Agent agent in Bot.Main.Units())
            {
                if (agent.Unit.UnitType == UnitTypes.GATEWAY ||
                    agent.Unit.UnitType == UnitTypes.WARP_GATE)
                {
                    gatewayExists = true;
                }
            }

            WorkerScoutTask.Task.StartFrame = 2240;
            if (gatewayExists && Count(UnitTypes.ASSIMILATOR) == 0)
            {
                ConstructionTask.Task.DedicatedNaturalProbe = false;
                if (ConstructionTask.Task.NaturalProbe != null &&
                    !WorkerScoutTask.Task.Done &&
                    WorkerScoutTask.Task.Units.Count == 0)
                {
                    for (int i = 0; i < ConstructionTask.Task.Units.Count; i++)
                    {
                        if (ConstructionTask.Task.Units[i] == ConstructionTask.Task.NaturalProbe)
                        {
                            ConstructionTask.Task.RemoveAt(i);
                            WorkerScoutTask.Task.Add(ConstructionTask.Task.NaturalProbe);
                            ConstructionTask.Task.NaturalProbe = null;
                            break;
                        }
                    }
                }
            }
            else
            {
                ConstructionTask.Task.DedicatedNaturalProbe = Count(UnitTypes.CYBERNETICS_CORE) == 0;
            }

            int wallDone = 0;

            foreach (WallBuilding building in WallIn.Wall)
            {
                if (!BuildingType.LookUp.ContainsKey(building.Type))
                {
                    wallDone++;
                    continue;
                }
                foreach (Agent agent in bot.UnitManager.Agents.Values)
                {
                    if (agent.DistanceSq(building.Pos) <= 1 * 1)
                    {
                        wallDone++;
                        break;
                    }
                }
            }

            HodorTask.Task.Stopped = Count(UnitTypes.NEXUS) >= 3 ||
                                     TimingAttackTask.Task.Units.Count > 0 ||
                                     wallDone < WallIn.Wall.Count ||
                                     Completed(UnitTypes.HIGH_TEMPLAR) + Count(UnitTypes.ARCHON) > 0 ||
                                     (Count(UnitTypes.ADEPT) >= 2 && !AdeptHarassMainTask.Task.Sent) ||
                                     (EnemyCount(UnitTypes.ZERGLING) == 0 && EnemyCount(UnitTypes.ROACH) > 0 ||
                                      EnemyCount(UnitTypes.NYDUS_CANAL) > 0);
            if (HodorTask.Task.Stopped)
            {
                HodorTask.Task.Clear();
            }

            WorkerScoutTask.Task.StopAndClear(WorkerScoutTask.Task.BaseCircled());

            if (WallIn.Wall.Count >= 5)
            {
                HodorTask.Task.Target = WallIn.Wall[2].Pos;
            }
            else
            {
                HodorTask.Task.Stopped = true;
                HodorTask.Task.Clear();
            }

            foreach (Agent agent in bot.UnitManager.Agents.Values)
            {
                if (bot.Frame % 224 != 0)
                {
                    break;
                }
                if (agent.Unit.UnitType != UnitTypes.GATEWAY)
                {
                    continue;
                }

                if (Count(UnitTypes.NEXUS) < 3 &&
                    TimingAttackTask.Task.Units.Count == 0)
                {
                    agent.Order(Abilities.MOVE, Natural.BaseLocation.Pos);
                }
                else
                {
                    agent.Order(Abilities.MOVE, bot.TargetManager.PotentialEnemyStartLocations[0]);
                }
            }
            if (EarlyPool.Get().Detected)
            {
                bot.NexusAbilityManager.Stopped = Count(UnitTypes.ZEALOT) == 0;
                bot.NexusAbilityManager.PriotitizedAbilities.Add(TrainingType.LookUp[UnitTypes.ZEALOT].Ability);
            }
            else
            {
                bot.NexusAbilityManager.OnlyChronoPrioritizedUnits = Completed(UnitTypes.WARP_PRISM) == 0;
                bot.NexusAbilityManager.PriotitizedAbilities.Add(TrainingType.LookUp[UnitTypes.WARP_PRISM].Ability);
                bot.NexusAbilityManager.PriotitizedAbilities.Add(TrainingType.LookUp[UnitTypes.STALKER].Ability);
                bot.NexusAbilityManager.PriotitizedAbilities.Add(UpgradeType.LookUp[UpgradeType.ResonatingGlaives].Ability);
            }

            if (Completed(UnitTypes.WARP_PRISM) > 0)
            {
                TimingAttackTask.Task.RequiredSize = 4;
            }
            else
            {
                TimingAttackTask.Task.RequiredSize = 30;
            }
            TimingAttackTask.Task.RetreatSize = 0;

            foreach (WorkerDefenseTask task in WorkerDefenseTask.Tasks)
            {
                task.Stopped = Completed(UnitTypes.ZEALOT) + Completed(UnitTypes.IMMORTAL) + Completed(UnitTypes.ADEPT) >= 2;
            }


            if (Count(UnitTypes.NEXUS) >= 3 ||
                (Completed(UnitTypes.HIGH_TEMPLAR) + Count(UnitTypes.ARCHON) > 0))
            {
                IdleTask.Task.OverrideTarget = OverrideDefenseTarget;
            }
            else
            {
                IdleTask.Task.OverrideTarget = NaturalDefensePos;
            }

            ArchonMergeTask.Task.MergePos = OverrideDefenseTarget;

            DefenseTask.GroundDefenseTask.BufferZone          = 5;
            DefenseTask.GroundDefenseTask.ExpandDefenseRadius = 30;
            DefenseTask.GroundDefenseTask.MainDefenseRadius   = EarlyPool.Get().Detected ? 50 : 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;
        }
예제 #15
0
        public override void OnFrame(Bot bot)
        {
            BalanceGas();

            if (bot.Observation.ActionErrors != null && bot.Observation.ActionErrors.Count > 0)
            {
                FileUtil.Debug("Errors for frame: " + bot.Frame);
                foreach (ActionError error in bot.Observation.ActionErrors)
                {
                    FileUtil.Debug(error.Result + " ability: " + error.AbilityId);
                }
                FileUtil.Debug("");
            }

            bot.NexusAbilityManager.PriotitizedAbilities.Add(917);

            if (bot.EnemyStrategyAnalyzer.Count(UnitTypes.BATTLECRUISER) > 0)
            {
                BattlecruisersDetected = true;
            }

            if (FourRax.Get().Detected)
            {
                FourRaxSuspected = true;
            }
            if (!FourRaxSuspected)
            {
                Point2D enemyRamp             = bot.MapAnalyzer.GetEnemyRamp();
                int     enemyBarrackWallCount = 0;
                foreach (Unit enemy in bot.Enemies())
                {
                    if (enemyRamp == null)
                    {
                        break;
                    }
                    if (enemy.UnitType == UnitTypes.BARRACKS && SC2Util.DistanceSq(enemy.Pos, enemyRamp) <= 5.5 * 5.5)
                    {
                        enemyBarrackWallCount++;
                    }
                }
                if (enemyBarrackWallCount >= 2)
                {
                    WorkerScoutTask.Stopped = true;
                    WorkerScoutTask.Clear();
                    FourRaxSuspected = true;
                }
            }

            /*
             * if (BattlecruisersDetected ||
             *  (bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.WIDOW_MINE) >= 12 && bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.MARINE) < 80))
             * {
             *  attackTask.RequiredSize = 30;
             *  attackTask.RetreatSize = 8;
             * }
             * else if (Count(UnitTypes.ARCHON) + Count(UnitTypes.IMMORTAL) >= 14)
             * {
             *  attackTask.RequiredSize = 35;
             *  attackTask.RetreatSize = 10;
             * }
             * else
             * {
             *  attackTask.RequiredSize = 40;
             *  attackTask.RetreatSize = 10;
             * }
             */
            attackTask.RequiredSize = 4;

            if (Count(UnitTypes.ZEALOT) + Count(UnitTypes.ADEPT) + Count(UnitTypes.STALKER) + Count(UnitTypes.IMMORTAL) >= attackTask.RequiredSize)
            {
                Attacking = true;
            }

            foreach (WorkerDefenseTask task in WorkerDefenseTask.Tasks)
            {
                task.Stopped = Completed(UnitTypes.ZEALOT) >= 5;
            }


            foreach (DefenseSquadTask task in StalkerDefenseSquads)
            {
                task.Stopped      = (bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.REAPER) < 3 && bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.BANSHEE) == 0 || bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.MARINE) + bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.MARAUDER) >= 10);
                task.MaxDefenders = Math.Min(5, Completed(UnitTypes.STALKER) / Math.Max(1, Count(UnitTypes.NEXUS)));
                task.Priority     = 10;
            }

            if (bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.REAPER) >= 3 || bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.BANSHEE) > 0)
            {
                DefenseTask.AirDefenseTask.IgnoreEnemyTypes.Add(UnitTypes.VIKING_FIGHTER);
                DefenseTask.GroundDefenseTask.IgnoreEnemyTypes.Add(UnitTypes.REAPER);
                bot.buildingPlacer.SpreadCannons = true;
                attackTask.DefendOtherAgents     = false;
            }

            FearSpinesController.Stopped = !SpinePushDetected;

            if (bot.EnemyRace == Race.Zerg)
            {
                if (bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.MUTALISK)
                    + bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.BROOD_LORD)
                    + bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.CORRUPTOR)
                    + bot.EnemyStrategyAnalyzer.Count(UnitTypes.SPIRE)
                    + bot.EnemyStrategyAnalyzer.Count(UnitTypes.GREATER_SPIRE) > 0)
                {
                    DesiredStalkers = 15;
                }
                else
                {
                    DesiredStalkers = 2;
                }
            }

            if (Count(UnitTypes.NEXUS) >= 3)
            {
                IdleTask.Task.OverrideTarget = OverrideDefenseTarget;
            }
            else
            {
                IdleTask.Task.OverrideTarget = null;
            }

            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 (EarlyPool.Get().Detected&& !Expanded.Get().Detected&& Completed(UnitTypes.ZEALOT) < 2)
            {
                foreach (Agent agent in bot.UnitManager.Agents.Values)
                {
                    if (agent.Unit.UnitType == UnitTypes.NEXUS &&
                        agent.Unit.BuildProgress < 0.99)
                    {
                        agent.Order(Abilities.CANCEL);
                    }
                }
            }
        }
예제 #16
0
        private BuildList MainBuild()
        {
            BuildList result = new BuildList();

            result.Building(UnitTypes.NEXUS);
            result.Building(UnitTypes.PYLON, Main, WallIn.Wall[1].Pos, true);
            result.Building(UnitTypes.GATEWAY, Main, WallIn.Wall[0].Pos, true, () => Completed(UnitTypes.PYLON) > 0);
            if (Bot.Main.EnemyRace != Race.Terran)
            {
                result.If(() => { return(!EarlyPool.Get().Detected || Expanded.Get().Detected || Completed(UnitTypes.STALKER) + Completed(UnitTypes.ADEPT) >= 5); });
            }
            result.Building(UnitTypes.NEXUS);
            result.Building(UnitTypes.ASSIMILATOR);
            result.Building(UnitTypes.CYBERNETICS_CORE);
            result.Building(UnitTypes.GATEWAY, Main);
            result.Upgrade(UpgradeType.WarpGate);
            result.Building(UnitTypes.PYLON, Natural, () => FourRaxSuspected);
            result.Building(UnitTypes.GATEWAY, Natural, () => FourRaxSuspected && Completed(Natural, UnitTypes.PYLON) > 0);
            result.Building(UnitTypes.SHIELD_BATTERY, Natural, 2, () => FourRaxSuspected && Completed(Natural, UnitTypes.PYLON) > 0);
            result.Building(UnitTypes.FORGE, () => FourRaxSuspected && Count(UnitTypes.GATEWAY) >= 3);
            result.Building(UnitTypes.PHOTON_CANNON, Natural, 4, () => FourRaxSuspected);
            result.Building(UnitTypes.ASSIMILATOR, () => FourRaxSuspected && Minerals() >= 600);
            result.Building(UnitTypes.ASSIMILATOR, () => FourRaxSuspected && Minerals() >= 800);
            //result.If(() => !FourRaxSuspected || Count(UnitTypes.STALKER) >= 10);
            result.Building(UnitTypes.ROBOTICS_FACILITY);
            result.Building(UnitTypes.PYLON, Natural, () => !FourRaxSuspected);
            result.Building(UnitTypes.ASSIMILATOR, () => !FourRaxSuspected || Count(UnitTypes.PHOTON_CANNON) >= 2);
            result.Building(UnitTypes.NEXUS);
            result.Building(UnitTypes.PYLON);
            result.Building(UnitTypes.ASSIMILATOR, 2, () => Bot.Main.EnemyStrategyAnalyzer.TotalCount(UnitTypes.BANSHEE) >= 3);
            result.Building(UnitTypes.TWILIGHT_COUNSEL);
            result.Building(UnitTypes.FORGE);
            result.Upgrade(UpgradeType.ProtossGroundWeapons);
            result.Building(UnitTypes.FORGE, () => !FourRaxSuspected);
            result.Upgrade(UpgradeType.ProtossGroundArmor);
            result.Building(UnitTypes.PYLON);
            result.Building(UnitTypes.TEMPLAR_ARCHIVE);
            result.Building(UnitTypes.NEXUS);
            result.Building(UnitTypes.ROBOTICS_FACILITY, () => !BattlecruisersDetected && Bot.Main.EnemyStrategyAnalyzer.TotalCount(UnitTypes.BANSHEE) == 0);
            result.Building(UnitTypes.ASSIMILATOR, 2);
            result.Building(UnitTypes.ASSIMILATOR, 4, () => Minerals() >= 500 && Gas() < 200);
            //result.Building(UnitTypes.STARGATE);
            //result.Building(UnitTypes.FLEET_BEACON);
            //result.If(() => Count(UnitTypes.IMMORTAL) >= 3 && Count(UnitTypes.STALKER) >= 10);
            //result.Building(UnitTypes.ROBOTICS_BAY, () => !BattlecruisersDetected && Tyr.Bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.BANSHEE) == 0);
            result.Building(UnitTypes.STARGATE, () => BattlecruisersDetected || Bot.Main.EnemyStrategyAnalyzer.TotalCount(UnitTypes.BANSHEE) > 0);
            result.Building(UnitTypes.FLEET_BEACON, () => Completed(UnitTypes.STARGATE) > 0);
            //result.If(() => Count(UnitTypes.STALKER) >= 20);
            result.Building(UnitTypes.ASSIMILATOR, 2);
            result.Building(UnitTypes.GATEWAY, Main, 2, () => Minerals() >= 500);
            result.Building(UnitTypes.GATEWAY, Main, 2, () => Minerals() >= 500);
            result.Building(UnitTypes.GATEWAY, Main, 2, () => Minerals() >= 500);
            result.If(() => Count(UnitTypes.ZEALOT) >= 20 && Count(UnitTypes.IMMORTAL) + Count(UnitTypes.ARCHON) >= 10);
            result.Building(UnitTypes.NEXUS);
            result.Building(UnitTypes.ASSIMILATOR, 2);
            result.If(() => Completed(UnitTypes.ZEALOT) + Completed(UnitTypes.IMMORTAL) + Completed(UnitTypes.DISRUPTOR) + Completed(UnitTypes.ARCHON) + Completed(UnitTypes.TEMPEST) >= 40 || Minerals() >= 650);
            result.Building(UnitTypes.NEXUS);
            result.Building(UnitTypes.ASSIMILATOR, 2);

            return(result);
        }
예제 #17
0
파일: TwoBaseRobo.cs 프로젝트: evilz/TyrSc2
 public override void Produce(Bot bot, Agent agent)
 {
     if (Count(UnitTypes.PROBE) >= 24 &&
         Count(UnitTypes.NEXUS) < 2 &&
         Minerals() < 450)
     {
         return;
     }
     if (agent.Unit.UnitType == UnitTypes.NEXUS &&
         Minerals() >= 50 &&
         Count(UnitTypes.PROBE) < 44 - Completed(UnitTypes.ASSIMILATOR) &&
         (Count(UnitTypes.NEXUS) >= 2 || Count(UnitTypes.PROBE) < 18 + 2 * Completed(UnitTypes.ASSIMILATOR)))
     {
         if (Count(UnitTypes.PROBE) < 13 || Count(UnitTypes.PYLON) > 0)
         {
             agent.Order(1006);
         }
     }
     else if (agent.Unit.UnitType == UnitTypes.GATEWAY)
     {
         if (Count(UnitTypes.ZEALOT) >= 6 &&
             Count(UnitTypes.NEXUS) < 2 &&
             Minerals() < 500)
         {
             return;
         }
         if (Attacking && Count(UnitTypes.NEXUS) < 3)
         {
             return;
         }
         if (EarlyPool.Get().Detected&& !Expanded.Get().Detected)
         {
             if (Minerals() >= 100 &&
                 (Completed(UnitTypes.CYBERNETICS_CORE) == 0 || Count(UnitTypes.ZEALOT) <= Math.Max(2, Count(UnitTypes.ADEPT))))
             {
                 agent.Order(916);
             }
             else if (Completed(UnitTypes.CYBERNETICS_CORE) > 0 &&
                      Minerals() >= 100 &&
                      Gas() >= 25)
             {
                 agent.Order(922);
             }
         }
         else if (!UseStalkers)
         {
             if (Minerals() >= 50 &&
                 Gas() >= 150 &&
                 Completed(UnitTypes.TEMPLAR_ARCHIVE) > 0 &&
                 Count(UnitTypes.HIGH_TEMPLAR) * 5 < Count(UnitTypes.STALKER) + Count(UnitTypes.ZEALOT) + Count(UnitTypes.ADEPT))
             {
                 agent.Order(919);
             }
             else if (Minerals() >= 100 &&
                      (Completed(UnitTypes.CYBERNETICS_CORE) == 0 || Count(UnitTypes.ZEALOT) <= Count(UnitTypes.ADEPT)) &&
                      (Count(UnitTypes.ZEALOT) < 10 || Gas() < 25))
             {
                 agent.Order(916);
             }
             else if (Completed(UnitTypes.CYBERNETICS_CORE) > 0 &&
                      Minerals() >= 100 &&
                      Gas() >= 25)
             {
                 agent.Order(922);
             }
         }
         else
         {
             if (Minerals() >= 50 &&
                 Gas() >= 150 &&
                 Completed(UnitTypes.TEMPLAR_ARCHIVE) > 0 &&
                 Count(UnitTypes.HIGH_TEMPLAR) * 5 < Count(UnitTypes.STALKER) + Count(UnitTypes.ZEALOT) + Count(UnitTypes.ADEPT))
             {
                 agent.Order(919);
             }
             else if (Minerals() >= 100 &&
                      Gas() <= 200 &&
                      (Completed(UnitTypes.CYBERNETICS_CORE) == 0 || Count(UnitTypes.ZEALOT) <= Count(UnitTypes.STALKER)))
             {
                 agent.Order(916);
             }
             else if (Completed(UnitTypes.CYBERNETICS_CORE) > 0 &&
                      Minerals() >= 125 &&
                      Gas() >= 50)
             {
                 agent.Order(917);
             }
         }
     }
     else if (agent.Unit.UnitType == UnitTypes.ROBOTICS_FACILITY)
     {
         if (Attacking && Count(UnitTypes.NEXUS) < 3)
         {
             return;
         }
         if (Count(UnitTypes.OBSERVER) == 0 &&
             Minerals() >= 25 &&
             Gas() >= 75)
         {
             agent.Order(977);
         }
         else if (Completed(UnitTypes.ROBOTICS_BAY) > 0 &&
                  Minerals() >= 300 &&
                  Gas() >= 200 &&
                  !UseImmortals &&
                  Count(UnitTypes.COLOSUS) < 7)
         {
             agent.Order(978);
         }
         else if (Minerals() >= 250 &&
                  Gas() >= 100 &&
                  UseImmortals)
         {
             agent.Order(979);
         }
     }
     else if (agent.Unit.UnitType == UnitTypes.ROBOTICS_BAY)
     {
         if (Minerals() >= 150 &&
             Gas() >= 150 &&
             !Bot.Main.Observation.Observation.RawData.Player.UpgradeIds.Contains(50) &&
             !UseImmortals)
         {
             agent.Order(1097);
         }
     }
     else if (agent.Unit.UnitType == UnitTypes.TEMPLAR_ARCHIVE)
     {
         if (!Bot.Main.Observation.Observation.RawData.Player.UpgradeIds.Contains(52) &&
             Minerals() >= 200 &&
             Gas() >= 200)
         {
             agent.Order(1126);
         }
     }
     else if (agent.Unit.UnitType == UnitTypes.TWILIGHT_COUNSEL)
     {
         if (UseStalkers)
         {
             if (!Bot.Main.Observation.Observation.RawData.Player.UpgradeIds.Contains(87) &&
                 Minerals() >= 150 &&
                 Gas() >= 150)
             {
                 agent.Order(1593);
             }
         }
         else
         {
             if (!Bot.Main.Observation.Observation.RawData.Player.UpgradeIds.Contains(130) &&
                 Minerals() >= 100 &&
                 Gas() >= 100)
             {
                 agent.Order(1594);
             }
             else if (!Bot.Main.Observation.Observation.RawData.Player.UpgradeIds.Contains(86) &&
                      Minerals() >= 100 &&
                      Gas() >= 100)
             {
                 agent.Order(1592);
             }
         }
     }
 }
예제 #18
0
        public override void OnFrame(Bot bot)
        {
            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;

            bot.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();
             */

            bot.NexusAbilityManager.Stopped = Count(UnitTypes.STALKER) == 0 && bot.Frame >= 120 * 22.4;
            bot.NexusAbilityManager.PriotitizedAbilities.Add(917);

            if (bot.EnemyStrategyAnalyzer.Count(UnitTypes.BATTLECRUISER) > 0)
            {
                BattlecruisersDetected = true;
            }

            if (FourRax.Get().Detected)
            {
                FourRaxSuspected = true;
            }
            if (ProxyDetected.Get().Detected)
            {
                FourRaxSuspected = true;
            }
            if (WorkerScoutTask.Task.BaseCircled() &&
                bot.Frame < 22.4 * 60 * 2 &&
                TotalEnemyCount(UnitTypes.BARRACKS) == 0)
            {
                FourRaxSuspected = true;
            }
            if (!FourRaxSuspected)
            {
                Point2D enemyRamp             = bot.MapAnalyzer.GetEnemyRamp();
                int     enemyBarrackWallCount = 0;
                foreach (Unit enemy in bot.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)
            {
                bot.TargetManager.TargetAllBuildings = true;
                FallBackController.Stopped           = true;
            }
            bot.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 bot.Units())
                {
                    if (agent.Unit.UnitType != UnitTypes.NEXUS)
                    {
                        continue;
                    }
                    if (agent.Unit.BuildProgress >= 0.99)
                    {
                        continue;
                    }
                    agent.Order(Abilities.CANCEL);
                }
            }


            bot.DrawText("Defending units: " + DefenseTask.GroundDefenseTask.Units.Count);
            bot.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 (bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.REAPER) >= 3 || bot.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 (EarlyPool.Get().Detected&& !Expanded.Get().Detected&& Completed(UnitTypes.ZEALOT) < 2)
            {
                foreach (Agent agent in bot.UnitManager.Agents.Values)
                {
                    if (agent.Unit.UnitType == UnitTypes.NEXUS &&
                        agent.Unit.BuildProgress < 0.99)
                    {
                        agent.Order(Abilities.CANCEL);
                    }
                }
            }
        }
예제 #19
0
파일: TwoBaseRobo.cs 프로젝트: evilz/TyrSc2
        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 (StrategyAnalysis.CannonRush.Get().Detected)
            {
                attackTask.RequiredSize = 5;
            }

            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 (EarlyPool.Get().Detected&& !Expanded.Get().Detected&& Completed(UnitTypes.ZEALOT) < 2)
            {
                foreach (Agent agent in bot.UnitManager.Agents.Values)
                {
                    if (agent.Unit.UnitType == UnitTypes.NEXUS &&
                        agent.Unit.BuildProgress < 0.99)
                    {
                        agent.Order(Abilities.CANCEL);
                    }
                }
            }

            if (MassHydra.Get().Detected)
            {
                UseStalkers  = false;
                UseImmortals = false;
            }
            else if (MassRoach.Get().Detected)
            {
                UseStalkers  = true;
                UseImmortals = true;
            }
            else if (bot.EnemyStrategyAnalyzer.EncounteredEnemies.Contains(UnitTypes.HYDRALISK) || bot.EnemyStrategyAnalyzer.EncounteredEnemies.Contains(UnitTypes.HYDRALISK_DEN))
            {
                UseStalkers  = false;
                UseImmortals = false;
            }
            else if (bot.EnemyStrategyAnalyzer.EncounteredEnemies.Contains(UnitTypes.ROACH) || bot.EnemyStrategyAnalyzer.EncounteredEnemies.Contains(UnitTypes.ROACH_WARREN))
            {
                UseStalkers  = true;
                UseImmortals = true;
            }
            else
            {
                UseStalkers  = bot.EnemyRace == Race.Protoss || (MassRoach.Get().DetectedPreviously&& !MassHydra.Get().DetectedPreviously);
                UseImmortals = (MassRoach.Get().DetectedPreviously&& !MassHydra.Get().DetectedPreviously);
            }
        }
예제 #20
0
        public override void OnFrame(Bot bot)
        {
            if (Count(UnitTypes.PROBE) <= 10)
            {
                GasWorkerTask.WorkersPerGas = 0;
            }
            else if (Count(UnitTypes.NEXUS) < 3)
            {
                GasWorkerTask.WorkersPerGas = 2;
            }
            else
            {
                BalanceGas();
            }

            if (!CannonDefenseDetected && bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.PHOTON_CANNON) + bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.FORGE) >= 0 && bot.Frame < 22.4 * 60 * 4)
            {
                CannonDefenseDetected = true;
            }

            if (!TempestDetected && bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.TEMPEST) > 0)
            {
                TempestDetected = true;
            }

            bot.NexusAbilityManager.PriotitizedAbilities.Add(917);

            if (bot.EnemyStrategyAnalyzer.Count(UnitTypes.BATTLECRUISER) > 0)
            {
                BattlecruisersDetected = true;
            }

            if (TempestDetected)
            {
                AttackTask.RequiredSize = 25;
                AttackTask.RetreatSize  = 8;
            }
            else if (BattlecruisersDetected)
            {
                AttackTask.RequiredSize = 40;
                AttackTask.RetreatSize  = 10;
            }
            else
            {
                AttackTask.RequiredSize = 15;
                AttackTask.RetreatSize  = 6;
            }

            foreach (WallBuilding building in WallIn.Wall)
            {
                bot.DrawSphere(new Point()
                {
                    X = building.Pos.X, Y = building.Pos.Y, Z = bot.MapAnalyzer.StartLocation.Z
                });
            }

            foreach (WorkerDefenseTask task in WorkerDefenseTask.Tasks)
            {
                task.Stopped = Completed(UnitTypes.ZEALOT) >= 5;
            }

            if (StrategyAnalysis.CannonRush.Get().Detected)
            {
                AttackTask.RequiredSize = 5;
            }
            else if (SmellCheese)
            {
                AttackTask.RequiredSize = 30;
            }

            if (Natural.Owner == bot.PlayerId && Count(UnitTypes.NEXUS) < 3 && Completed(UnitTypes.STALKER) < 15)
            {
                IdleTask.Task.OverrideTarget = SC2Util.Point((bot.MapAnalyzer.GetMainRamp().X + Natural.BaseLocation.Pos.X) / 2f, (bot.MapAnalyzer.GetMainRamp().Y + Natural.BaseLocation.Pos.Y) / 2f);
            }
            else if (Count(UnitTypes.NEXUS) >= 4)
            {
                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 (TempestDetected && Count(UnitTypes.STALKER) + Count(UnitTypes.VOID_RAY) >= 12)
            {
                DefenseTask.AirDefenseTask.ExpandDefenseRadius = 40;
                DefenseTask.AirDefenseTask.MainDefenseRadius   = 40;
                DefenseTask.AirDefenseTask.MaxDefenseRadius    = 120;
                DefenseTask.AirDefenseTask.DrawDefenderRadius  = 120;
            }
            else
            {
                DefenseTask.AirDefenseTask.ExpandDefenseRadius = 25;
                DefenseTask.AirDefenseTask.MainDefenseRadius   = 30;
                DefenseTask.AirDefenseTask.MaxDefenseRadius    = 120;
                DefenseTask.AirDefenseTask.DrawDefenderRadius  = 80;
            }

            if (EarlyPool.Get().Detected&& !Expanded.Get().Detected&& Completed(UnitTypes.ZEALOT) < 2)
            {
                foreach (Agent agent in bot.UnitManager.Agents.Values)
                {
                    if (agent.Unit.UnitType == UnitTypes.NEXUS &&
                        agent.Unit.BuildProgress < 0.99)
                    {
                        agent.Order(Abilities.CANCEL);
                    }
                }
            }
        }
예제 #21
0
        public override void OnFrame(Bot bot)
        {
            BalanceGas();

            if (ProxyPylon && ProxyTask.Task.UnitCounts.ContainsKey(UnitTypes.PYLON) && ProxyTask.Task.UnitCounts[UnitTypes.PYLON] > 0)
            {
                ProxyPylon             = false;
                ProxyTask.Task.Stopped = true;
                ProxyTask.Task.Clear();
            }

            int wallDone = 0;

            foreach (WallBuilding building in WallIn.Wall)
            {
                if (!BuildingType.LookUp.ContainsKey(building.Type))
                {
                    wallDone++;
                    continue;
                }
                foreach (Agent agent in bot.UnitManager.Agents.Values)
                {
                    if (agent.DistanceSq(building.Pos) <= 1 * 1)
                    {
                        wallDone++;
                        break;
                    }
                }
            }

            FallBackController.Stopped = (Count(UnitTypes.NEXUS) < 3 && TimingAttackTask.Task.Units.Count == 0) ||
                                         EarlyPool.Get().Detected ||
                                         MassZerglings;
            StutterForwardController.Stopped = Count(UnitTypes.NEXUS) >= 3 || TimingAttackTask.Task.Units.Count > 0 || Completed(UnitTypes.ZEALOT) > 0;
            HodorTask.Task.Stopped           = Count(UnitTypes.NEXUS) >= 3 ||
                                               TimingAttackTask.Task.Units.Count > 0 ||
                                               (EarlyPool.Get().Detected&& Completed(UnitTypes.ZEALOT) >= 2) ||
                                               wallDone < WallIn.Wall.Count;
            if (HodorTask.Task.Stopped)
            {
                HodorTask.Task.Clear();
            }

            if (EarlyPool.Get().Detected || bot.Frame >= 1800)
            {
                WorkerScoutTask.Task.Stopped = true;
                WorkerScoutTask.Task.Clear();
            }

            if (WallIn.Wall.Count >= 5)
            {
                HodorTask.Task.Target = WallIn.Wall[2].Pos;
            }
            else
            {
                HodorTask.Task.Stopped = true;
                HodorTask.Task.Clear();
            }

            foreach (Agent agent in bot.UnitManager.Agents.Values)
            {
                if (bot.Frame % 224 != 0)
                {
                    break;
                }
                if (agent.Unit.UnitType != UnitTypes.GATEWAY)
                {
                    continue;
                }

                if (Count(UnitTypes.NEXUS) < 3 && TimingAttackTask.Task.Units.Count == 0)
                {
                    agent.Order(Abilities.MOVE, Natural.BaseLocation.Pos);
                }
                else
                {
                    agent.Order(Abilities.MOVE, bot.TargetManager.PotentialEnemyStartLocations[0]);
                }
            }

            if (!MassZerglings &&
                !EarlyPool.Get().Detected &&
                bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.ZERGLING) >= 60 &&
                bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.ROACH) == 0 &&
                bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.HYDRALISK) == 0)
            {
                MassZerglings = true;
                TimingAttackTask.Task.Clear();
            }
            bot.DrawText("Zergling count: " + bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.ZERGLING));

            //WorkerScoutTask.Task.StartFrame = 600;
            ObserverScoutTask.Task.Priority = 6;

            ForwardProbeTask.Task.Stopped = Completed(UnitTypes.STALKER) + Count(UnitTypes.ADEPT) + Count(UnitTypes.IMMORTAL) < 12;

            if (ForwardProbeTask.Task.Stopped)
            {
                ForwardProbeTask.Task.Clear();
            }


            if (EarlyPool.Get().Detected)
            {
                bot.NexusAbilityManager.Stopped = Count(UnitTypes.ZEALOT) == 0;
                bot.NexusAbilityManager.PriotitizedAbilities.Add(916);
            }
            bot.NexusAbilityManager.PriotitizedAbilities.Add(917);

            if (EarlyPool.Get().Detected ||
                MassZerglings)
            {
                TimingAttackTask.Task.RequiredSize = 24;
            }
            else
            {
                TimingAttackTask.Task.RequiredSize = 12;
            }
            TimingAttackTask.Task.RetreatSize = 0;

            foreach (WorkerDefenseTask task in WorkerDefenseTask.Tasks)
            {
                task.Stopped = Completed(UnitTypes.ZEALOT) + Completed(UnitTypes.STALKER) + Completed(UnitTypes.IMMORTAL) >= 3;
            }


            if (Count(UnitTypes.NEXUS) >= 3)
            {
                IdleTask.Task.OverrideTarget = OverrideDefenseTarget;
            }
            else
            {
                IdleTask.Task.OverrideTarget = NaturalDefensePos;
            }

            DefenseTask.GroundDefenseTask.ExpandDefenseRadius = 30;
            DefenseTask.GroundDefenseTask.MainDefenseRadius   = EarlyPool.Get().Detected ? 50 : 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;
        }
예제 #22
0
파일: MacroToss.cs 프로젝트: evilz/TyrSc2
        public override void OnFrame(Bot bot)
        {
            BalanceGas();

            TimedObserverTask.Target  = bot.TargetManager.PotentialEnemyStartLocations[0];
            TimedObserverTask.Stopped = bot.Frame < 22.4 * 60 * 6 || bot.Frame >= 22.4 * 60 * 7 || bot.EnemyStrategyAnalyzer.Count(UnitTypes.SPIRE) > 0;
            if (TimedObserverTask.Stopped)
            {
                TimedObserverTask.Clear();
            }

            if (Count(UnitTypes.ZEALOT) + Count(UnitTypes.ADEPT) + Count(UnitTypes.STALKER) + Count(UnitTypes.IMMORTAL) >= attackTask.RequiredSize)
            {
                Attacking = true;
            }

            foreach (WallBuilding building in WallIn.Wall)
            {
                bot.DrawSphere(new Point()
                {
                    X = building.Pos.X, Y = building.Pos.Y, Z = bot.MapAnalyzer.StartLocation.Z
                });
            }

            foreach (WorkerDefenseTask task in WorkerDefenseTask.Tasks)
            {
                task.Stopped = Completed(UnitTypes.ZEALOT) >= 5;
            }

            if (Bot.Main.EnemyStrategyAnalyzer.TotalCount(UnitTypes.ZERGLING) >= 5 && bot.Frame <= 22.4 * 60 * 2)
            {
                SmellCheese = true;
            }
            if (Bot.Main.EnemyStrategyAnalyzer.Count(UnitTypes.SPAWNING_POOL) > 0 && bot.Frame <= 22.4 * 60 * 1.4 && !Expanded.Get().Detected)
            {
                SmellCheese = true;
            }
            if (!SpinePushDetected && SmellCheese)
            {
                foreach (Unit enemy in bot.Enemies())
                {
                    if (enemy.UnitType != UnitTypes.QUEEN && enemy.UnitType != UnitTypes.SPINE_CRAWLER && enemy.UnitType != UnitTypes.SPINE_CRAWLER_UPROOTED)
                    {
                        continue;
                    }
                    if (SC2Util.DistanceSq(enemy.Pos, bot.MapAnalyzer.StartLocation) <= 50 * 50)
                    {
                        SpinePushDetected = true;
                        break;
                    }
                }
            }

            FearSpinesController.Stopped = !SpinePushDetected;

            if (bot.EnemyRace == Race.Zerg)
            {
                if (bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.MUTALISK)
                    + bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.BROOD_LORD)
                    + bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.CORRUPTOR)
                    + bot.EnemyStrategyAnalyzer.Count(UnitTypes.SPIRE)
                    + bot.EnemyStrategyAnalyzer.Count(UnitTypes.GREATER_SPIRE) > 0)
                {
                    DesiredStalkers = 15;
                }
                else
                {
                    DesiredStalkers = 2;
                }
            }

            if (StrategyAnalysis.CannonRush.Get().Detected)
            {
                attackTask.RequiredSize = 5;
            }
            else if (SmellCheese)
            {
                attackTask.RequiredSize = 30;
            }

            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;

            DefenseTask.AirDefenseTask.ExpandDefenseRadius = 25;
            DefenseTask.AirDefenseTask.MainDefenseRadius   = 30;
            DefenseTask.AirDefenseTask.MaxDefenseRadius    = 120;
            DefenseTask.AirDefenseTask.DrawDefenderRadius  = 80;

            if (EarlyPool.Get().Detected&& !Expanded.Get().Detected&& Completed(UnitTypes.ZEALOT) < 2)
            {
                foreach (Agent agent in bot.UnitManager.Agents.Values)
                {
                    if (agent.Unit.UnitType == UnitTypes.NEXUS &&
                        agent.Unit.BuildProgress < 0.99)
                    {
                        agent.Order(Abilities.CANCEL);
                    }
                }
            }
        }
예제 #23
0
파일: PvZHjax.cs 프로젝트: evilz/TyrSc2
        public override void OnFrame(Bot bot)
        {
            /*
             * if (bot.Frame == 0)
             * {
             *  FileUtil.WriteToFile("ArmyAnalysis.txt", "Started game against " + bot.OpponentID + " on map " + bot.GameInfo.MapName, false);
             *  FileUtil.WriteToFile("ArmyAnalysis.txt", "", false);
             * }
             * if (bot.Frame % 224 == 0)
             * {
             *  List<uint> myUnitTypes = new List<uint>() { UnitTypes.ZEALOT, UnitTypes.ADEPT, UnitTypes.STALKER, UnitTypes.ARCHON, UnitTypes.IMMORTAL, UnitTypes.COLOSUS };
             *  List<uint> enemyUnitTypes = new List<uint>() { UnitTypes.ZERGLING, UnitTypes.QUEEN, UnitTypes.BANELING, UnitTypes.ROACH, UnitTypes.RAVAGER, UnitTypes.HYDRALISK, UnitTypes.MUTALISK, UnitTypes.CORRUPTOR, UnitTypes.BROOD_LORD, UnitTypes.LURKER};
             *
             *  List<string> myUnitResults = new List<string>();
             *  foreach (uint myUnitType in myUnitTypes)
             *  {
             *      int completed = Completed(myUnitType);
             *      if (completed == 0)
             *          continue;
             *      myUnitResults.Add(UnitTypes.LookUp[myUnitType].Name + ":" + completed);
             *  }
             *  List<string> enemyUnitResults = new List<string>();
             *  foreach (uint enemyUnitType in enemyUnitTypes)
             *  {
             *      int completed = EnemyCount(enemyUnitType);
             *      if (completed == 0)
             *          continue;
             *      enemyUnitResults.Add(UnitTypes.LookUp[enemyUnitType].Name + ":" + completed);
             *  }
             *
             *
             *  FileUtil.WriteToFile("ArmyAnalysis.txt", "State at: " + (int)((bot.Frame / 22.4) / 60) + ":" + (int)(bot.Frame / 22.4) % 60, false);
             *  FileUtil.WriteToFile("ArmyAnalysis.txt", "MyUnits: {" + string.Join(", ", myUnitResults) + "}", false);
             *  FileUtil.WriteToFile("ArmyAnalysis.txt", "EnemyUnits: {" + string.Join(", ", enemyUnitResults) + "}", false);
             *  FileUtil.WriteToFile("ArmyAnalysis.txt", "SimulationResult me: " + bot.TaskManager.CombatSimulation.MyStartResources + "-> " + bot.TaskManager.CombatSimulation.MyFinalResources + " his: " + bot.TaskManager.CombatSimulation.EnemyStartResources + "-> " + bot.TaskManager.CombatSimulation.EnemyFinalResources, false);
             *  FileUtil.WriteToFile("ArmyAnalysis.txt", "", false);
             *
             * }
             */

            if (!EnemyAttackPerformed &&
                (EarlyPool.Get().Detected || RoachRushDetected))
            {
                int enemyCount = 0;
                foreach (Unit enemy in bot.Enemies())
                {
                    if (enemy.UnitType != UnitTypes.ZERGLING &&
                        enemy.UnitType != UnitTypes.ROACH)
                    {
                        continue;
                    }
                    if (SC2Util.DistanceSq(enemy.Pos, bot.MapAnalyzer.StartLocation) <= 60 * 60)
                    {
                        enemyCount += enemy.UnitType == UnitTypes.ZERGLING ? 1 : 3;
                    }
                }
                if (enemyCount > 6)
                {
                    EnemyAttackPerformed = true;
                }
            }

            FearSpinesController.Stopped = Completed(UnitTypes.IMMORTAL) >= 2;

            ScoutTask.Task.ScoutType = UnitTypes.PHOENIX;
            ScoutTask.Task.Target    = bot.TargetManager.PotentialEnemyStartLocations[0];

            if (!TimingAttackTask.Task.AttackSent)
            {
                foreach (Agent agent in bot.Units())
                {
                    if (agent.Unit.UnitType != UnitTypes.SENTRY)
                    {
                        continue;
                    }
                    if (agent.Unit.Energy < 75)
                    {
                        continue;
                    }
                    // Hallucinate scouting phoenix.
                    agent.Order(154);
                }
            }

            bot.DrawText("early pool detected: " + EarlyPool.Get().Detected);
            if (EarlyPool.Get().Detected)
            {
                AdeptHarassMainTask.Task.Sent = true;
            }


            if (!ActiveHatchery)
            {
                foreach (Unit enemy in Bot.Main.Enemies())
                {
                    if (enemy.UnitType != UnitTypes.HATCHERY)
                    {
                        continue;
                    }
                    if (enemy.IsActive)
                    {
                        ActiveHatchery = true;
                    }
                    break;
                }
            }

            if (!RoachRushDetected && CounterRoaches)
            {
                if (Bot.Main.Frame < 22.4 * 60 * 4.5 &&
                    TotalEnemyCount(UnitTypes.ROACH_WARREN) > 0)
                {
                    RoachRushDetected = true;
                }
                if (Bot.Main.Frame < 22.4 * 60 * 2.5 &&
                    TotalEnemyCount(UnitTypes.LAIR) > 0)
                {
                    RoachRushDetected = true;
                }
                if (Bot.Main.Frame < 22.4 * 60 * 2.5 &&
                    ActiveHatchery &&
                    EarlyPool.Get().Detected)
                {
                    RoachRushDetected = true;
                }
                else if (Bot.Main.Frame < 22.4 * 60 * 5 &&
                         TotalEnemyCount(UnitTypes.ROACH) > 0)
                {
                    RoachRushDetected = true;
                }
                else if (Bot.Main.Frame < 22.4 * 60 * 5 &&
                         EnemyCount(UnitTypes.ROACH_WARREN) > 0)
                {
                    foreach (Unit enemy in bot.Enemies())
                    {
                        if (enemy.UnitType == UnitTypes.ROACH_WARREN &&
                            enemy.BuildProgress > 0.99)
                        {
                            RoachRushDetected = true;
                            break;
                        }
                    }
                }
            }

            RoboArmy = RoachRushDetected || TotalEnemyCount(UnitTypes.ROACH) + TotalEnemyCount(UnitTypes.RAVAGER) + TotalEnemyCount(UnitTypes.HYDRALISK) >= 15;
            bot.DrawText("RoboArmy: " + RoboArmy);

            if (!WarpPrismTask.Task.WarpInObjectiveSet() &&
                TimingAttackTask.Task.Units.Count > 0 &&
                Bot.Main.Frame % 112 == 0)
            {
                int desiredZealots = Math.Min(Minerals() / 100, Math.Min(Completed(UnitTypes.WARP_GATE), 10 - Count(UnitTypes.ZEALOT)));
                if (desiredZealots > 0)
                {
                    WarpPrismTask.Task.AddWarpInObjective(UnitTypes.ZEALOT, desiredZealots);
                }
            }

            //if (Minerals() >= 600)
            //    InitialAttackDone = true;

            if (!InitialAttackDone &&
                TimingAttackTask.Task.AttackSent)
            {
                int immortalArchonCount = 0;
                foreach (Agent agent in TimingAttackTask.Task.Units)
                {
                    if (agent.Unit.UnitType == UnitTypes.ARCHON ||
                        agent.Unit.UnitType == UnitTypes.IMMORTAL)
                    {
                        immortalArchonCount++;
                    }
                }
                if (immortalArchonCount <= 1)
                {
                    InitialAttackDone = true;
                    for (int i = TimingAttackTask.Task.Units.Count - 1; i >= 0; i--)
                    {
                        if (TimingAttackTask.Task.Units[i].Unit.UnitType == UnitTypes.IMMORTAL ||
                            TimingAttackTask.Task.Units[i].Unit.UnitType == UnitTypes.ARCHON)
                        {
                            TimingAttackTask.Task.ClearAt(i);
                        }
                    }
                }
            }

            if (!InitialRoachCounterDone &&
                RoachRushDetected &&
                TimingAttackTask.Task.AttackSent)
            {
                if (Completed(UnitTypes.STALKER) + Completed(UnitTypes.ZEALOT) + Completed(UnitTypes.IMMORTAL) + Completed(UnitTypes.ARCHON) + Completed(UnitTypes.COLOSUS) < 8)
                {
                    InitialRoachCounterDone = true;
                }
            }

            ArchonMergeTask.Task.StopAndClear(InitialAttackDone && Count(UnitTypes.ARCHON) >= 3);

            for (int i = IdleTask.Task.Units.Count - 1; i >= 0; i--)
            {
                Agent agent = IdleTask.Task.Units[i];
                if (TimingAttackTask.Task.Units.Count > 0 &&
                    UnitTypes.CombatUnitTypes.Contains(agent.Unit.UnitType) &&
                    agent.DistanceSq(Main.BaseLocation.Pos) >= 50 * 50)
                {
                    IdleTask.Task.RemoveAt(i);
                    TimingAttackTask.Task.Add(agent);
                }
            }

            //if (EnemyCount(UnitTypes.ZERGLING) >= 20)
            FallBackController.Stopped = true;

            if (RoachRushDetected)
            {
                BalanceGas();
            }
            else if (Bot.Main.Frame < 22.4 * 60 * 2 &&
                     Count(UnitTypes.NEXUS) < 2)
            {
                GasWorkerTask.WorkersPerGas = 1;
            }
            else if (Bot.Main.Frame < 22.4 * 60 * 2 &&
                     Count(UnitTypes.ASSIMILATOR) < 2)
            {
                GasWorkerTask.WorkersPerGas = 2;
            }
            else
            {
                BalanceGas();
            }

            bool gatewayExists = false;

            foreach (Agent agent in Bot.Main.Units())
            {
                if (agent.Unit.UnitType == UnitTypes.GATEWAY ||
                    agent.Unit.UnitType == UnitTypes.WARP_GATE)
                {
                    gatewayExists = true;
                }
            }

            if (gatewayExists && Count(UnitTypes.ASSIMILATOR) == 0)
            {
                ConstructionTask.Task.DedicatedNaturalProbe = false;
                if (ConstructionTask.Task.NaturalProbe != null &&
                    !WorkerScoutTask.Task.Done &&
                    WorkerScoutTask.Task.Units.Count == 0)
                {
                    for (int i = 0; i < ConstructionTask.Task.Units.Count; i++)
                    {
                        if (ConstructionTask.Task.Units[i] == ConstructionTask.Task.NaturalProbe)
                        {
                            ConstructionTask.Task.RemoveAt(i);
                            WorkerScoutTask.Task.Add(ConstructionTask.Task.NaturalProbe);
                            ConstructionTask.Task.NaturalProbe = null;
                            break;
                        }
                    }
                }
            }
            else
            {
                ConstructionTask.Task.DedicatedNaturalProbe = Count(UnitTypes.CYBERNETICS_CORE) == 0;
            }

            if (ProxyPylon && ProxyTask.Task.UnitCounts.ContainsKey(UnitTypes.PYLON) && ProxyTask.Task.UnitCounts[UnitTypes.PYLON] > 0)
            {
                ProxyPylon             = false;
                ProxyTask.Task.Stopped = true;
                ProxyTask.Task.Clear();
            }

            int wallDone = 0;

            foreach (WallBuilding building in WallIn.Wall)
            {
                if (!BuildingType.LookUp.ContainsKey(building.Type))
                {
                    wallDone++;
                    continue;
                }
                foreach (Agent agent in bot.UnitManager.Agents.Values)
                {
                    if (agent.DistanceSq(building.Pos) <= 1 * 1)
                    {
                        wallDone++;
                        break;
                    }
                }
            }

            // Cancel nexus when the enemy has an early pool.
            if ((EarlyPool.Get().Detected&& !Expanded.Get().Detected&& Completed(UnitTypes.ZEALOT) + Completed(UnitTypes.ADEPT) < 2 && !RoachRushDetected) ||
                (RoachRushDetected && Completed(UnitTypes.IMMORTAL) == 0))
            {
                CancelBuilding(UnitTypes.NEXUS);
            }

            //StutterForwardController.Stopped = Count(UnitTypes.NEXUS) >= 3 || TimingAttackTask.Task.Units.Count > 0 || Completed(UnitTypes.ZEALOT) > 0;
            StutterForwardController.Stopped = true;
            HodorTask.Task.Stopped           = Count(UnitTypes.NEXUS) >= 3 ||
                                               TimingAttackTask.Task.Units.Count > 0 ||
                                               wallDone < WallIn.Wall.Count ||
                                               Completed(UnitTypes.HIGH_TEMPLAR) + Count(UnitTypes.ARCHON) > 0 ||
                                               (Count(UnitTypes.ADEPT) >= 2 && !AdeptHarassMainTask.Task.Sent) ||
                                               (EnemyCount(UnitTypes.ZERGLING) == 0 && EnemyCount(UnitTypes.ROACH) > 0 ||
                                                EnemyCount(UnitTypes.NYDUS_CANAL) > 0);
            if (HodorTask.Task.Stopped)
            {
                HodorTask.Task.Clear();
            }

            if (CounterRoaches)
            {
                WorkerScoutTask.Task.StopAndClear((!gatewayExists || WorkerScoutTask.Task.BaseCircled()) && (!EarlyPool.Get().Detected || RoachRushDetected));
            }
            else
            {
                WorkerScoutTask.Task.StopAndClear((!gatewayExists || WorkerScoutTask.Task.BaseCircled()));
            }

            if (WallIn.Wall.Count >= 5)
            {
                HodorTask.Task.Target = WallIn.Wall[2].Pos;
            }
            else
            {
                HodorTask.Task.Stopped = true;
                HodorTask.Task.Clear();
            }

            foreach (Agent agent in bot.UnitManager.Agents.Values)
            {
                if (bot.Frame % 224 != 0)
                {
                    break;
                }
                if (agent.Unit.UnitType != UnitTypes.GATEWAY)
                {
                    continue;
                }

                if (Count(UnitTypes.NEXUS) < 3 &&
                    TimingAttackTask.Task.Units.Count == 0 &&
                    (Count(UnitTypes.ADEPT) < 2 || AdeptHarassMainTask.Task.Sent))
                {
                    agent.Order(Abilities.MOVE, Natural.BaseLocation.Pos);
                }
                else
                {
                    agent.Order(Abilities.MOVE, bot.TargetManager.PotentialEnemyStartLocations[0]);
                }
            }

            if (!MassZerglings &&
                !EarlyPool.Get().Detected &&
                bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.ZERGLING) >= 60 &&
                bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.ROACH) == 0 &&
                bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.HYDRALISK) == 0)
            {
                MassZerglings = true;
                //TimingAttackTask.Task.Clear();
            }
            bot.DrawText("Zergling count: " + bot.EnemyStrategyAnalyzer.TotalCount(UnitTypes.ZERGLING));

            ObserverScoutTask.Task.Priority = 6;

            if (EarlyPool.Get().Detected)
            {
                bot.NexusAbilityManager.Stopped = Count(UnitTypes.ZEALOT) == 0;
                bot.NexusAbilityManager.PriotitizedAbilities.Add(TrainingType.LookUp[UnitTypes.ZEALOT].Ability);
            }
            else
            {
                bot.NexusAbilityManager.OnlyChronoPrioritizedUnits = Count(UnitTypes.CYBERNETICS_CORE) > 0 && !AdeptHarassMainTask.Task.Sent;
                bot.NexusAbilityManager.Stopped = Count(UnitTypes.ADEPT) + Count(UnitTypes.ZEALOT) + Count(UnitTypes.IMMORTAL) + Count(UnitTypes.ARCHON) == 0 &&
                                                  Count(UnitTypes.CYBERNETICS_CORE) > 0;
                bot.NexusAbilityManager.PriotitizedAbilities.Add(TrainingType.LookUp[UnitTypes.ADEPT].Ability);
            }

            bot.DrawText("TimingAttackTask: " + TimingAttackTask.Task.Units.Count + "/" + TimingAttackTask.Task.RequiredSize);
            bot.DrawText("GroundDefense: " + DefenseTask.GroundDefenseTask.Units.Count);


            bot.DrawText("Roach rush: " + RoachRushDetected);
            bot.DrawText("InitialRoachCounterDone : " + InitialRoachCounterDone);
            if (RoachRushDetected)
            {
                if (InitialRoachCounterDone)
                {
                    TimingAttackTask.Task.RequiredSize = 30;
                }
                else
                {
                    TimingAttackTask.Task.RequiredSize = 12;
                }
            }
            else if (InitialAttackDone)
            {
                TimingAttackTask.Task.RequiredSize = 30;
            }
            else if (EarlyPool.Get().Detected &&
                     !Expanded.Get().Detected)
            {
                TimingAttackTask.Task.RequiredSize = 24;
            }
            else if (Completed(UnitTypes.ARCHON) < 3)
            {
                TimingAttackTask.Task.RequiredSize = 24;
            }
            else
            {
                TimingAttackTask.Task.RequiredSize = 10;
            }
            TimingAttackTask.Task.RetreatSize = 0;

            foreach (WorkerDefenseTask task in WorkerDefenseTask.Tasks)
            {
                task.Stopped = Completed(UnitTypes.ZEALOT) + Completed(UnitTypes.IMMORTAL) + Completed(UnitTypes.ADEPT) >= 2;
            }


            if (bot.Frame >= 22.4 * 60 * 2.75 &&
                bot.Frame <= 22.4 * 60 * 4.75 &&
                !EnemyAttackPerformed &&
                (EarlyPool.Get().Detected || RoachRushDetected) &&
                DefendNydus)
            {
                IdleTask.Task.OverrideTarget = NydusPos;
            }
            else if (Count(UnitTypes.NEXUS) >= 3 ||
                     (Completed(UnitTypes.HIGH_TEMPLAR) + Count(UnitTypes.ARCHON) > 0) ||
                     (Count(UnitTypes.ADEPT) >= 2 && !AdeptHarassMainTask.Task.Sent))
            {
                IdleTask.Task.OverrideTarget = OverrideDefenseTarget;
            }
            else
            {
                IdleTask.Task.OverrideTarget = NaturalDefensePos;
            }

            ArchonMergeTask.Task.MergePos = OverrideDefenseTarget;

            if (RoachRushDetected &&
                (Completed(UnitTypes.IMMORTAL) == 0 || Completed(UnitTypes.IMMORTAL) + Completed(UnitTypes.STALKER) < 6))
            {
                DefenseTask.GroundDefenseTask.BufferZone          = 0;
                DefenseTask.GroundDefenseTask.ExpandDefenseRadius = 30;
                DefenseTask.GroundDefenseTask.MainDefenseRadius   = 30;
                DefenseTask.GroundDefenseTask.MaxDefenseRadius    = 120;
                DefenseTask.GroundDefenseTask.DrawDefenderRadius  = 80;
            }
            else
            {
                DefenseTask.GroundDefenseTask.BufferZone          = 5;
                DefenseTask.GroundDefenseTask.ExpandDefenseRadius = 30;
                DefenseTask.GroundDefenseTask.MainDefenseRadius   = EarlyPool.Get().Detected ? 50 : 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;
        }
예제 #24
0
파일: PvZHjax.cs 프로젝트: evilz/TyrSc2
        public override void OnStart(Bot bot)
        {
            OverrideDefenseTarget = bot.MapAnalyzer.Walk(NaturalDefensePos, bot.MapAnalyzer.EnemyDistances, 15);

            MicroControllers.Add(FearSpinesController);
            MicroControllers.Add(new HTController());
            MicroControllers.Add(new AdeptKillWorkersController()
            {
                TargetTypes = new HashSet <uint> {
                    UnitTypes.ZERGLING
                }
            });
            MicroControllers.Add(new AdeptKillWorkersController());
            MicroControllers.Add(new DodgeBallController());
            MicroControllers.Add(new SoftLeashController(UnitTypes.ZEALOT, new HashSet <uint>()
            {
                UnitTypes.IMMORTAL, UnitTypes.ARCHON
            }, 6));
            MicroControllers.Add(new SoftLeashController(UnitTypes.ARCHON, UnitTypes.IMMORTAL, 6));
            MicroControllers.Add(StutterForwardController);
            MicroControllers.Add(FallBackController);
            MicroControllers.Add(new FearMinesController());
            MicroControllers.Add(new StalkerController());
            MicroControllers.Add(new DisruptorController());
            MicroControllers.Add(new StutterController());
            MicroControllers.Add(new ColloxenController());
            MicroControllers.Add(new TempestController());
            MicroControllers.Add(new AdvanceController());

            if (WallIn == null)
            {
                WallIn = new WallInCreator();
                WallIn.CreateNatural(new List <uint>()
                {
                    UnitTypes.GATEWAY, UnitTypes.GATEWAY, UnitTypes.ZEALOT, UnitTypes.GATEWAY
                });
                ShieldBatteryPos = DetermineShieldBatteryPos();
                WallIn.ReserveSpace();
                foreach (WallBuilding building in WallIn.Wall)
                {
                    if (building.Type == UnitTypes.PYLON)
                    {
                        Bot.Main.buildingPlacer.ReservedLocation.Add(new ReservedBuilding()
                        {
                            Type = UnitTypes.NEXUS, Pos = building.Pos
                        });
                    }
                }
            }

            Base  third = null;
            float dist  = 1000000;

            foreach (Base b in bot.BaseManager.Bases)
            {
                if (b == Main ||
                    b == Natural)
                {
                    continue;
                }
                float newDist = SC2Util.DistanceSq(b.BaseLocation.Pos, Main.BaseLocation.Pos);
                if (newDist > dist)
                {
                    continue;
                }
                dist  = newDist;
                third = b;
            }
            NydusPos = new PotentialHelper(bot.MapAnalyzer.StartLocation, 18).To(third.BaseLocation.Pos).Get();

            Set += ProtossBuildUtil.Pylons(() => Completed(UnitTypes.PYLON) > 0 &&
                                           (Count(UnitTypes.CYBERNETICS_CORE) > 0 || EarlyPool.Get().Detected) &&
                                           (Count(UnitTypes.GATEWAY) >= 2 || !EarlyPool.Get().Detected));
            Set += ExpandBuildings();
            Set += Units();
            Set += MainBuild();
        }
예제 #25
0
        private BuildList MainBuild()
        {
            BuildList result = new BuildList();

            result.Building(UnitTypes.NEXUS);
            if (WallIn.Wall.Count >= 5)
            {
                result.Building(UnitTypes.PYLON, Natural, WallIn.Wall[4].Pos, true);
                result.Building(UnitTypes.GATEWAY, Natural, WallIn.Wall[0].Pos, true, () => Completed(UnitTypes.PYLON) > 0);
                result.Building(UnitTypes.GATEWAY, Natural, WallIn.Wall[3].Pos, true, () => Completed(UnitTypes.PYLON) > 0 && EarlyPool.Get().Detected);
                result.Building(UnitTypes.GATEWAY, Natural, WallIn.Wall[1].Pos, true, () => Completed(UnitTypes.PYLON) > 0 && EarlyPool.Get().Detected);
            }
            else
            {
                result.Building(UnitTypes.PYLON);
                result.Building(UnitTypes.GATEWAY, () => Completed(UnitTypes.PYLON) > 0);
                result.Building(UnitTypes.GATEWAY, () => Completed(UnitTypes.PYLON) > 0 && EarlyPool.Get().Detected);
                result.Building(UnitTypes.GATEWAY, () => Completed(UnitTypes.PYLON) > 0 && EarlyPool.Get().Detected);
            }
            result.Building(UnitTypes.NEXUS, () => !EarlyPool.Get().Detected || Completed(UnitTypes.ADEPT) + Completed(UnitTypes.ZEALOT) + Completed(UnitTypes.STALKER) >= 8);
            if (WallIn.Wall.Count >= 5)
            {
                result.Building(UnitTypes.CYBERNETICS_CORE, Natural, WallIn.Wall[1].Pos, true, () => !EarlyPool.Get().Detected);
            }
            else
            {
                result.Building(UnitTypes.CYBERNETICS_CORE, () => !EarlyPool.Get().Detected);
            }
            result.Building(UnitTypes.CYBERNETICS_CORE, () => EarlyPool.Get().Detected&& Count(UnitTypes.ZEALOT) >= 6);
            result.Building(UnitTypes.ASSIMILATOR, () => !EarlyPool.Get().Detected || Count(UnitTypes.ZEALOT) >= 6);
            if (WallIn.Wall.Count >= 5)
            {
                result.Building(UnitTypes.GATEWAY, Natural, WallIn.Wall[3].Pos, true, () => !EarlyPool.Get().Detected);
            }
            else
            {
                result.Building(UnitTypes.GATEWAY, () => !EarlyPool.Get().Detected);
            }
            if (ShieldBatteryPos == null)
            {
                result.Building(UnitTypes.SHIELD_BATTERY, Natural, NaturalDefensePos);
            }
            else
            {
                result.Building(UnitTypes.SHIELD_BATTERY, Natural, ShieldBatteryPos, true);
            }
            result.Building(UnitTypes.ASSIMILATOR, () => !EarlyPool.Get().Detected || Count(UnitTypes.ZEALOT) >= 6);
            result.Building(UnitTypes.ROBOTICS_FACILITY, () => !EarlyPool.Get().Detected || Completed(UnitTypes.ADEPT) + Completed(UnitTypes.STALKER) >= 8);
            result.Upgrade(UpgradeType.WarpGate);
            result.Building(UnitTypes.ASSIMILATOR, () => !EarlyPool.Get().Detected || Count(UnitTypes.ZEALOT) >= 6);
            result.Building(UnitTypes.PYLON, Natural, () => Count(UnitTypes.CYBERNETICS_CORE) > 0 && Natural.ResourceCenter != null);
            result.Building(UnitTypes.ROBOTICS_BAY, () => TotalEnemyCount(UnitTypes.ZERGLING) >= 40 && TotalEnemyCount(UnitTypes.MUTALISK) + TotalEnemyCount(UnitTypes.CORRUPTOR) == 0);
            result.If(() => Completed(UnitTypes.IMMORTAL) + Completed(UnitTypes.COLOSUS) > 0 && Completed(UnitTypes.STALKER) >= 6);
            result.Building(UnitTypes.NEXUS);
            result.Building(UnitTypes.PYLON);
            result.Building(UnitTypes.TWILIGHT_COUNSEL);
            result.Building(UnitTypes.FORGE);
            result.Upgrade(UpgradeType.ProtossGroundWeapons);
            result.Building(UnitTypes.FORGE);
            result.Upgrade(UpgradeType.ProtossGroundArmor);
            result.Building(UnitTypes.ASSIMILATOR, 2);
            result.Building(UnitTypes.PYLON);
            result.Building(UnitTypes.NEXUS);
            result.Building(UnitTypes.ROBOTICS_FACILITY);
            result.Building(UnitTypes.ASSIMILATOR, 4, () => Minerals() >= 700 && Gas() < 200);
            result.If(() => Count(UnitTypes.IMMORTAL) + Count(UnitTypes.COLOSUS) >= 3 && Count(UnitTypes.STALKER) >= 10);
            result.Building(UnitTypes.ASSIMILATOR, 2);
            result.Building(UnitTypes.ASSIMILATOR, 2);
            result.If(() => Count(UnitTypes.STALKER) + Count(UnitTypes.IMMORTAL) + Count(UnitTypes.COLOSUS) + Count(UnitTypes.ADEPT) >= 15);
            result.Building(UnitTypes.ASSIMILATOR, 2);
            result.Building(UnitTypes.NEXUS);
            result.Building(UnitTypes.ASSIMILATOR, 2);
            result.If(() => Completed(UnitTypes.STALKER) + Completed(UnitTypes.COLOSUS) + Completed(UnitTypes.IMMORTAL) + Completed(UnitTypes.DISRUPTOR) + Completed(UnitTypes.TEMPEST) + Count(UnitTypes.ADEPT) >= 40 || Minerals() >= 650);
            result.Building(UnitTypes.NEXUS);

            return(result);
        }