示例#1
0
        public override void OnStart(Bot bot)
        {
            MicroControllers.Add(new SoftLeashController(UnitTypes.COLOSUS, UnitTypes.IMMORTAL, 12));
            MicroControllers.Add(new FleeCyclonesController());
            MicroControllers.Add(new SentryController());
            MicroControllers.Add(new TempestController());
            MicroControllers.Add(new DisruptorController());
            MicroControllers.Add(new DodgeBallController());
            MicroControllers.Add(new FallBackController()
            {
                ReturnFire = true, MainDist = 40
            });
            MicroControllers.Add(new GravitonBeamController());
            MicroControllers.Add(new FearEnemyController(UnitTypes.PHOENIX, UnitTypes.MISSILE_TURRET, 11));
            MicroControllers.Add(new AttackEnemyController(UnitTypes.PHOENIX, UnitTypes.BANSHEE, 15, true));
            MicroControllers.Add(new AdvanceController());
            MicroControllers.Add(StutterController);
            MicroControllers.Add(StutterForwardController);

            WallIn.CreateReaperWall(new List <uint> {
                UnitTypes.GATEWAY, UnitTypes.PYLON, UnitTypes.CYBERNETICS_CORE
            });
            WallIn.ReserveSpace();

            foreach (WorkerDefenseTask task in WorkerDefenseTask.Tasks)
            {
                task.OnlyDefendInsideMain = true;
            }

            Set += ProtossBuildUtil.Pylons(() => (Count(UnitTypes.PYLON) > 0 && Count(UnitTypes.CYBERNETICS_CORE) > 0 && Count(UnitTypes.STALKER) > 0) || bot.Frame >= 22.4 * 60 * 3.5);
            Set += Units();
            Set += ExpandBuildings();
            Set += MainBuildList();
        }
示例#2
0
        public override void OnStart(Bot bot)
        {
            MicroControllers.Add(new FleeCyclonesController());
            MicroControllers.Add(new SentryController());
            MicroControllers.Add(new DodgeBallController());
            MicroControllers.Add(new GravitonBeamController());
            MicroControllers.Add(new FearEnemyController(UnitTypes.PHOENIX, UnitTypes.MISSILE_TURRET, 11));
            MicroControllers.Add(new AttackEnemyController(UnitTypes.PHOENIX, UnitTypes.BANSHEE, 15, true));
            MicroControllers.Add(new FallBackController()
            {
                ReturnFire = true, MainDist = 40
            });
            MicroControllers.Add(new FearMinesController());
            MicroControllers.Add(new AdvanceController());
            MicroControllers.Add(new StutterForwardController());

            foreach (WorkerDefenseTask task in WorkerDefenseTask.Tasks)
            {
                task.OnlyDefendInsideMain = true;
            }


            WallIn.CreateReaperWall(new List <uint> {
                UnitTypes.GATEWAY, UnitTypes.PYLON, UnitTypes.CYBERNETICS_CORE
            });
            WallIn.ReserveSpace();

            Set += ProtossBuildUtil.Pylons(() => Count(UnitTypes.PYLON) > 0 && Count(UnitTypes.CYBERNETICS_CORE) > 0);
            Set += Units();
            Set += MainBuildList();
        }
示例#3
0
        public override void OnStart(Bot bot)
        {
            MicroControllers.Add(new StayByCannonsController());
            MicroControllers.Add(new FleeCyclonesController());
            MicroControllers.Add(new SentryController()
            {
                FleeEnemies = false, UseHallucaination = true
            });
            MicroControllers.Add(new DodgeBallController());
            MicroControllers.Add(new TargetUnguardedBuildingsController());
            MicroControllers.Add(new StutterController());
            MicroControllers.Add(new KillTargetController(UnitTypes.SCV)
            {
                MaxDist = 4
            });
            MicroControllers.Add(new KillTargetController(UnitTypes.SCV, true));

            if (SkipNatural)
            {
                foreach (Base b in bot.BaseManager.Bases)
                {
                    if (b == Main)
                    {
                        continue;
                    }
                    if (SC2Util.DistanceSq(b.BaseLocation.Pos, Main.BaseLocation.Pos) >= 50 * 50)
                    {
                        continue;
                    }
                    BuildingPlacement.ReservedBuilding reservedExpand = new BuildingPlacement.ReservedBuilding();
                    reservedExpand.Pos  = b.BaseLocation.Pos;
                    reservedExpand.Type = UnitTypes.NEXUS;
                    bot.buildingPlacer.ReservedLocation.Add(reservedExpand);
                }
            }

            foreach (WorkerDefenseTask task in WorkerDefenseTask.Tasks)
            {
                task.OnlyDefendInsideMain = true;
            }

            bot.TargetManager.PrefferDistant = false;

            RampDefensePos = new PotentialHelper(MainDefensePos, 4).To(bot.MapAnalyzer.GetMainRamp()).Get();

            if (Bot.Main.EnemyRace == Race.Terran)
            {
                WallIn.CreateReaperWall(new List <uint> {
                    UnitTypes.GATEWAY, UnitTypes.PYLON, UnitTypes.CYBERNETICS_CORE
                });
                WallIn.ReserveSpace();
            }

            NaturalCannonDefensePos = NaturalDefensePos;

            if (Bot.Main.EnemyRace == Race.Zerg && !SkipNatural)
            {
                NaturalWall.CreateFullNatural(new List <uint>()
                {
                    UnitTypes.GATEWAY, UnitTypes.GATEWAY, UnitTypes.PYLON, UnitTypes.GATEWAY
                });
                NaturalWall.ReserveSpace();

                if (NaturalWall.Wall.Count >= 4)
                {
                    if (bot.Map == MapEnum.Acropolis ||
                        bot.Map == MapEnum.Thunderbird)
                    {
                        WallBuilding temp = NaturalWall.Wall[3];
                        NaturalWall.Wall[3]     = NaturalWall.Wall[0];
                        NaturalWall.Wall[0]     = temp;
                        NaturalCannonDefensePos = new PotentialHelper(NaturalDefensePos, 4).To(Natural.BaseLocation.Pos).Get();
                    }
                    MainAndNatural = Bot.Main.MapAnalyzer.FindMainAndNaturalArea(NaturalWall);
                }
            }

            Set += ProtossBuildUtil.Pylons(() => Count(UnitTypes.PYLON) > 0 && Count(UnitTypes.CYBERNETICS_CORE) > 0);
            Set += ExpandBuildings();
            Set += Units();
            Set += MainBuildList();
        }
示例#4
0
文件: AntiMicro.cs 项目: evilz/TyrSc2
        public override void OnStart(Bot bot)
        {
            DefenseTask.GroundDefenseTask.BeforeControllers.Add(new GravitonBeamController()
            {
                LiftReapers = true
            });
            DefenseTask.GroundDefenseTask.BeforeControllers.Add(KillMarauderController);
            MicroControllers.Add(new FleeCyclonesController());
            MicroControllers.Add(new BlinkForwardController());
            MicroControllers.Add(new SentryController());
            MicroControllers.Add(new DodgeBallController());
            MicroControllers.Add(new GravitonBeamController()
            {
                LiftMarauders = true
            });
            MicroControllers.Add(new FearEnemyController(UnitTypes.PHOENIX, UnitTypes.MISSILE_TURRET, 11));
            MicroControllers.Add(new AttackEnemyController(UnitTypes.PHOENIX, new HashSet <uint> {
                UnitTypes.BANSHEE, UnitTypes.RAVEN
            }, 20, true));
            MicroControllers.Add(new FearMinesController());
            MicroControllers.Add(new StutterController()
            {
                Range = 3
            });
            MicroControllers.Add(new KillTargetController(UnitTypes.SCV)
            {
                MaxDist = 4
            }.ExcludeAttackerType(UnitTypes.PHOENIX));
            MicroControllers.Add(new KillTargetController((unit) => unit.BuffIds.Contains(5))); // Kill lifted units
            MicroControllers.Add(new AttackEnemyController(UnitTypes.PHOENIX, UnitTypes.CYCLONE, 15, true));
            //MicroControllers.Add(KillMarauderController);
            MicroControllers.Add(KillCycloneController);
            MicroControllers.Add(KillBansheeController);
            MicroControllers.Add(KillVikingController);
            MicroControllers.Add(new KillTargetController(UnitTypes.SCV, true).ExcludeAttackerType(UnitTypes.PHOENIX));
            MicroControllers.Add(new AdvanceController());
            MicroControllers.Add(new StutterForwardController());
            MicroControllers.Add(PhoenixHuntAirController);
            MicroControllers.Add(PhoenixHuntCycloneController);
            MicroControllers.Add(PhoenixHuntMarauderController);
            MicroControllers.Add(new SoftLeashController(UnitTypes.PHOENIX, UnitTypes.STALKER, 5));
            TimingAttackTask.Task.BeforeControllers.Add(new SoftLeashController(UnitTypes.STALKER, UnitTypes.IMMORTAL, 7));

            foreach (WorkerDefenseTask task in WorkerDefenseTask.Tasks)
            {
                task.OnlyDefendInsideMain = true;
            }

            WallIn.CreateReaperWall(new List <uint> {
                UnitTypes.GATEWAY, UnitTypes.PYLON, UnitTypes.CYBERNETICS_CORE
            });
            WallIn.ReserveSpace();

            Set += ProtossBuildUtil.Pylons(() => Count(UnitTypes.PYLON) >= 2 &&
                                           Count(UnitTypes.CYBERNETICS_CORE) > 0 &&
                                           (!ProxyMarauderSuspected || Count(UnitTypes.SHIELD_BATTERY) >= 2) &&
                                           (!ProxyMarauderSuspected || bot.Observation.Observation.PlayerCommon.FoodUsed >= 27));
            Set += Units();
            Set += MainBuildList();

            if (HuntProxies)
            {
                try
                {
                    DetermineProxyLocations();
                }
                catch (System.Exception e)
                {
                    Util.DebugUtil.WriteLine("Exception when generating map image: " + e.Message);
                }
            }
        }
示例#5
0
        public override void OnStart(Bot bot)
        {
            MicroControllers.Add(new FleeCyclonesController());
            MicroControllers.Add(new BlinkForwardController());
            MicroControllers.Add(new SentryController());
            MicroControllers.Add(new DodgeBallController());
            MicroControllers.Add(new TargetUnguardedBuildingsController());
            MicroControllers.Add(new AdvanceController());
            MicroControllers.Add(new StutterController());
            MicroControllers.Add(new KillTargetController(UnitTypes.SCV)
            {
                MaxDist = 4
            });
            MicroControllers.Add(KillCycloneController);
            MicroControllers.Add(KillBansheeController);
            MicroControllers.Add(new KillTargetController(UnitTypes.SCV, true));

            foreach (WorkerDefenseTask task in WorkerDefenseTask.Tasks)
            {
                task.OnlyDefendInsideMain = true;
            }

            bot.TargetManager.PrefferDistant = false;


            if (Bot.Main.EnemyRace == Race.Terran)
            {
                WallIn.CreateReaperWall(new List <uint> {
                    UnitTypes.GATEWAY, UnitTypes.PYLON, UnitTypes.CYBERNETICS_CORE
                });
                WallIn.ReserveSpace();
            }

            Set += ProtossBuildUtil.Pylons(() => Count(UnitTypes.PYLON) > 0 && Count(UnitTypes.CYBERNETICS_CORE) > 0);
            Set += Units();
            Set += MainBuildList();

            try
            {
                string[]         scoutingLocations = Util.FileUtil.ReadScoutLocationFile();
                HashSet <string> existingLocations = new HashSet <string>();

                string[]       debugLines       = Util.FileUtil.ReadDebugFile();
                List <Point2D> fromCurrentStart = new List <Point2D>();
                List <Point2D> fromOtherStart   = new List <Point2D>();
                string         mapName          = bot.GameInfo.MapName;
                string         mapStartString   = mapName + "(" + bot.MapAnalyzer.StartLocation.X + ", " + bot.MapAnalyzer.StartLocation.Y + "):";

                foreach (string line in scoutingLocations)
                {
                    if (!line.StartsWith(mapName))
                    {
                        continue;
                    }
                    existingLocations.Add(line);
                }

                foreach (string line in debugLines)
                {
                    if (!line.StartsWith(mapName))
                    {
                        continue;
                    }
                    string position = line.Substring(line.LastIndexOf("("));
                    position = position.Replace(")", "").Replace("(", "");
                    string[] pos   = position.Split(',');
                    Point2D  point = new Point2D()
                    {
                        X = float.Parse(pos[0]), Y = float.Parse(pos[1])
                    };
                    if (line.StartsWith(mapStartString))
                    {
                        fromCurrentStart.Add(point);
                    }
                    else
                    {
                        fromOtherStart.Add(point);
                    }

                    Point2D basePos = null;
                    float   dist    = 1000000;
                    foreach (Base b in Bot.Main.BaseManager.Bases)
                    {
                        float newDist = SC2Util.DistanceSq(b.BaseLocation.Pos, point);
                        if (newDist > dist)
                        {
                            continue;
                        }
                        dist    = newDist;
                        basePos = b.BaseLocation.Pos;
                    }
                    string locationString = line.Substring(0, line.LastIndexOf("(")) + "(" + basePos.X + "," + basePos.Y + ")";
                    if (!existingLocations.Contains(locationString))
                    {
                        existingLocations.Add(locationString);
                        FileUtil.WriteScoutLocation(locationString);
                    }
                }

                foreach (string line in scoutingLocations)
                {
                    if (!line.StartsWith(mapStartString))
                    {
                        continue;
                    }

                    string position = line.Substring(line.LastIndexOf("("));
                    position = position.Replace(")", "").Replace("(", "");
                    string[] pos   = position.Split(',');
                    Point2D  point = new Point2D()
                    {
                        X = float.Parse(pos[0]), Y = float.Parse(pos[1])
                    };
                    ScoutLocations.Add(point);
                    DebugUtil.WriteLine("Found scout location: " + point);
                }
                HuntProxyTask.Task.ScoutBases = ScoutLocations;
            }
            catch (System.Exception e)
            {
                Util.DebugUtil.WriteLine("Exception when generating map image: " + e.Message);
            }
        }