Пример #1
0
        public Effect[] Get(float quality , Regulus.Utility.IRandom provider)
        {
            var effects = new List<Effect>();
            var effectCosts = new List<EffectCost>(_Costs) ;
            while(quality > 0)
            {
                var cost = (from e in effectCosts
                            where e.Quality >= quality && _RollOut(e.Chances, provider.NextFloat() )
                             orderby e.Quality descending
                             select e).FirstOrDefault();
                if (cost == null)
                    break;
                effectCosts.Remove(cost);
                quality -= cost.Quality;

                effects.Add(cost.Effect);
            }

            return effects.ToArray();
        }