예제 #1
0
        public static bool RollDeluxeProduceChance(SDV.FarmAnimal animal, double luck, int seed)
        {
            if (IsBaby(animal) || !IsProduceAnItem(GetDeluxeProduce(animal)))
            {
                return(false);
            }
            var random    = new System.Random(seed);
            var happiness = GetHappiness(animal);

            if (random.NextDouble() >= happiness / 150.0)
            {
                return(false);
            }
            var num        = 0.0;
            var friendship = GetFriendship(animal);

            if (happiness > 200)
            {
                num = happiness * 1.5;
            }
            else if (happiness <= 100)
            {
                num = happiness - 100;
            }
            if (luck != 0.0)
            {
                return(Random.NextDouble() < (friendship + num) / 5000.0 + luck);
            }
            return(friendship >= 200 && Random.NextDouble() < (friendship + num) / 1200.0);
        }
예제 #2
0
        public static string GetRandomTypeFromProduce(
            int[] produceIndexes,
            Dictionary <string, List <string> > restrictions)
        {
            var typesFromProduce = GetTypesFromProduce(produceIndexes, restrictions);
            var index            = Random.Next(typesFromProduce.Count);

            return(typesFromProduce.Any() ? typesFromProduce[index] : null);
        }
예제 #3
0
 public static bool RollBlueChickenChance(SDV.Farmer farmer) =>
 BlueChickenIsUnlocked(farmer) && Random.NextDouble() >= 0.25;
예제 #4
0
 public static void SetRandomFacingDirection(SDV.FarmAnimal animal) => animal.faceDirection(Random.Next(4));