コード例 #1
0
        public VariantAI(StrategyGame game, int team, Color teamColour, Ship.ShipEventHandler shipHandler) : base(game, team, teamColour, shipHandler)
        {
            _scouting     = new ScoutingMission(game, this, _shipHandler);
            _minerOffense = new MinerOffenseMission(game, this, shipHandler);
            _mining       = new MinerMission(game, this, shipHandler);
            _building     = new BuilderMission(game, this, shipHandler);
            _baseOffense  = new BombingMission(game, this, shipHandler);
            _minerDefense = new MinerDefenseMission(game, this, shipHandler);
            _baseDefense  = new BaseDefenseMission(game, this, shipHandler);

            if (StrategyGame.RandomChance(0.5f))
            {
                _initTech = EInitialTargetTech.ChooseInSector;
            }
            else
            {
                _initTech = (StrategyGame.RandomChance(0.75f)) ? EInitialTargetTech.Starbase : EInitialTargetTech.Shipyard;
            }

            _focusBuildOrder = StrategyGame.RandomChance(0.95f);

            // Play test a specific focus:
            //_initTech = EInitialTargetTech.Shipyard;
            //_focusBuildOrder = true;

            _initTechName = Enum.GetName(typeof(EInitialTargetTech), _initTech);
        }
コード例 #2
0
        public CommanderAI(StrategyGame game, int team, Color teamColour, Ship.ShipEventHandler shipHandler, bool randomise = false) : base(game, team, teamColour, shipHandler)
        {
            CreditPriorities = new Dictionary <EAiCreditPriorities, float>();
            foreach (var e in (EAiCreditPriorities[])Enum.GetValues(typeof(EAiCreditPriorities)))
            {
                CreditPriorities.Add(e, 0);
            }

            PilotPriorities = new Dictionary <EAiPilotPriorities, float>();
            foreach (var e in (EAiPilotPriorities[])Enum.GetValues(typeof(EAiPilotPriorities)))
            {
                PilotPriorities.Add(e, 0);
            }

            Scouting          = ScoutingMission = true;
            MinerOffence      = MinerOffenceMission = true;
            MinerDefence      = MinerDefenceMission = true;
            BaseDefence       = BaseDefenceMission = true;
            BaseOffence       = BaseOffenceMission = true;
            MiningMission     = true;
            BuildingMission   = true;
            CreditsForDefence = CreditsForOffence = CreditsForExpansion = true;

            _scouting = new ScoutingMission(_game, this, _shipHandler);
            _building = new BuilderMission(_game, this, _shipHandler);
            _mining   = new MinerMission(_game, this, _shipHandler);
            _bombing  = new BombingMission(_game, this, _shipHandler);
            _defense  = new BaseDefenseMission(_game, this, _shipHandler);
            _minerO   = new MinerOffenseMission(_game, this, _shipHandler);
            _minerD   = new MinerDefenseMission(_game, this, _shipHandler);

            if (randomise)
            {
                var rnd = StrategyGame.Random;
                _scoutFocus        = rnd.Next(40, 100) / 10f;
                _minerOffenseFocus = rnd.Next(40, 100) / 10f;
                _baseDefenseFocus  = rnd.Next(40, 100) / 10f;
                _minerDefenseFocus = rnd.Next(40, 100) / 10f;
            }
        }