Exemple #1
0
        private void UpdateMissions()
        {
            if (MiningMission)
            {
                _mining.UpdateMission();
            }
            if (ScoutingMission)
            {
                _scouting.UpdateMission();
            }
            if (BuildingMission)
            {
                _building.UpdateMission();
            }

            if (BaseDefenceMission)
            {
                _defense.UpdateMission();
            }
            if (MinerDefenceMission)
            {
                _minerD.UpdateMission();
            }

            if (BaseOffenceMission)
            {
                _bombing.UpdateMission();
            }
            if (MinerOffenceMission)
            {
                _minerO.UpdateMission();
            }
        }
Exemple #2
0
        private void UpdateMissions()
        {
            _mining.UpdateMission();
            _minerOffense.UpdateMission();
            _baseOffense.UpdateMission();
            _building.UpdateMission();
            _scouting.UpdateMission();
            _minerDefense.UpdateMission();
            _baseDefense.UpdateMission();

            var stillAddingPilots = true;
            var idleShips         = _game.AllUnits.Where(_ => _.Active && !_.Docked && _.Team == Team && _.CurrentOrder == null && _.Type != EShipType.Constructor && _.Type != EShipType.Miner && _.Type != EShipType.Lifepod).ToList();

            if (_game.DockedPilots[_t] == 0 && idleShips.Count == 0)
            {
                return;
            }

            if (!_flagHaveBombers)
            {
                _flagHaveBombers = _flagHaveBombers || _game.TechTree[_t].HasResearchedShipType(EShipType.Bomber);
            }
            if (!_flagFoundEnemyBase)
            {
                _flagFoundEnemyBase = _flagFoundEnemyBase || _game.AllBases.Exists(_ => _.IsVisibleToTeam(_t) && _.Active && _.Alliance != Alliance);
            }
            if (!_flagBuiltTech)
            {
                _flagBuiltTech = _flagBuiltTech || _game.AllBases.Exists(_ => _.Active && _.Team == Team && _.IsTechBase());
            }
            if (!_flagBuiltFocusTech)
            {
                _flagBuiltFocusTech = _flagBuiltFocusTech || _game.AllBases.Exists(_ => _.Active && _.Team == Team && _.Type.ToString() == _initTechName);
            }

            _flagFoundEnemyBombers = _game.AllUnits.Exists(_ => _.Active && _.IsVisibleToTeam(_t) && _.Alliance != Alliance && _.CanAttackBases());

            if (_flagFoundEnemyBombers)
            {
                if (_game.DockedPilots[_t] == 0)
                {
                    _minerDefense.ReducePilots(0.75f);
                    _baseOffense.ReducePilots(0.25f);
                }

                if (idleShips.Count > 0)
                {
                    _baseDefense.IncludedShips.AddRange(idleShips);
                    idleShips.Clear();
                }

                stillAddingPilots = true;
                while (stillAddingPilots && _game.DockedPilots[_t] > 0 && _baseDefense.RequireMorePilots())
                {
                    stillAddingPilots = _baseDefense.AddMorePilots();
                }
            }

            if (_flagHaveBombers && _flagFoundEnemyBase)
            {
                if (idleShips.Count > 0)
                {
                    _baseOffense.IncludedShips.AddRange(idleShips);
                    idleShips.Clear();
                }

                while (stillAddingPilots && _game.DockedPilots[_t] > 0 && _baseOffense.RequireMorePilots())
                {
                    stillAddingPilots = _baseOffense.AddMorePilots();
                }
            }

            if (_flagFoundEnemyBase)
            {
                if (_game.DockedPilots[_t] == 0)
                {
                    _minerDefense.ReducePilots(0.75f);
                }
                if (idleShips.Count > 0)
                {
                    _minerOffense.IncludedShips.AddRange(idleShips);
                    idleShips.Clear();
                }

                stillAddingPilots = true;
                while (stillAddingPilots && _game.DockedPilots[_t] > 0 && _minerOffense.RequireMorePilots())
                {
                    stillAddingPilots = _minerOffense.AddMorePilots();
                }
            }

            stillAddingPilots = true;
            while (stillAddingPilots && _game.DockedPilots[_t] > 0 && _scouting.RequireMorePilots())
            {
                stillAddingPilots = _scouting.AddMorePilots();
            }

            if (_building.IncludedShips.Count > 0 || _mining.IncludedShips.Count > 0)
            {
                stillAddingPilots = true;
                while (stillAddingPilots && _game.DockedPilots[_t] > 0 && _minerDefense.RequireMorePilots())
                {
                    stillAddingPilots = _minerDefense.AddMorePilots();
                }
            }
        }