Модификации:Погодные явления
← Индекс
![]() |
Неполный перевод Эта статья или её часть до сих пор не переведены на русский язык.
Вы можете оказать помощь в переводе путем ее редактирования. |
Данная страница документирует генерацию внутриигровой погоды.
Данные
Погода управляется целым числом Game1::weatherForTomorrow. Возможные значения погоды:
Значение | Константа | Погода |
---|---|---|
0 | weather_sunny | Солнечно |
1 | weather_rain | Дождь |
2 | weather_debris | Ветер |
3 | weather_lightning | Гроза |
4 | weather_festival | Фестиваль |
5 | weather_snow | Снегопад |
6 | weather_wedding | Свадьба |
Алгоритм
Фиксированная погода
На определённые даты погода уже предопределена:
дата | погода | переопределено |
---|---|---|
весна 1 | weather_sunny | newday and tv |
весна 2 (год 1) | weather_sunny | newday |
весна 3 (год 1) | weather_rain | newday |
весна 4 (год 1) | weather_sunny | newday |
весна 13 | weather_festival | newday |
весна 24 | weather_festival | newday |
лето 1 | weather_sunny | newday and tv |
лето 11 | weather_festival | newday |
лето 13 | weather_lightning | newday |
лето 26 | weather_lightning | newday |
лето 28 | weather_festival | newday |
осень 1 | weather_sunny | newday and tv |
осень 16 | weather_festival | newday |
осень 27 | weather_festival | newday |
зима 1 | weather_sunny | newday and tv |
зима 8 | weather_festival | newday |
зима 14 | weather_sunny | newday |
зима 15 | weather_sunny | newday |
зима 16 | weather_sunny | newday |
зима 25 | weather_festival | newday |
Генерируемая погода
Weather in Stardew Valley is set within the Game1::newDayAfterFade() function (after the day change code, but before SMAPI's SaveEvents.BeforeSave event).
The game follows these steps to decide which weather and debris to set for the next day:
- Check for forced weather.
- If today is a festival, set the weather to weather_festival.
- If today is a wedding, set the weather to weather_wedding.
- Set Game1::wasRainingYesterday based on whether it was raining or storming.
- Reset all weather flags, and sets them in the following pattern
- If it is going to rain or storm, set the rain flag to true
- If it is going to storm, set the storm flag to true
- If the weather is (sunny, debris) or (festival || snowy || wedding), clear all the flags
- and then if it's snowy, set snowy to true
- It then sets the song based on this
- Clear the debris weather array and clear the flag
- if bloom isn't null, clear it's visibility
- If the wedding is debris, populate the debris array.
- If it's not raining, and the chance to rain tomorrow is less than .1, it will try to create a bloom day.
- It then calculates the rain chance for tomorrow. It follows the following algorithm
- Check to see if it's summer.
- If not, check to see if it's winter.
- If it's not, the rain chance is .183
- Else, it's .63
- If it is, it uses the following: Check if it's day 1.
- If it's not, the chance is .12 + Game1::dayOfMonth * 3/1000
- If it is, the chance is 0. Which.. is kinda redundant, as the force days take care of this.
- If not, check to see if it's winter.
- Check to see if it's summer.
- Check to see if a random number is less than the odds. If it is, it follows the following algorithm
- Set Game1::weatherForTomorrow to weather_rain
- If:
- It's summer, and if a random number is less than .85
- Or If it's not winter, and if a random number is less than .25 AND the day of the month is more than 2 and more than 27 days have been played
- Set Game1::weatherForTomorrow to weather_lightning
- If it is winter
- Set Game1::weatherForTomorrow to weather_snow
- Else, if it's over the rain odds.
- If you've played less than 3 days.
- Or: if
- It's not spring or a random number is greater than or equal to .2 (so 80%) and spring.
- And it's not fall or a random number is greater than or equal to .6 (so 40%) and fall.
- Or: If there is a wedding today
- Set Game1::weatherForTomorrow to weather_sunny if true
- Set Game1::weatherForTomorrow to weather_debris if false
- Check if tomorrow is a festival, and set weather to weather_festival if true.
- Again force the 3rd day to be weather_rain
At this point, the main function is done setting weather.
Телевидение
Телевизор проверяет погоду, но иногда устанавливает ее в определенные дни. It follows the following chart:
The TV force sets by:
date | weather |
---|---|
spring 1 | weather_sunny¹ |
spring 3 | weather_rainy¹ |
summer 1 | weather_sunny¹ |
fall 1 | weather_sunny¹ |
winter 1 | weather_sunny¹ |
¹ Also set (and thus overridden) by the Game1::newDayAfterFade() method.
Телевизор проверит погоду и покажет соответствующее описание:
погода | описание |
---|---|
солнечно или день свадьбы | 50% chance each:
|
дождь | "Завтра весь день будет идти дождь." |
ветер | В соответствии:
|
any other | Returns an empty string (should never happen). |
Note: the TV will not necessarily be accurate for any other day than non festival days, the first of the month and the 3rd of spring, which are force-set by the Game1::newDayAfterFade method. Farmhands (and not host players) may not even get that accuracy for the first of the month and 3rd of spring.
Note 2: The Night Market is not considered a festival for the purposes of weather.
Weather Icon
The weather icon is set in Game1::updateWeatherIcon, which sets an index in LooseSprite/Cursors.xnb:
- If snowing: 7.
- If sunny: 2.
- If wedding: 0.
- If festival: 1.
- If raining: 4.
- If stormy: 5.
- If spring: debris weather is 3.
- If summer: unset (defaults to sunny).
- If fall: 6.
- If winter: 7 (same as snowing).
Тотем дождя
The rain totem (item #681) and is controlled by Object::rainTotem, which is invoked by Object::performUseAction. If tomorrow is a festival day, the item is used up but nothing happens. Otherwise, it uses up the item and sets the weather for tomorrow to weather_rain and displays the message.
Weather probability by type
This section explains the probability of each weather type. This only applies on dates with no forced weather.
Sunny
Sunny weather covers weather variables 0, 4, and 6.
- Spring: there's an 18.3% base chance of rain (81.7% chance remaining for other weathers). If it doesn't rain, there's an 80% chance to remain sunny (except on spring 3, which will always be rainy). That means that in spring there's a 66.4% chance of sunny weather.
- Summer: The chance of sunny weather diminishes steadily per day from 87.4% on summer 1 to 79.9% on summer 28. The precise chance is 1 - [12% + (0.3% * day of the month)] per day, with a 0% chance on day 1.
- Fall: identical to spring, but no forced weather.
- Winter: there's a 63% chance of precipitation, so only a 37% chance of sunny weather.
Rainy
- Spring: there's an 18.3% base chance of rain. If it rains, there's a 25% chance of storms except in year 1. So the rain odds in Spring is a flat 18.3% in year 1, and 13.725% in year 2 or later. It will always rain on spring 3 (year 1).
- Summer: the chance of rainy weather increases steadily per day from 12.6% on summer 2 to 20.1% on Summer 27. There's an 85% chance that rain becomes storms. So you have a scale of [12% + (0.3% * day of the month)] * .15 to determine your chances of rainfall.
- Fall: same as spring, except fall in year 1 can be stormy so it's a flat 13.725% chance.
- Winter: never rains.
Ветер
Debris weather covers weather variable 2.
- Весна: после дождя шанс 20%, поэтому приблизительный шанс 16.6%.
- Лето: не бывает ветра.
- Осень: после дождя шанс 60%, поэтому приблизительный шанс 49.8%.
- Зима: не бывает ветра.
Гроза
Stormy weather covers weather variable 3.
- Весна: 4.57% шанс грозы.
- Лето: переменный шанс грозы; начиная от 10.71% и до 17.085%.
- Осень: 4.57% шанс грозы.
- Зима: не бывает грозы.
Снегопад
Зимой шанс выпадения снега 63%. Снегопад может пойти только зимой.
Сохранения
The save file is a snapshot of the day at 0600 the next morning. The WeatherForTommorow field was used to calculate the weather, but changing it has no effect on the weather since the weather flags have already been set by this point. To change the weather, you need to set one of these combinations of flags:
weather | isRaining | isDebrisWeather | isLightning | isSnowing |
---|---|---|---|---|
sunny | ☐ | ☐ | ☐ | ☐ |
rainy | ☑ | ☐ | ☐ | ☐ |
stormy | ☑ | ☐ | ☑ | ☐ |
debris | ☐ | ☑ | ☐ | ☐ |
snowy | ☐ | ☐ | ☐ | ☑ |
festival | ☐ | ☐ | ☐ | ☐ |
wedding | ☐ | ☐ | ☐ | ☐ |
Примечание: changing isDebrisWeather during an active game will not create the array. You'll need to call Game1::populateDebrisWeatherArray to get the debris populated. Correspondingly, if you're removing the debris weather flag, remember to call Game1::debrisWeather::Clear.
Примечания/FAQ
- The TV can be fixed by overriding it - or just by using Entoroax's Framework.
- You can set snow and debris at any time, the game just won't.
- You cannot set debris and rain at the same time.