예제 #1
0
        /// <summary>
        /// find mineral definition to work with
        /// </summary>
        /// <param name="missionInProgress"></param>
        private void SetDefinitionAsPlantMineralFromPool(MissionInProgress missionInProgress)
        {
            var possibleDefinitions = GetPossibleHarvestableDefinition(missionInProgress.myLocation.Zone).ToList();

            Log($"possible plant mineral definitions:{possibleDefinitions.Count}");

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

            Log($"except choosen:{possibleDefinitions.Count}");

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

            var choosenMineral = possibleDefinitions.RandomElement();

            missionInProgress.AddToSelectedPlantMinerals(choosenMineral);

            Log("selected plant mineral:" + choosenMineral);
            definition = choosenMineral;
        }