private static Cards.Loading.DeckSpec GenerateOpposingDeck(int difficulty, Cards.Loading.MetaDataLibrary metaDataLibrary) { const int kNumCardsInDeck = Cards.CardGameState.kNumStartingCards; int numCardsAtBaseTier = 10; int baseTier = difficulty / 2; // If difficulty is odd get half the deck // from the tier above the base tier. if (difficulty % 2 == 1) { numCardsAtBaseTier = kNumCardsInDeck / 2; } Cards.Loading.DeckSpec opposingDeck = new Cards.Loading.DeckSpec(); int tier = baseTier; for (int i = 0; i < kNumCardsInDeck; i++) { if (i == numCardsAtBaseTier) { tier = baseTier + 1; } opposingDeck.IncrementEntry(metaDataLibrary.GetRandomCardByTier(tier).mName, 1); } return(opposingDeck); }
public MapItem(System.Random R, Cards.Loading.CardPool cardPool, Cards.Loading.MetaDataLibrary metaDataLibrary, string name, int difficultyTier) { mRewards = new Cards.CardList(); // Difficuly tier goes up in ones // Dif. => Reward // 0, 1 => 1 // 2, 3 => 2 // etc. int rewardTier = (difficultyTier / 2) + 1; for (int i = 0; i < 3; i++) { Cards.Loading.CardMetaData metaData = metaDataLibrary.GetRandomCardByTier(rewardTier); if (metaData != null) { mRewards.AddCard(Cards.Loading.CardLoading.ProduceCard( metaData.mName, cardPool)); } } Completed = false; Available = false; mName = name; mDifficultyTier = difficultyTier; mDidPlayerWin = false; }