Ejemplo n.º 1
0
        public static IEnumerable <CardVm> GetDeckLands(string deckName)
        {
            Console.WriteLine("Getting Deck");
            var deck = DeckRepository.GetDeck(deckName);

            Console.WriteLine("Looking for legal cards");
            var legalCards = CardRepository.GetAllCommanderLegalCardInGivenColors(CardBLL.GetCardColors(CardMapper.Map(deck.Commander)));

            Console.WriteLine($"Attempting to find lands in {legalCards.Count()} cards.");

            return(CardMapper.Map(legalCards.Where(c => c.Types.Contains("land"))));
        }
Ejemplo n.º 2
0
        public static bool BuildCommanderDeck(string deckName, string tribeType)
        {
            var deck = DeckRepository.GetDeck(deckName);

            if (deck.Commander == null)
            {
                return(false);
            }

            var legalCards = CardRepository.GetAllCommanderLegalCardInGivenColors(CardBLL.GetCardColors(CardMapper.Map(deck.Commander)));
            var tempCards  = legalCards.Where(c => c.SubTypes.Contains(tribeType) || c.RulesText.Contains(tribeType) && c.Id != deck.Commander.Id);

            if (tempCards.Count() > 34)
            {
                tempCards = tempCards.ToList().GetRange(0, 34);
            }



            DeckRepository.UpdateDeck(deck);

            return(true);
        }