internal static void HandleStormTotemInterception(DialogueBox box, double odds, double stormOdds) { bool stormDialogue = false; List <string> lines = ClimatesOfFerngill.Reflection.GetField <List <string> >(box, "dialogues").GetValue(); if (lines.FirstOrDefault() == Game1.content.LoadString("Strings\\StringsFromCSFiles:Object.cs.12822")) { if (ClimatesOfFerngill.WeatherOpt.Verbose) { ClimatesOfFerngill.Logger.Log($"Rain totem interception firing with roll {odds:N3} vs. odds {stormOdds:N3}"); } // rain totem used, do your thing if (ClimatesOfFerngill.WeatherOpt.StormTotemChange) { if (odds <= stormOdds) { if (ClimatesOfFerngill.WeatherOpt.Verbose) { ClimatesOfFerngill.Logger.Log("Replacing rain with storm.."); } SDVUtilities.SetWeather(Game1.weather_lightning); stormDialogue = true; } } // change dialogue text lines.Clear(); lines.Add(stormDialogue ? ClimatesOfFerngill.Translator.Get("hud-text.desc_stormtotem") : Game1.content.LoadString("Strings\\StringsFromCSFiles:Object.cs.12822")); } }
internal static void SetWeatherTomorrow(string Result, MersenneTwister Dice, FerngillClimate GameClimate, double stormOdds, RangePair TmrwTemps) { //now parse the result. if (Result == "rain") { SDVUtilities.SetWeather(Game1.weather_rain); if (Game1.currentSeason == "winter") { SDVUtilities.SetWeather(Game1.weather_snow); if (GameClimate.AllowRainInWinter && ClimatesOfFerngill.Conditions.TomorrowHigh >= -2.5) { SDVUtilities.SetWeather(Game1.weather_rain); } } //Moved from the *wrong function and logic gate* //snow applies first if (WeatherConditions.IsValidWeatherForSnow(TmrwTemps) && Game1.currentSeason != "spring") { if (ClimatesOfFerngill.WeatherOpt.Verbose) { ClimatesOfFerngill.Logger.Log($"Snow is enabled, with the High for the day being: {TmrwTemps.HigherBound}" + $" and the calculated midpoint temperature being {TmrwTemps.GetMidPoint()}"); } SDVUtilities.SetWeather(Game1.weather_snow); } //apply lightning logic. if (Dice.NextDoublePositive() >= stormOdds && Game1.weatherForTomorrow == Game1.weather_rain) { SDVUtilities.SetWeather(Game1.weather_lightning); if (SDate.Now().Year == 1 && SDate.Now().Season == "spring" && !ClimatesOfFerngill.WeatherOpt.AllowStormsSpringYear1) { SDVUtilities.SetWeather(Game1.weather_rain); } } //tracking time! - Snow fall on Fall 28, if the flag is set. if (Game1.dayOfMonth == 28 && Game1.currentSeason == "fall" && ClimatesOfFerngill.WeatherOpt.SnowOnFall28) { ClimatesOfFerngill.Conditions.ForceTodayTemps(2, -1); SDVUtilities.SetWeather(Game1.weather_snow); } } if (Result == "debris") { SDVUtilities.SetWeather(Game1.weather_debris); } if (Result == "sunny") { SDVUtilities.SetWeather(Game1.weather_sunny); } }