Пример #1
0
        protected ArtifactInfo GetArtifactFromPool(MissionInProgress missionInProgress)
        {
            var possibleArtifacts = missionDataCache.GetAllArtifactInfos;

            Log("possible artifacts: " + possibleArtifacts.Count);

            possibleArtifacts = possibleArtifacts.Except(missionInProgress.SelectedArtifactInfos).ToList();

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

            if (possibleArtifacts.Count == 0)
            {
                Logger.Error("no mission item definition to select from. " + this + " " + missionInProgress);
                throw new PerpetuumException(ErrorCodes.ConsistencyError);
            }

            var choosenArtifact = possibleArtifacts.RandomElement();

            missionInProgress.AddToSelectedArtifacts(choosenArtifact);

            Log("selected artifact: " + choosenArtifact);

            return(choosenArtifact);
        }