Beispiel #1
0
        public void OnStart(ResponseGameInfo gameInfo, ResponseData data, ResponseObservation observation, uint playerId, string opponentID)
        {
            Observation = observation;
            GameInfo    = gameInfo;
            PlayerId    = playerId;
            Data        = data;
            UnitTypes.LoadData(data);

            MyRace    = GameInfo.PlayerInfo[(int)Observation.Observation.PlayerCommon.PlayerId - 1].RaceActual;
            EnemyRace = GameInfo.PlayerInfo[2 - (int)Observation.Observation.PlayerCommon.PlayerId].RaceRequested;
            System.Console.WriteLine("MyRace: " + MyRace);

            if (AllowWritingFiles)
            {
                File.AppendAllLines(Directory.GetCurrentDirectory() + "/Data/Tyr/Tyr.log", new string[] { "Game started on map: " + GameInfo.MapName });
                File.AppendAllLines(Directory.GetCurrentDirectory() + "/Data/Tyr/Tyr.log", new string[] { "Enemy race: " + EnemyRace });
            }

            if (opponentID == null)
            {
                ResultsFile = Directory.GetCurrentDirectory() + "/Data/Tyr/" + EnemyRace + ".txt";
            }
            else
            {
                ResultsFile = Directory.GetCurrentDirectory() + "/Data/Tyr/" + opponentID + ".txt";
            }

            if (AllowWritingFiles && !File.Exists(ResultsFile))
            {
                File.Create(ResultsFile).Close();
            }

            MapAnalyzer.Analyze(this);
            TargetManager.OnStart(this);
            BaseManager.OnStart(this);

            Build = DetermineBuild();
            Build.InitializeTasks();
            Build.OnStart(this);

            Register("started " + EnemyRace + " " + Build.Name());


            Managers.Add(UnitManager);
            Managers.Add(EnemyManager);
            Managers.Add(BaseManager);
            Managers.Add(TargetManager);
            Managers.Add(TaskManager);
            Managers.Add(EffectManager);

            if (GameInfo.PlayerInfo[(int)Observation.Observation.PlayerCommon.PlayerId - 1].RaceActual == Race.Protoss)
            {
                Managers.Add(NexusAbilityManager);
            }
        }
Beispiel #2
0
        public void OnStart(ResponseGameInfo gameInfo, ResponseData data, ResponsePing pingResponse, ResponseObservation observation, uint playerId, string opponentID)
        {
            Observation = observation;
            GameInfo    = gameInfo;
            PlayerId    = playerId;
            Data        = data;
            UnitTypes.LoadData(data);

            GameVersion = pingResponse.GameVersion;
            OldMapData  = SC2Util.IsVersionBefore("4.9.3");
            DebugUtil.WriteLine("Game version: " + pingResponse.GameVersion);

            OpponentID = opponentID;

            MyRace    = GameInfo.PlayerInfo[(int)Observation.Observation.PlayerCommon.PlayerId - 1].RaceActual;
            EnemyRace = GameInfo.PlayerInfo[2 - (int)Observation.Observation.PlayerCommon.PlayerId].RaceActual;
            DebugUtil.WriteLine("MyRace: " + MyRace);
            DebugUtil.WriteLine("EnemyRace: " + EnemyRace);
            DebugUtil.WriteLine("Game started on map: " + GameInfo.MapName);

            FileUtil.Log("Game started on map: " + GameInfo.MapName);
            FileUtil.Log("Enemy race: " + EnemyRace);

            MapAnalyzer.Analyze(this);
            TargetManager.OnStart(this);
            BaseManager.OnStart(this);

            Build = DetermineBuild();
            Build.InitializeTasks();
            Build.OnStart(this);

            FileUtil.Register("started " + EnemyRace + " " + Build.Name());


            Managers.Add(UnitManager);
            Managers.Add(EnemyManager);
            Managers.Add(BaseManager);
            Managers.Add(TargetManager);
            Managers.Add(TaskManager);
            Managers.Add(EffectManager);
            Managers.Add(EnemyMineManager);
            Managers.Add(EnemyTankManager);
            Managers.Add(EnemyCycloneManager);
            Managers.Add(EnemyBansheesManager);

            if (GameInfo.PlayerInfo[(int)Observation.Observation.PlayerCommon.PlayerId - 1].RaceActual == Race.Protoss)
            {
                Managers.Add(NexusAbilityManager);
            }

            if (GameInfo.PlayerInfo[(int)Observation.Observation.PlayerCommon.PlayerId - 1].RaceActual == Race.Terran)
            {
                Managers.Add(OrbitalAbilityManager);
            }
        }
Beispiel #3
0
        public void OnStart(ResponseGameInfo gameInfo, ResponseData data, ResponsePing pingResponse, ResponseObservation observation, uint playerId, string opponentID)
        {
            ArchonMode = Settings.ArchonMode();

            Observation = observation;
            GameInfo    = gameInfo;


            foreach (MapEnum map in System.Enum.GetValues(typeof(MapEnum)))
            {
                if (MapNameMatches(map))
                {
                    System.Console.WriteLine("Setting map name to: " + map.ToString());
                    GameInfo.MapName = map.ToString();
                    Map = map;
                    break;
                }
            }

            PlayerId = playerId;
            Data     = data;

            if (!Settings.MapAllowed(GameInfo.MapName))
            {
                DebugUtil.WriteLine("Tyr does not support the map " + GameInfo.MapName + ". If Tyr should accept this map as well, you can add the line 'map " + GameInfo.MapName + "' to the settings.txt file.");
                FileUtil.Log("Tyr does not support the map " + GameInfo.MapName + ". If Tyr should accept this map as well, you can add the line 'map " + GameInfo.MapName + "' to the settings.txt file.");
                System.Console.ReadLine();
                throw new System.Exception("Tyr does not support the map " + GameInfo.MapName + ". If Tyr should accept this map as well, you can add the line 'map " + GameInfo.MapName + "' to the settings.txt file.");
            }

            GameVersion = pingResponse.GameVersion;
            OldMapData  = SC2Util.IsVersionBefore("4.9.3");
            DebugUtil.WriteLine("Game version: " + pingResponse.GameVersion);
            UnitTypes.LoadData(data);

            OpponentID = opponentID;

            MyRace = GameInfo.PlayerInfo[(int)Observation.Observation.PlayerCommon.PlayerId - 1].RaceActual;
            if (GameInfo.PlayerInfo[2 - (int)Observation.Observation.PlayerCommon.PlayerId].RaceActual == Race.NoRace)
            {
                EnemyRace = GameInfo.PlayerInfo[2 - (int)Observation.Observation.PlayerCommon.PlayerId].RaceRequested;
            }
            else
            {
                EnemyRace = GameInfo.PlayerInfo[2 - (int)Observation.Observation.PlayerCommon.PlayerId].RaceActual;
            }
            DebugUtil.WriteLine("MyRace: " + MyRace);
            DebugUtil.WriteLine("EnemyRace: " + EnemyRace);
            DebugUtil.WriteLine("Game started on map: " + GameInfo.MapName);

            FileUtil.Log("Game started on map: " + GameInfo.MapName);
            FileUtil.Log("Enemy race: " + EnemyRace);

            MapAnalyzer.Analyze(this);
            TargetManager.OnStart(this);
            BaseManager.OnStart(this);

            foreach (Plugin plugin in Plugins)
            {
                plugin.OnStart();
            }

            Build = DetermineBuild();
            Build.InitializeTasks();
            Build.OnStart(this);

            FileUtil.Register("started " + EnemyRace + " " + Build.Name());

            Managers.Add(UnitManager);
            Managers.Add(EnemyManager);
            Managers.Add(BaseManager);
            Managers.Add(TargetManager);
            Managers.Add(TaskManager);
            Managers.Add(EffectManager);
            Managers.Add(EnemyMineManager);
            Managers.Add(EnemyTankManager);
            Managers.Add(EnemyCycloneManager);
            Managers.Add(EnemyBansheesManager);

            if (GameInfo.PlayerInfo[(int)Observation.Observation.PlayerCommon.PlayerId - 1].RaceActual == Race.Protoss)
            {
                Managers.Add(NexusAbilityManager);
            }

            if (GameInfo.PlayerInfo[(int)Observation.Observation.PlayerCommon.PlayerId - 1].RaceActual == Race.Terran)
            {
                Managers.Add(OrbitalAbilityManager);
            }
        }