Пример #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 Object.Quality RollProduceQuality(
            SDV.FarmAnimal animal,
            SDV.Farmer farmer,
            int seed)
        {
            var num   = GetFriendship(animal) / 1000.0 - (1.0 - GetHappiness(animal) / 225.0);
            var flag1 = IsCoopDweller(animal);
            var flag2 = Farmer.HasProfession(farmer, Farmer.Profession.Shepherd);
            var flag3 = Farmer.HasProfession(farmer, Farmer.Profession.Butcher);

            if (!flag1 & flag2 || flag1 & flag3)
            {
                num += 0.33;
            }
            var random = new System.Random(seed);

            if (num >= 0.95 && random.NextDouble() < num / 2.0)
            {
                return(Object.Quality.Best);
            }
            if (random.NextDouble() < num / 2.0)
            {
                return(Object.Quality.High);
            }
            return(random.NextDouble() < num ? Object.Quality.Medium : Object.Quality.Low);
        }