Exemplo n.º 1
0
        public List <Build> GetBuilds(Bot bot, string[] lines)
        {
            List <Build> options = new List <Build>();


            if (Bot.Main.EnemyRace == Race.Protoss)
            {
                if (Stalker.Get().DetectedPreviously &&
                    Zealot.Get().DetectedPreviously &&
                    !Immortal.Get().DetectedPreviously)
                {
                    options.Add(new DefensiveSentries()
                    {
                        DelayAttacking = true
                    });
                    //options.Add(new MassSentries() { SkipNatural = true });
                    //options.Add(new GreedySentries());
                    return(options);
                }
                if (!Stalker.Get().DetectedPreviously &&
                    Zealot.Get().DetectedPreviously &&
                    !Immortal.Get().DetectedPreviously)
                {
                    //options.Add(new DefensiveSentries() { DelayAttacking = true });
                    options.Add(new MassSentries()
                    {
                        SkipNatural = true
                    });
                    return(options);
                }
            }
            if (Bot.Main.EnemyRace == Race.Zerg)
            {
                if ((Zergling.Get().DetectedPreviously || Roach.Get().DetectedPreviously) &&
                    !Hydralisk.Get().DetectedPreviously)
                {
                    options.Add(new DefensiveSentries());
                    return(options);
                }
            }
            if (Bot.Main.EnemyRace == Race.Terran && Battlecruiser.Get().DetectedPreviously&& !SiegeTank.Get().DetectedPreviously)
            {
                options.Add(new MassSentries()
                {
                    AntiBC = true
                });
                return(options);
            }
            options.Add(new MassSentries());
            options.Add(new GreedySentries());
            options.Add(new DefensiveSentries()
            {
                DelayAttacking = true
            });

            return(options);
        }
Exemplo n.º 2
0
        public virtual Ship CreatePlayerShip(World world, Vector2 position, int shipID, float rotation,
                                             Vector2 velocity, string playerName, ShipStats shipStats, List <WeaponTypes> weaponTypes, HashSet <int> teams)
        {
            if (PlayerShip != null)
            {
                _teamManager.DeRegisterObject(PlayerShip);
                _targetManager.DeRegisterObject(PlayerShip);
                if (PlayerShip.IsBodyValid)
                {
                    Debugging.DisposeStack.Push(this.ToString());
                    PlayerShip.Body.Dispose();
                }
            }

            if (_shipList.ContainsKey(shipID))
            {
                _positionUpdateList.Remove(_shipList[shipID]);

                _shipList.Remove(shipID);
            }

            Ship tempShip;


            switch (shipStats.ShipType)
            {
            case ShipTypes.Barge:
                tempShip = new Barge(position, velocity, rotation, shipID, (int)_clientPlayerInfoManager.PlayerID, playerName,
                                     shipStats, _particleManager,
                                     world, _spriteBatch, GetTexture(shipStats.ShipType), teams);
                break;

            case ShipTypes.SuperCoolAwesome3DShip:
                tempShip = new SuperCoolAwesome3DShip(_spriteBatch, GetModel(shipStats.ShipType), position, velocity, rotation, shipID, (int)_clientPlayerInfoManager.PlayerID, playerName,
                                                      shipStats, _particleManager,
                                                      world, teams);
                break;

            case ShipTypes.Reaper:
                tempShip = new Reaper(position, velocity, rotation, shipID, (int)_clientPlayerInfoManager.PlayerID, playerName,
                                      shipStats, _particleManager,
                                      world, _spriteBatch, GetTexture(shipStats.ShipType), teams);
                break;

            case ShipTypes.BattleCruiser:
                tempShip = new Battlecruiser(position, velocity, rotation, shipID, (int)_clientPlayerInfoManager.PlayerID, playerName,
                                             shipStats, _particleManager,
                                             world, _spriteBatch, GetTexture(shipStats.ShipType), teams);
                break;

            case ShipTypes.Penguin:
                tempShip = new Penguin(position, velocity, rotation, shipID, (int)_clientPlayerInfoManager.PlayerID, playerName,
                                       shipStats, _particleManager,
                                       world, _spriteBatch, GetTexture(shipStats.ShipType), teams);
                break;

            case ShipTypes.Dread:
                tempShip = new Dread(position, velocity, rotation, shipID, (int)_clientPlayerInfoManager.PlayerID, playerName,
                                     shipStats, _particleManager,
                                     world, _spriteBatch, GetTexture(shipStats.ShipType), teams);
                break;

            default:
                Console.WriteLine("Ship type not implemented in ClientShipManager.CreatePlayerShip");
                return(null);
            }

            byte slot = 0;

            foreach (var w in weaponTypes)
            {
                tempShip.SetWeapon(_createWeapon(tempShip, _projectileManager, w, slot), slot);
                slot++;
            }

            SetPilot(tempShip, Debugging.IsBot);

            _shipList.Add(tempShip.Id, tempShip);
            _positionUpdateList.Add(tempShip);

            _playerShipManager.PlayerShip = tempShip;
            _teamManager.RegisterObject(tempShip);

            _updateIgnoreList.Add(PlayerShip.Id);


            tempShip.CanLandWarp = true;
            return(tempShip);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Used to create new network or NPC ships
        /// DO NOT USE FOR PLAYERSHIP
        /// ignorePositionUpdates should only be used by the Simulator
        /// </summary>
        public Ship CreateShip(World world, bool isNPC, Vector2 position, int shipID, float rotation, Vector2 velocity,
                               string playerName,
                               ShipStats shipStats, List <WeaponTypes> weaponTypes, HashSet <int> teams, bool ignorePositionUpdates = false)
        {
            Ship tempShip;


            _targetManager.DisableTargetSetting();

            switch (shipStats.ShipType)
            {
            case ShipTypes.Barge:
                tempShip = new Barge(position, velocity, rotation, shipID, 0,
                                     playerName, shipStats,
                                     _particleManager,
                                     world, _spriteBatch, GetTexture(shipStats.ShipType), teams);
                tempShip.Pilot = new NetworkPilot(tempShip, new ShipBodyDataObject(BodyTypes.NetworkShip, shipID, tempShip));
                break;

            case ShipTypes.Reaper:
                tempShip = new Reaper(position, velocity, rotation, shipID, 0, playerName,
                                      shipStats,
                                      _particleManager,
                                      world, _spriteBatch, GetTexture(shipStats.ShipType), teams);
                tempShip.Pilot = new NetworkPilot(tempShip, GenerateNetworkShipBodyData(shipID, tempShip));
                break;

            case ShipTypes.SuperCoolAwesome3DShip:
                tempShip = new SuperCoolAwesome3DShip(_spriteBatch, GetModel(shipStats.ShipType), position, velocity, rotation, shipID, 0,
                                                      playerName, shipStats,
                                                      _particleManager,
                                                      world, teams);
                tempShip.Pilot = new NetworkPilot(tempShip, new ShipBodyDataObject(BodyTypes.NetworkShip, shipID, tempShip));
                break;


            case ShipTypes.BattleCruiser:
                tempShip = new Battlecruiser(position, velocity, rotation, shipID, 0,
                                             playerName, shipStats,
                                             _particleManager,
                                             world, _spriteBatch, GetTexture(shipStats.ShipType), teams);
                tempShip.Pilot = new NetworkPilot(tempShip, GenerateNetworkShipBodyData(shipID, tempShip));
                break;

            case ShipTypes.Penguin:
                tempShip = new Penguin(position, velocity, rotation, shipID, 0,
                                       playerName, shipStats,
                                       _particleManager,
                                       world, _spriteBatch, GetTexture(shipStats.ShipType), teams);
                tempShip.Pilot = new NetworkPilot(tempShip, GenerateNetworkShipBodyData(shipID, tempShip));
                break;

            case ShipTypes.Dread:
                tempShip = new Dread(position, velocity, rotation, shipID, 0,
                                     playerName, shipStats,
                                     _particleManager,
                                     world, _spriteBatch, GetTexture(shipStats.ShipType), teams);
                tempShip.Pilot = new NetworkPilot(tempShip, GenerateNetworkShipBodyData(shipID, tempShip));

                break;

            default:
                ConsoleManager.WriteLine("Ship type not implemented in ClientShipManager.CreateShip",
                                         ConsoleMessageType.Error);
                return(null);
            }

            if (!_simulateNPCs || tempShip.Pilot.PilotType == PilotType.NetworkPlayer)
            {
                tempShip.BodyBehaviors.Add(new LerpBodyBehavior(_spriteBatch, _textureManager, tempShip, 100));
            }

            tempShip.IsLocalSim = (_simulateNPCs && isNPC);
            AddShip(shipID, tempShip);

            byte numSet = 0;

            foreach (var t in weaponTypes)
            {
                tempShip.SetWeapon(_createWeapon(tempShip, _projectileManager, t, numSet), numSet);
                numSet++;
            }


            tempShip.Pilot = isNPC
                ? new NPCPilot(tempShip, GenerateNetworkShipBodyData(shipID, tempShip))
                : new NPCPilot(tempShip, new ShipBodyDataObject(BodyTypes.NetworkShip, shipID, tempShip));

            if (ignorePositionUpdates)
            {
                _updateIgnoreList.Add(tempShip.Id);
            }

            _targetManager.EnableTargetSetting();


            return(tempShip);
        }
Exemplo n.º 4
0
        public List <Build> ProtossBuilds(Bot bot)
        {
            List <Build> options = new List <Build>();

            if (Bot.Debug)
            {
                foreach (Strategy strategy in bot.EnemyStrategyAnalyzer.Strategies)
                {
                    if (strategy.DetectedPreviously)
                    {
                        System.Console.WriteLine("Detected previous strategy: " + strategy.Name());
                    }
                }
            }

            if (bot.EnemyRace == Race.Terran)
            {
                if (Marine.Get().DetectedPreviously &&
                    !Reaper.Get().DetectedPreviously &&
                    !Marauder.Get().DetectedPreviously &&
                    !Cyclone.Get().DetectedPreviously &&
                    !Banshee.Get().DetectedPreviously &&
                    !SiegeTank.Get().DetectedPreviously &&
                    !Medivac.Get().DetectedPreviously &&
                    !Viking.Get().DetectedPreviously &&
                    !Raven.Get().DetectedPreviously &&
                    !Battlecruiser.Get().DetectedPreviously &&
                    !WidowMine.Get().DetectedPreviously &&
                    !Hellion.Get().DetectedPreviously &&
                    !Thor.Get().DetectedPreviously &&
                    !Liberator.Get().DetectedPreviously)
                {
                    // ValinMarineBot
                    options.Add(new NinjaTurtles());
                    return(options);
                }
                if (BattlecruiserRush.Get().DetectedPreviously &&
                    Thor.Get().DetectedPreviously &&
                    WidowMine.Get().DetectedPreviously)
                {
                    // BenBotBC
                    options.Add(new OneBaseStalkerImmortal());
                    return(options);
                }
                if (Battlecruiser.Get().DetectedPreviously &&
                    !BattlecruiserRush.Get().DetectedPreviously &&
                    !Marauder.Get().DetectedPreviously &&
                    !Banshee.Get().DetectedPreviously &&
                    !Reaper.Get().DetectedPreviously &&
                    !Cyclone.Get().DetectedPreviously &&
                    !Medivac.Get().DetectedPreviously &&
                    !Raven.Get().DetectedPreviously)
                {
                    options.Add(new MassVoidray()
                    {
                        SkipDefenses = true
                    });
                    return(options);
                }

                /*
                 * if (ProxyDetected.Get().DetectedPreviously
                 *  && !Marauder.Get().DetectedPreviously
                 *  && Banshee.Get().DetectedPreviously)
                 * {
                 *  options.Add(new AntiMicro());
                 *  return options;
                 * }
                 */
                if (ProxyDetected.Get().DetectedPreviously &&
                    Marauder.Get().DetectedPreviously &&
                    Banshee.Get().DetectedPreviously)
                {
                    // MicroMachine
                    options.Add(new AntiMicro()
                    {
                        HuntProxies = true, CounterProxyMarauder = false
                    });
                    //options.Add(new NinjaTurtles() { Expand = true });
                    //options.Add(new OneBaseTempest() { DefendingStalker = true });
                    return(options);
                }
                if (ProxyDetected.Get().DetectedPreviously &&
                    !Banshee.Get().DetectedPreviously)
                {
                    // Strelok
                    //options.Add(new PvTStalkerImmortal() { BuildReaperWall = true, ProxyPylon = false, DelayObserver = true, SendScout = true, MassTanksDetected = MassTank.Get().DetectedPreviously });
                    options.Add(new OneBaseStalkerImmortal()
                    {
                        UseSentry = true
                    });
                    options.Add(new OneBaseTempest());
                    return(options);
                }
                if (Marine.Get().DetectedPreviously &&
                    Medivac.Get().DetectedPreviously &&
                    Viking.Get().DetectedPreviously &&
                    Reaper.Get().DetectedPreviously &&
                    Raven.Get().DetectedPreviously &&
                    !Cyclone.Get().DetectedPreviously &&
                    !Marauder.Get().DetectedPreviously &&
                    !Banshee.Get().DetectedPreviously)
                {
                    options.Add(new OneBaseStalkerImmortal());
                    //options.Add(new PvTStalkerImmortal() { BuildReaperWall = false, ProxyPylon = false, DelayObserver = true, SendScout = false, MassTanksDetected = true });
                    return(options);
                }
                if (Marine.Get().DetectedPreviously &&
                    Medivac.Get().DetectedPreviously &&
                    Viking.Get().DetectedPreviously &&
                    Reaper.Get().DetectedPreviously &&
                    !Raven.Get().DetectedPreviously &&
                    Marauder.Get().DetectedPreviously &&
                    Liberator.Get().DetectedPreviously &&
                    !Banshee.Get().DetectedPreviously)
                {
                    // Jensiiibot
                    //options.Add(new PvTStalkerTempest());
                    //options.Add(new Builds.Protoss.WorkerRush() { CounterJensiii = true, BuildStalkers = true });
                    //options.Add(new PvTStalkerImmortal() { BuildReaperWall = true, ProxyPylon = false, DelayObserver = true, MassTanksDetected = MassTank.Get().DetectedPreviously, UseColosus = false });
                    options.Add(new PvTZealotImmortal());
                    return(options);
                }
                if (Marine.Get().DetectedPreviously &&
                    Medivac.Get().DetectedPreviously &&
                    Viking.Get().DetectedPreviously &&
                    Reaper.Get().DetectedPreviously &&
                    Cyclone.Get().DetectedPreviously &&
                    !Marauder.Get().DetectedPreviously &&
                    !Liberator.Get().DetectedPreviously &&
                    !Banshee.Get().DetectedPreviously)
                {
                    // Rusty
                    options.Add(new OneBaseStalkerImmortal());
                    return(options);
                }
                if (Marine.Get().DetectedPreviously &&
                    Medivac.Get().DetectedPreviously &&
                    Viking.Get().DetectedPreviously &&
                    Reaper.Get().DetectedPreviously &&
                    !Raven.Get().DetectedPreviously &&
                    Cyclone.Get().DetectedPreviously &&
                    Marauder.Get().DetectedPreviously &&
                    !Liberator.Get().DetectedPreviously &&
                    !Banshee.Get().DetectedPreviously &&
                    Thor.Get().DetectedPreviously &&
                    SiegeTank.Get().DetectedPreviously &&
                    MassTank.Get().DetectedPreviously &&
                    Hellbat.Get().DetectedPreviously)
                {
                    // MechSweep
                    options.Add(new OneBaseTempest()
                    {
                        RequiredSize = 3
                    });
                    return(options);
                }

                options.Add(new PvTStalkerImmortal()
                {
                    BuildReaperWall = true, ProxyPylon = false, DelayObserver = true, MassTanksDetected = MassTank.Get().DetectedPreviously, UseColosus = false
                });
            }
            else if (bot.EnemyRace == Race.Zerg)
            {
                if (Bot.Main.OpponentID == "eed44128-f488-4e31-b457-8e55f8a95628")
                {
                    options.Add(new PvZHjax()
                    {
                        CounterRoaches = false, DefendNydus = false
                    });
                    return(options);
                }
                options.Add(new PvZHjax());
                return(options);

                /*
                 * if (Lurker.Get().DetectedPreviously)
                 * {
                 *  //Kagamine
                 *  //options.Add(new PvZAdeptIntoVoidray());
                 *  //options.Add(new WorkerRush());
                 *  options.Add(new PvZHjax());
                 *  return options;
                 * }
                 * if (Mutalisk.Get().DetectedPreviously
                 *  && !Lurker.Get().DetectedPreviously)
                 * {
                 *  options.Add(new OneBaseStalkerImmortal() { StartZealots = true });
                 *  return options;
                 * }
                 * if (Hydralisk.Get().DetectedPreviously && StrategyAnalysis.ZerglingRush.Get().DetectedPreviously)
                 * {
                 *  options.Add(new ZealotRush());
                 *  return options;
                 * }
                 * if (RoachRush.Get().DetectedPreviously || StrategyAnalysis.ZerglingRush.Get().DetectedPreviously)
                 * {
                 *  options.Add(new PvZRushDefense());
                 *  options.Add(new NinjaTurtles());
                 *  return options;
                 * }
                 * if (Roach.Get().DetectedPreviously
                 *  && Zergling.Get().DetectedPreviously
                 *  && !Hydralisk.Get().DetectedPreviously)
                 * {
                 *  options.Add(new PvZRushDefense());
                 *  options.Add(new NinjaTurtles());
                 *  return options;
                 * }
                 * if (Queen.Get().DetectedPreviously
                 *  && Zergling.Get().DetectedPreviously
                 *  && !Hydralisk.Get().DetectedPreviously
                 *  && !Roach.Get().DetectedPreviously)
                 * {
                 *  options.Add(new NinjaTurtles());
                 *  return options;
                 * }
                 * if (bot.PreviousEnemyStrategies.MassHydra
                 *  && MassRoach.Get().DetectedPreviously
                 *  && !Lurker.Get().DetectedPreviously)
                 * {
                 *  options.Add(new OneBaseTempest());
                 *  return options;
                 * }
                 * if (!Zergling.Get().DetectedPreviously
                 *  && !Roach.Get().DetectedPreviously
                 *  && !Hydralisk.Get().DetectedPreviously
                 *  && !Queen.Get().DetectedPreviously
                 *  && !Mutalisk.Get().DetectedPreviously)
                 * {
                 *  options.Add(new OneBaseTempest());
                 *  return options;
                 * }
                 * if (!Zergling.Get().DetectedPreviously
                 *  && Roach.Get().DetectedPreviously
                 *  && !Hydralisk.Get().DetectedPreviously
                 *  && Queen.Get().DetectedPreviously
                 *  && !Mutalisk.Get().DetectedPreviously)
                 * {
                 *  options.Add(new OneBaseTempest());
                 *  return options;
                 * }
                 * options.Add(new OneBaseStalkerImmortal() { StartZealots = true });
                 */
            }
            else if (bot.EnemyRace == Race.Protoss)
            {
                if (Zealot.Get().DetectedPreviously &&
                    VoidRay.Get().DetectedPreviously &&
                    !Carrier.Get().DetectedPreviously &&
                    !Tempest.Get().DetectedPreviously &&
                    !Stalker.Get().DetectedPreviously &&
                    !Adept.Get().DetectedPreviously &&
                    !Immortal.Get().DetectedPreviously &&
                    !StrategyAnalysis.CannonRush.Get().DetectedPreviously)
                {
                    // MavBot3
                    options.Add(new ZealotRush());
                    return(options);
                }
                if (SkippedNatural.Get().DetectedPreviously &&
                    !AdeptHarass.Get().DetectedPreviously &&
                    VoidRay.Get().DetectedPreviously &&
                    Immortal.Get().DetectedPreviously)
                {
                    // AdditionalPylons
                    options.Add(new DoubleRoboProxy());
                    return(options);
                }
                if (Oracle.Get().DetectedPreviously &&
                    ThreeGate.Get().DetectedPreviously &&
                    Zealot.Get().DetectedPreviously &&
                    !Stalker.Get().DetectedPreviously &&
                    !VoidRay.Get().DetectedPreviously &&
                    !Immortal.Get().DetectedPreviously)
                {
                    // LuckyBot
                    options.Add(new OneBaseTempest());
                    return(options);
                }
                if (Carrier.Get().DetectedPreviously &&
                    Collosus.Get().DetectedPreviously &&
                    SkyToss.Get().DetectedPreviously &&
                    Tempest.Get().DetectedPreviously &&
                    !Archon.Get().DetectedPreviously &&
                    !HighTemplar.Get().DetectedPreviously)
                {
                    // TheGoldenArmada
                    options.Add(new OneBaseTempest());
                    return(options);
                }
                options.Add(new OneBaseStalkerImmortal()
                {
                    DoubleRobo = true, EarlySentry = true, AggressiveMicro = true
                });
                return(options);

                /*
                 * if (AdeptHarass.Get().DetectedPreviously
                 *  && SkyToss.Get().DetectedPreviously
                 *  && Carrier.Get().DetectedPreviously
                 *  && HighTemplar.Get().DetectedPreviously
                 *  && VoidRay.Get().DetectedPreviously
                 *  && !StrategyAnalysis.CannonRush.Get().DetectedPreviously)
                 * {
                 *  options.Add(new ZealotRush());
                 *  options.Add(new OneBaseStalkerImmortal());
                 *  return options;
                 * }
                 * if (AdeptHarass.Get().DetectedPreviously)
                 * {
                 *  // SharpenedEdge
                 *  options.Add(new OneBaseTempest());
                 *  options.Add(new Dishwasher());
                 *  return options;
                 * }
                 * if (StrategyAnalysis.CannonRush.Get().DetectedPreviously
                 *  && Tempest.Get().DetectedPreviously)
                 * {
                 *  // ThreeWayLover
                 *  //options.Add(new MassVoidray() { SkipDefenses = true });
                 *  options.Add(new OneBaseTempest());
                 *  return options;
                 * }
                 * if (Sentry.Get().DetectedPreviously
                 *  && Archon.Get().DetectedPreviously
                 *  && !Stalker.Get().DetectedPreviously
                 *  && !Zealot.Get().DetectedPreviously)
                 * {
                 *  options.Add(new TempestProxy());
                 *  return options;
                 * }
                 * if (Zealot.Get().DetectedPreviously
                 *  && StrategyAnalysis.CannonRush.Get().DetectedPreviously
                 *  && Oracle.Get().DetectedPreviously
                 *  && Phoenix.Get().DetectedPreviously
                 *  && Stalker.Get().DetectedPreviously
                 *  && !Immortal.Get().DetectedPreviously)
                 * {
                 *  //Gumby
                 *  options.Add(new NinjaTurtles());
                 *  return options;
                 * }
                 * if (Oracle.Get().DetectedPreviously)
                 * {
                 *  options.Add(new OneBaseTempest());
                 *  return options;
                 * }
                 * if (!Stalker.Get().DetectedPreviously
                 *  && !Zealot.Get().DetectedPreviously
                 *  && !Sentry.Get().DetectedPreviously)
                 * {
                 *  options.Add(new ZealotRush());
                 *  return options;
                 * }
                 * if (Zealot.Get().DetectedPreviously
                 *  && !Stalker.Get().DetectedPreviously)
                 * {
                 *  options.Add(new NinjaTurtles());
                 *  return options;
                 * }
                 *
                 * options.Add(new NinjaTurtles());
                 * options.Add(new PvPMothershipSiege());
                 */
            }

            return(options);
        }