Ejemplo n.º 1
0
        private static DirectorCard SelectCard(WeightedSelection <DirectorCard> deck, int maxCost)
        {
            WeightedSelection <DirectorCard> cardSelector = new WeightedSelection <DirectorCard>(8);

            cardSelector.Clear();
            int i     = 0;
            int count = deck.Count;

            while (i < count)
            {
                WeightedSelection <DirectorCard> .ChoiceInfo choice = deck.GetChoice(i);
                if (choice.value.cost <= maxCost)
                {
                    cardSelector.AddChoice(choice);
                }
                i++;
            }
            if (cardSelector.Count == 0)
            {
                return(null);
            }
            return(cardSelector.Evaluate(new Xoroshiro128Plus((ulong)Run.instance.stageRng.nextUint).nextNormalizedFloat));
        }