Ejemplo n.º 1
0
        internal static void DynamicRainOnNewDay(WeatherConditions curr, MersenneTwister Dice)
        {
            if (!curr.HasWeather(CurrentWeather.Rain))
            {
                return;
            }

            curr.SetRainAmt(70);
            //Rain chances. This will also affect storms (in that storms still can have variable rain) .
            //only roll this if it's actually raining. :|
            double roll = Dice.NextDouble();

            if (roll <= ClimatesOfFerngill.WeatherOpt.VariableRainChance && Game1.isRaining)
            {
                ClimatesOfFerngill.Logger.Log($"With {roll}, we are setting for variable rain against {ClimatesOfFerngill.WeatherOpt.VariableRainChance}");
                curr.SetVariableRain(true);

                //check for overcast chance first.
                if (Dice.NextDouble() < ClimatesOfFerngill.WeatherOpt.OvercastChance && !Game1.isLightning)
                {
                    WeatherUtilities.SetWeatherOvercast(true);
                    SDVUtilities.AlterWaterStatusOfCrops(water: false);
                    SDVUtilities.ShowMessage(ClimatesOfFerngill.Translator.Get("hud-text.desc_overcast"), 0);
                }

                //now that we've done that base check, we need to change the rainfall...
                //... after we calc rainfall to see if it's watered. Essentially, every time this is called,
                //... it'll check to see if it should flip the tiles.

                //Variable Rain may set the starting rain at 0300 to be something else than normal, and as such, StartingRain should
                // only be checked if IsVariableRain is true.

                // Odds are fixed: Normal (default) is 72%, Light is 16%, Heavy is 6%, Sunshower is 5%, Severe is 1%
                double startingRainRoll = Dice.NextDouble();
                if (startingRainRoll <= .72)
                {
                    curr.StartingRain = RainLevels.Normal;
                }
                else if (startingRainRoll > .72 && startingRainRoll <= .88)
                {
                    curr.StartingRain = RainLevels.Light;
                }
                else if (startingRainRoll > .88 && startingRainRoll <= .94)
                {
                    curr.StartingRain = RainLevels.Heavy;
                }
                else if (startingRainRoll > .94 && startingRainRoll <= .99)
                {
                    curr.StartingRain = RainLevels.Sunshower;
                }
                else if (startingRainRoll > .99)
                {
                    curr.StartingRain = RainLevels.Severe;
                }

                if (Game1.isLightning && !(curr.StartingRain == RainLevels.Light || curr.StartingRain == RainLevels.Sunshower || curr.StartingRain == RainLevels.Normal))
                {
                    curr.StartingRain = RainLevels.Heavy;
                }

                curr.SetRainAmt(WeatherUtilities.GetRainCategoryMidPoint(curr.StartingRain));
                curr.TodayRain = curr.AmtOfRainDrops;

                //now run this for 0300 to 0600.
                for (int i = 0; i < 17; i++)
                {
                    curr.SetRainAmt(GetNewRainAmount(curr.AmtOfRainDrops, ClimatesOfFerngill.Translator));
                    curr.TodayRain += curr.AmtOfRainDrops;
                }

                //set starting amount at 6am
                curr.RefreshRainAmt();
            }
        }