Example #1
0
        public static CNetDeckVO CreateTutorialDeck(List <CNetCardVO> cards)
        {
            ulong cover       = 700;
            var   cardIndices = new ulong[] { 288, 253, 354, 700, 673, 379, 287 };
            var   deck        = new CNetDeckVO()
            {
                Index         = _index.NewIndex(),
                DeckName      = "Tutorial",
                IdCardPool    = CardPool.Tutorial,
                IdLimitedPool = CardPool.Tutorial
            };

            deck.Cards = new CNetDeckCardVO[cardIndices.Length];

            for (var i = 0; i < cardIndices.Length; i++)
            {
                var cardIndex = cardIndices[i];
                var card      = cards.First(c => c.CardIndex == cardIndex);

                deck.Cards[i] = new CNetDeckCardVO()
                {
                    Index    = card.Index,
                    Position = i,
                    Card     = card
                };
            }

            deck.CoverCard = cards.First(c => c.CardIndex == cover);
            deck.DeckLevel = deck.CalculateDeckLevel(cards);

            return(deck);
        }
Example #2
0
        public static int CalculateDeckLevel(CNetDeckVO deck, List <CNetCardVO> playerCards)
        {
            var level = 0;

            foreach (var deckCard in deck.Cards)
            {
                var playerCard = playerCards.First(pc => pc.Index == deckCard.Index);

                if (playerCard.IsPromoCard)
                {
                    level += 6;
                }
                else
                {
                    level += playerCard.UpgradeLevel;
                    level += playerCard.ChargeAmount;
                }
            }

            return(level);
        }