Пример #1
0
 public SeedRecipe(PseudoRNG random, uint seed)
 {
     Seed   = seed;
     Random = random;
     PickMaterials(Liquids, 3);
     PickMaterials(Alchemy, 1);
     ShuffleMaterials();
     Random.Get();
     Random.Get();
 }
Пример #2
0
        private void ShuffleMaterials()
        {
            PseudoRNG random = new PseudoRNG((Seed >> 1) + 12534);

            for (int i = Materials.Count - 1; i >= 0; i--)
            {
                int rand = (int)(random.Get() * (i + 1));
                var tmp  = Materials[i];
                Materials[i]    = Materials[rand];
                Materials[rand] = tmp;
            }
        }
Пример #3
0
        private void PickMaterials(List <string> source, int count)
        {
            int counter = 0;

            while (counter < count)
            {
                var picked = source[(int)(Random.Get() * source.Count)];
                if (!Materials.Any(v => v == picked))
                {
                    Materials = Materials.Append(picked).ToList();
                    counter++;
                }
            }
            return;
        }
Пример #4
0
        public static SeedRecipeData GetRecipesForSeed(uint seed)
        {
            var random = new PseudoRNG(seed * 0.17127 + 1323.5903);

            for (int i = 0; i < 5; i++)
            {
                random.Get();
            }

            return(new SeedRecipeData
            {
                LivelyConcoction = (new SeedRecipe(random, seed)).GetMaterials(),
                AlchemicalPrecursor = (new SeedRecipe(random, seed)).GetMaterials()
            });
        }