3 const float RAIN_THRESHOLD = 0.6;
4 const float STORM_THRESHOLD = 0.85;
6 const int OVERCAST_MIN_TIME = 600;
7 const int OVERCAST_MAX_TIME = 900;
9 const int RAIN_TIME_MIN = 60;
10 const int RAIN_TIME_MAX = 120;
12 const int CLEAR_WEATHER = 1;
13 const int CLOUDY_WEATHER = 2;
14 const int BAD_WEATHER = 3;
16 const int CLEAR_WEATHER_CHANCE = 50;
17 const int BAD_WEATHER_CHANCE = 75;
19 protected int m_clearWeatherChance = CLEAR_WEATHER_CHANCE;
21 protected int m_badWeatherChance = BAD_WEATHER_CHANCE;
23 protected int m_stepValue = 5;
25 protected int m_sameWeatherCnt = 0;
26 protected int m_chance = 50;
28 protected int m_choosenWeather = 1;
29 protected int m_lastWeather = 0;
31 protected static const ref
array<vector> LIVONIA_ARTY_STRIKE_POS =
33 "7440.00 417.00 -500.00",
34 "-500.00 276.00 5473.00",
35 "-500.00 265.00 9852.00",
36 "4953.00 240.00 13300.00",
37 "9620.00 188.00 13300.00",
38 "13300.00 204.00 10322.00",
39 "13300.00 288.00 6204.00",
40 "13300.00 296.00 -500.00"
54 m_MinTemps = {-7,-7.4,-4.1,1.5,7,11.3,13.4,13.1,9.3,5.3,0.8,-3.6};
63 m_MaxTemps = {-2.5,-2.1,2.3,9,15.5,19.4,20.9,20.4,16,10.5,4.2,0.1};
72 m_FiringPos = LIVONIA_ARTY_STRIKE_POS;
75 override bool WeatherOnBeforeChange(
EWeatherPhenomenon type,
float actual,
float change,
float time )
81 m_Weather.SetStorm( 1.0, STORM_THRESHOLD, 20 );
83 m_Weather.SetRainThresholds( 0.0, 1.0, 60 );
84 m_Weather.SetWindMaximumSpeed( 20 );
85 m_Weather.SetWindFunctionParams( 0.1, 1.0, 20 );
93 phmnValue =
Math.RandomFloatInclusive( 0.1, 0.4 );
94 phmnTime =
Math.RandomIntInclusive( OVERCAST_MIN_TIME, OVERCAST_MAX_TIME );
95 phmnLength =
Math.RandomIntInclusive( OVERCAST_MIN_TIME, OVERCAST_MAX_TIME );
99 m_chance =
Math.RandomIntInclusive( 0, 100 );
102 if ( m_lastWeather == CLEAR_WEATHER )
104 m_clearWeatherChance -= ( m_stepValue * m_sameWeatherCnt);
107 if ( m_lastWeather == CLOUDY_WEATHER )
109 m_clearWeatherChance += ( m_stepValue * m_sameWeatherCnt);
110 m_badWeatherChance -= ( m_stepValue * m_sameWeatherCnt);
113 if ( m_lastWeather == BAD_WEATHER )
115 m_clearWeatherChance += m_stepValue;
116 m_badWeatherChance += ( m_stepValue * m_sameWeatherCnt );
120 if ( m_chance < m_clearWeatherChance )
122 m_choosenWeather = CLEAR_WEATHER;
123 if ( m_lastWeather == CLEAR_WEATHER )
126 else if ( m_chance > m_badWeatherChance )
128 m_choosenWeather = BAD_WEATHER;
129 if ( m_lastWeather == BAD_WEATHER )
134 m_choosenWeather = CLOUDY_WEATHER;
135 if ( m_lastWeather == CLOUDY_WEATHER )
139 if ( m_choosenWeather != m_lastWeather )
140 m_sameWeatherCnt = 0;
142 m_clearWeatherChance = CLEAR_WEATHER_CHANCE;
143 m_badWeatherChance = BAD_WEATHER_CHANCE;
147 if ( m_choosenWeather == CLEAR_WEATHER )
149 m_lastWeather = CLEAR_WEATHER;
151 phmnValue =
Math.RandomFloatInclusive( 0.0, 0.3 );
152 phmnTime =
Math.RandomIntInclusive( OVERCAST_MIN_TIME, OVERCAST_MAX_TIME );
153 phmnLength =
Math.RandomIntInclusive( OVERCAST_MIN_TIME, OVERCAST_MAX_TIME );
156 if ( m_choosenWeather == CLOUDY_WEATHER )
158 m_lastWeather = CLOUDY_WEATHER;
160 phmnValue =
Math.RandomFloatInclusive( 0.3, 0.7 );
161 phmnTime =
Math.RandomIntInclusive( OVERCAST_MIN_TIME, OVERCAST_MAX_TIME );
162 phmnLength =
Math.RandomIntInclusive( 0, OVERCAST_MIN_TIME );
165 if ( m_choosenWeather == BAD_WEATHER )
167 m_lastWeather = BAD_WEATHER;
169 phmnValue =
Math.RandomFloatInclusive( 0.7, 1.0 );
170 phmnTime =
Math.RandomIntInclusive( OVERCAST_MIN_TIME, OVERCAST_MAX_TIME );
171 phmnLength =
Math.RandomIntInclusive( 0, OVERCAST_MIN_TIME );
174 m_Weather.GetOvercast().Set( phmnValue, phmnTime, phmnLength );
176 Debug.WeatherLog(
string.Format(
"Enoch::Weather::Overcast:: (%1) overcast: %2",
g_Game.GetDayTime(), actual));
177 Debug.WeatherLog(
string.Format(
"Enoch::Weather::Overcast::Rain:: (%1) %2",
g_Game.GetDayTime(), m_Weather.GetRain().GetActual()));
183 float actualOvercast = m_Weather.GetOvercast().GetActual();
185 m_chance =
Math.RandomIntInclusive( 0, 100 );
190 if ( actualOvercast <= RAIN_THRESHOLD )
192 m_Weather.GetRain().Set( 0.0, RAIN_TIME_MIN, RAIN_TIME_MAX );
193 Debug.WeatherLog (
string.Format(
"Enoch::Weather::Rain::ForceEnd:: (%1) %2 -> 0",
g_Game.GetDayTime(), actual));
197 if ( actualOvercast > STORM_THRESHOLD )
199 phmnValue =
Math.RandomFloatInclusive( 0.8, 1.0 );
200 phmnTime =
Math.RandomInt( RAIN_TIME_MIN, RAIN_TIME_MAX );
203 m_Weather.GetRain().Set( phmnValue, phmnTime, phmnLength );
204 Debug.WeatherLog(
string.Format(
"Enoch::Weather::Rain::ForceStorm:: (%1) %2 -> %3",
g_Game.GetDayTime(), actual, phmnValue));
209 if ( actualOvercast < 0.75 )
213 phmnValue =
Math.RandomFloatInclusive( 0.1, 0.3 );
214 phmnTime =
Math.RandomInt( RAIN_TIME_MIN, RAIN_TIME_MAX );
217 else if ( m_chance < 60 )
219 phmnValue =
Math.RandomFloatInclusive( 0.2, 0.4 );
220 phmnTime =
Math.RandomInt( RAIN_TIME_MIN, RAIN_TIME_MAX );
223 else if ( m_chance < 85 )
225 phmnValue =
Math.RandomFloatInclusive( 0.0, 0.2 );
226 phmnTime =
Math.RandomInt( RAIN_TIME_MIN, RAIN_TIME_MAX );
232 phmnTime =
Math.RandomInt( RAIN_TIME_MIN, RAIN_TIME_MAX );
236 else if ( actualOvercast < STORM_THRESHOLD )
240 phmnValue =
Math.RandomFloatInclusive( 0.4, 0.6 );
241 phmnTime =
Math.RandomInt( RAIN_TIME_MIN, RAIN_TIME_MAX );
244 else if ( m_chance < 50 )
246 phmnValue =
Math.RandomFloatInclusive( 0.2, 0.4 );
247 phmnTime =
Math.RandomInt( RAIN_TIME_MIN, RAIN_TIME_MAX );
250 else if ( m_chance < 90 )
252 phmnValue =
Math.RandomFloatInclusive( 0.6, 0.8 );
253 phmnTime =
Math.RandomInt( RAIN_TIME_MIN, RAIN_TIME_MAX );
259 phmnTime =
Math.RandomInt( RAIN_TIME_MIN, RAIN_TIME_MAX );
267 phmnValue =
Math.RandomFloatInclusive( 0.9, 1.0 );
268 phmnTime =
Math.RandomInt( RAIN_TIME_MIN, RAIN_TIME_MAX );
273 phmnValue =
Math.RandomFloatInclusive( 0.8, 0.9 );
274 phmnTime =
Math.RandomInt( RAIN_TIME_MIN, RAIN_TIME_MAX );
279 m_Weather.GetRain().Set( phmnValue, phmnTime, phmnLength );
281 Debug.WeatherLog(
string.Format(
"Enoch::Weather::Rain:: (%1) %2",
g_Game.GetDayTime(), actual));
286 int year, month, day, hour, minute;
287 GetGame().GetWorld().GetDate(year, month, day, hour, minute);
288 if (( hour >= 1 ) && ( hour <= 5 ))
290 m_Weather.GetFog().Set( 0.1, 1800, 0 );
292 m_Weather.GetFog().Set( 0.0, 1800, 0 );
295 Debug.WeatherLog(
string.Format(
"Enoch::Weather::Fog:: (%1) %2",
g_Game.GetDayTime(), actual));