private static void AddCardsToDeck(ref List <BaseCard> deck, ClassificationTypes classification, int amount) { var potentialCards = CardLibrary.Where(c => c.Classification == classification).ToList(); int cardsAdded = 0; while (cardsAdded < amount) { int selected = Random.Range(0, potentialCards.Count); var card = potentialCards[selected]; var deckCopy = deck.ToList(); bool canBeAdded = (card.DeckGenerationRequirements.Count == 0 || card.DeckGenerationRequirements.All(req => req.MeetsRequirement(deckCopy))) && card.MeetsRarityRequirements() && deck.Count(c => c.CardName.Equals(card.CardName)) < 4; if (canBeAdded) { deck.Add(card); cardsAdded++; } } }
/// <summary> /// Create a new classification type and add it to the registry. /// </summary> public IClassificationType CreateClassificationType(string type, IEnumerable <IClassificationType> baseTypes) { if (type == null) { throw new ArgumentNullException(nameof(type)); } if (baseTypes == null) { throw new ArgumentNullException(nameof(baseTypes)); } if (ClassificationTypes.ContainsKey(type)) { throw new InvalidOperationException(LookUp.Strings.ClassificationAlreadyAdded); } // Use the non-canonical name for the actual type ClassificationTypeImpl classificationType = new ClassificationTypeImpl(type); foreach (var baseType in baseTypes) { classificationType.AddBaseType(baseType); } ClassificationTypes.Add(type, classificationType); return(classificationType); }
private void ClassifyEntities(ClassificationTypes type) { ModelForm frmModel = (ModelForm)dockPanel1.ActiveDocument; if (frmModel != null) { frmModel.ClassifyEntities(type); } }
public void ClassifyEntities(ClassificationTypes type) { Classification c = new Classification(dataSet, visibleTables); SetEntityTypes(c.ClassificateEntities(type)); DrawEntityTypes(); }
private static string GetClassification(IEnumerable <Classification> classifications, ClassificationTypes classification) { return(classifications == null ? string.Empty : classifications.Where(c => c.Name == classification.ToString()).Select(c => c.Text).FirstOrDefault()); }