From c5f0f1ef9ffa72e7ac5c70648d4f5f068fda74d2 Mon Sep 17 00:00:00 2001 From: SnappyComebacks <74509817+SnappyComebacks@users.noreply.github.com> Date: Fri, 18 Nov 2022 00:58:15 -0700 Subject: [PATCH] Modify the range of values used to choose a wind speed. Wind speed at high elevation IRL can range from 20 to 160 knots around the globe. You may see wind speed generated here up to 100+ knots, but generally around 40 or so. IRL wind speed appears to depend on the latitude of the sun, not in this implementation. --- game/weather.py | 38 +++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/game/weather.py b/game/weather.py index b8401216..7ce0bae2 100644 --- a/game/weather.py +++ b/game/weather.py @@ -148,8 +148,36 @@ class Weather: wind_direction_2000m = wind_direction + Heading.random(-90, 90) wind_direction_8000m = wind_direction + Heading.random(-90, 90) at_0m_factor = 1 - at_2000m_factor = 2 - at_8000m_factor = 3 + at_2000m_factor = 3 + random.choice([0, 0, 0, 0, 0, 1, 1]) + + high_alt_variation = random.choice( + [ + -3, + -3, + -2, + -2, + -2, + -2, + -2, + -2, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 0, + 0, + 0, + 1, + 1, + 2, + 3, + ] + ) + at_8000m_factor = 8 + high_alt_variation + base_wind = random.randint(minimum, maximum) return WindConditions( @@ -235,7 +263,7 @@ class Cloudy(Weather): return None def generate_wind(self) -> WindConditions: - return self.random_wind(1, 4) + return self.random_wind(2, 4) class Raining(Weather): @@ -255,7 +283,7 @@ class Raining(Weather): return None def generate_wind(self) -> WindConditions: - return self.random_wind(1, 6) + return self.random_wind(2, 6) class Thunderstorm(Weather): @@ -276,7 +304,7 @@ class Thunderstorm(Weather): ) def generate_wind(self) -> WindConditions: - return self.random_wind(1, 8) + return self.random_wind(2, 8) @dataclass