Exemple #1
0
        private void SetDefinitionAsMineralFromPool(MissionInProgress missionInProgress)
        {
            //find mineral definition to work with

            var possibleDefinitions = missionDataCache.GetPossibleMineralDefinitions(missionInProgress.myLocation.ZoneConfig.Id);

            Log("possible mineral definitions:" + possibleDefinitions.Count);

            possibleDefinitions = possibleDefinitions.Except(missionInProgress.SelectedMinerals).ToList();

            Log("except choosen:" + possibleDefinitions.Count);

            if (possibleDefinitions.Count == 0)
            {
                Log("no possible mineral definition to select from. " + this + " " + missionInProgress);
                throw new PerpetuumException(ErrorCodes.ConsistencyError);
            }

            var choosenMineral = possibleDefinitions.RandomElement();

            missionInProgress.AddToSelectedMinerals(choosenMineral);

            Log("selected mineral:" + choosenMineral);

            definition = choosenMineral;
        }