/// <summary> /// Gets a list of all cards added to the given card pool by mods /// which satisfy the constraints specified by the parameters passed in. /// Cards which naturally appear in the pool will not be returned. /// </summary> /// <param name="cardPoolID">ID of the card pool to get cards for</param> /// <param name="classData">Card must be part of this class</param> /// <param name="paramRarity">Rarity which is compared against the rarities of the cards in the pool using rarityCondition</param> /// <param name="rarityCondition">Rarity condition which takes into account paramRarity and the rarities of the cards in the pool</param> /// <param name="testRarityCondition">Whether or not the rarity condition should be checked</param> /// <returns>A list of cards added to the card pool with given ID by mods, all of which satisfy the given constraints.</returns> public static List <CardData> GetCardsForPoolSatisfyingConstraints(string cardPoolID, ClassData classData, CollectableRarity paramRarity, CardPoolHelper.RarityCondition rarityCondition, bool testRarityCondition) { var allValidCards = GetCardsForPool(cardPoolID); var validCards = new List <CardData>(); if (rarityCondition == null) { testRarityCondition = false; } foreach (CardData cardData in allValidCards) { if (cardData.GetLinkedClass() == classData && (!testRarityCondition || rarityCondition(paramRarity, cardData.GetRarity()))) { validCards.Add(cardData); } } return(validCards); }
static void Postfix(ref List <CardData> __result, ref CardPool cardPool, ClassData classData, CollectableRarity paramRarity, CardPoolHelper.RarityCondition rarityCondition, bool testRarityCondition) { List <CardData> customCardsToAddToPool = CustomCardPoolManager.GetCardsForPoolSatisfyingConstraints(cardPool.name, classData, paramRarity, rarityCondition, testRarityCondition); __result.AddRange(customCardsToAddToPool); }