Изменения

м
Замена текста — «tt>» на «samp>»
Строка 5: Строка 5:     
==Данные==
 
==Данные==
The weather is controlled by the integer field <tt>Game1::weatherForTomorrow</tt>. The possible values are:
+
The weather is controlled by the integer field <samp>Game1::weatherForTomorrow</samp>. The possible values are:
    
{|class="wikitable"
 
{|class="wikitable"
Строка 14: Строка 14:  
|-
 
|-
 
| 0
 
| 0
| <tt>weather_sunny</tt>
+
| <samp>weather_sunny</samp>
 
| sunny
 
| sunny
 
|-
 
|-
 
| 1
 
| 1
| <tt>weather_rain</tt>
+
| <samp>weather_rain</samp>
 
| rain
 
| rain
 
|-
 
|-
 
| 2
 
| 2
| <tt>weather_debris</tt>
+
| <samp>weather_debris</samp>
 
| windy
 
| windy
 
|-
 
|-
 
| 3
 
| 3
| <tt>weather_lightning</tt>
+
| <samp>weather_lightning</samp>
 
| lightning
 
| lightning
 
|-
 
|-
 
| 4
 
| 4
| <tt>weather_festival</tt>
+
| <samp>weather_festival</samp>
 
| festival
 
| festival
 
|-
 
|-
 
| 5
 
| 5
| <tt>weather_snow</tt>
+
| <samp>weather_snow</samp>
 
| snow
 
| snow
 
|-
 
|-
 
| 6
 
| 6
| <tt>weather_wedding</tt>
+
| <samp>weather_wedding</samp>
 
| wedding
 
| wedding
 
|}
 
|}
Строка 53: Строка 53:  
|-
 
|-
 
| spring 1
 
| spring 1
| <tt>weather_sunny</tt>
+
| <samp>weather_sunny</samp>
| <tt>newday</tt> and <tt>tv</tt>
+
| <samp>newday</samp> and <samp>tv</samp>
 
|-
 
|-
 
| spring 2 (year 1)
 
| spring 2 (year 1)
| <tt>weather_sunny</tt>
+
| <samp>weather_sunny</samp>
| <tt>newday</tt>
+
| <samp>newday</samp>
 
|-
 
|-
 
| spring 3 (year 1)
 
| spring 3 (year 1)
| <tt>weather_rain</tt>
+
| <samp>weather_rain</samp>
| <tt>newday</tt>
+
| <samp>newday</samp>
 
|-
 
|-
 
| spring 4 (year 1)
 
| spring 4 (year 1)
| <tt>weather_sunny</tt>
+
| <samp>weather_sunny</samp>
| <tt>newday</tt>
+
| <samp>newday</samp>
 
|-
 
|-
 
| spring 13
 
| spring 13
| <tt>weather_festival</tt>
+
| <samp>weather_festival</samp>
| <tt>newday</tt>
+
| <samp>newday</samp>
 
|-
 
|-
 
| spring 24
 
| spring 24
| <tt>weather_festival</tt>
+
| <samp>weather_festival</samp>
| <tt>newday</tt>
+
| <samp>newday</samp>
 
|-
 
|-
 
| summer 1
 
| summer 1
| <tt>weather_sunny</tt>
+
| <samp>weather_sunny</samp>
| <tt>newday</tt> and <tt>tv</tt>
+
| <samp>newday</samp> and <samp>tv</samp>
 
|-
 
|-
 
| summer 11
 
| summer 11
| <tt>weather_festival</tt>
+
| <samp>weather_festival</samp>
| <tt>newday</tt>
+
| <samp>newday</samp>
 
|-
 
|-
 
| summer 13
 
| summer 13
| <tt>weather_lightning</tt>
+
| <samp>weather_lightning</samp>
| <tt>newday</tt>
+
| <samp>newday</samp>
 
|-
 
|-
 
| summer 26
 
| summer 26
| <tt>weather_lightning</tt>
+
| <samp>weather_lightning</samp>
| <tt>newday</tt>
+
| <samp>newday</samp>
 
|-
 
|-
 
| summer 28
 
| summer 28
| <tt>weather_festival</tt>
+
| <samp>weather_festival</samp>
| <tt>newday</tt>
+
| <samp>newday</samp>
 
|-
 
|-
 
| fall 1
 
| fall 1
| <tt>weather_sunny</tt>
+
| <samp>weather_sunny</samp>
| <tt>newday</tt> and <tt>tv</tt>
+
| <samp>newday</samp> and <samp>tv</samp>
 
|-
 
|-
 
| fall 16
 
| fall 16
| <tt>weather_festival</tt>
+
| <samp>weather_festival</samp>
| <tt>newday</tt>
+
| <samp>newday</samp>
 
|-
 
|-
 
| fall 27
 
| fall 27
| <tt>weather_festival</tt>
+
| <samp>weather_festival</samp>
| <tt>newday</tt>
+
| <samp>newday</samp>
 
|-
 
|-
 
| winter 1
 
| winter 1
| <tt>weather_sunny</tt>
+
| <samp>weather_sunny</samp>
| <tt>newday</tt> and <tt>tv</tt>
+
| <samp>newday</samp> and <samp>tv</samp>
 
|-
 
|-
 
| winter 8
 
| winter 8
| <tt>weather_festival</tt>
+
| <samp>weather_festival</samp>
| <tt>newday</tt>
+
| <samp>newday</samp>
 
|-
 
|-
 
| winter 14
 
| winter 14
| <tt>weather_sunny</tt>
+
| <samp>weather_sunny</samp>
| <tt>newday</tt>
+
| <samp>newday</samp>
 
|-
 
|-
 
| winter 15
 
| winter 15
| <tt>weather_sunny</tt>
+
| <samp>weather_sunny</samp>
| <tt>newday</tt>
+
| <samp>newday</samp>
 
|-
 
|-
 
| winter 16
 
| winter 16
| <tt>weather_sunny</tt>
+
| <samp>weather_sunny</samp>
| <tt>newday</tt>
+
| <samp>newday</samp>
 
|-
 
|-
 
| winter 25
 
| winter 25
| <tt>weather_festival</tt>
+
| <samp>weather_festival</samp>
| <tt>newday</tt>
+
| <samp>newday</samp>
 
|}
 
|}
    
===Generated weather===
 
===Generated weather===
Weather in Stardew Valley is set within the <tt>Game1::newDayAfterFade()</tt> function (after the day change code, but before SMAPI's <tt>SaveEvents.BeforeSave</tt> event).
+
Weather in Stardew Valley is set within the <samp>Game1::newDayAfterFade()</samp> function (after the day change code, but before SMAPI's <samp>SaveEvents.BeforeSave</samp> event).
    
The game follows these steps to decide which weather and debris to set for the next day:
 
The game follows these steps to decide which weather and debris to set for the next day:
    
# Check for [[#Forced weather|forced weather]].
 
# Check for [[#Forced weather|forced weather]].
# If today is a festival, set the weather to <tt>weather_festival</tt>.
+
# If today is a festival, set the weather to <samp>weather_festival</samp>.
# If today is a wedding, set the weather to <tt>weather_wedding</tt>.
+
# If today is a wedding, set the weather to <samp>weather_wedding</samp>.
# Set <tt>Game1::wasRainingYesterday</tt> based on whether it was raining or storming.
+
# Set <samp>Game1::wasRainingYesterday</samp> based on whether it was raining or storming.
 
# Reset all weather flags, and sets them in the following pattern
 
# 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 rain or storm, set the rain flag to true
Строка 158: Строка 158:  
#### Else, it's .63  
 
#### Else, it's .63  
 
### If it is, it uses the following: Check if it's day 1.
 
### If it is, it uses the following: Check if it's day 1.
#### If it's not, the chance is .12 + <tt>Game1::dayOfMonth</tt> * 3/1000
+
#### If it's not, the chance is .12 + <samp>Game1::dayOfMonth</samp> * 3/1000
 
#### If it is, the chance is 0. Which.. is kinda redundant, as the force days take care of this.
 
#### If it is, the chance is 0. Which.. is kinda redundant, as the force days take care of this.
 
# Check to see if a random number is less than the odds. If it is, it follows the following algorithm
 
# Check to see if a random number is less than the odds. If it is, it follows the following algorithm
## Set <tt>Game1::weatherForTomorrow</tt> to <tt>weather_rain</tt>
+
## Set <samp>Game1::weatherForTomorrow</samp> to <samp>weather_rain</samp>
 
## If:
 
## If:
 
### It's summer, and if a random number is less than .85
 
### 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
 
### 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 <tt>Game1::weatherForTomorrow</tt> to <tt>weather_lightning</tt>
+
### Set <samp>Game1::weatherForTomorrow</samp> to <samp>weather_lightning</samp>
 
## If it is winter
 
## If it is winter
### Set <tt>Game1::weatherForTomorrow</tt> to <tt>weather_snow</tt>
+
### Set <samp>Game1::weatherForTomorrow</samp> to <samp>weather_snow</samp>
 
# Else, if it's over the rain odds.
 
# Else, if it's over the rain odds.
 
## If you've played less than 3 days.  
 
## If you've played less than 3 days.  
Строка 174: Строка 174:  
### And it's not fall or a random number is greater than or equal to .6 (so 40%) and fall.
 
### 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
 
### Or: If there is a wedding today
#### Set <tt>Game1::weatherForTomorrow</tt> to <tt>weather_sunny</tt> if true
+
#### Set <samp>Game1::weatherForTomorrow</samp> to <samp>weather_sunny</samp> if true
#### Set <tt>Game1::weatherForTomorrow</tt> to <tt>weather_debris</tt> if false
+
#### Set <samp>Game1::weatherForTomorrow</samp> to <samp>weather_debris</samp> if false
## Check if tomorrow is a festival, and set weather to <tt>weather_festival</tt> if true.
+
## Check if tomorrow is a festival, and set weather to <samp>weather_festival</samp> if true.
## Again force the 3rd day to be <tt>weather_rain</tt>
+
## Again force the 3rd day to be <samp>weather_rain</samp>
    
At this point, the main function is done setting weather.
 
At this point, the main function is done setting weather.
Строка 192: Строка 192:  
|-
 
|-
 
| spring 1
 
| spring 1
| <tt>weather_sunny</tt
+
| <samp>weather_sunny</samp
 
|-
 
|-
 
| spring 3
 
| spring 3
| <tt>weather_rainy</tt
+
| <samp>weather_rainy</samp
 
|-
 
|-
 
| summer 1
 
| summer 1
| <tt>weather_sunny</tt
+
| <samp>weather_sunny</samp
 
|-
 
|-
 
| fall 1
 
| fall 1
| <tt>weather_sunny</tt
+
| <samp>weather_sunny</samp
 
|-
 
|-
 
| winter 1
 
| winter 1
| <tt>weather_sunny</tt
+
| <samp>weather_sunny</samp
 
|}
 
|}
   −
<small>¹ Also set (and thus overridden) by the <tt>Game1::newDayAfterFade()</tt> method.</small><br />
+
<small>¹ Also set (and thus overridden) by the <samp>Game1::newDayAfterFade()</samp> method.</small><br />
    
The TV will check the weather and show the following message:
 
The TV will check the weather and show the following message:
Строка 236: Строка 236:  
|}
 
|}
   −
'''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 <tt>Game1::newDayAfterFade</tt> method. Farmhands (and not host players) may not even get that accuracy for the first of the month and 3rd of spring.
+
'''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 <samp>Game1::newDayAfterFade</samp> 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.
 
'''Note 2:''' The Night Market is not considered a festival for the purposes of weather.
    
===Weather Icon===
 
===Weather Icon===
The weather icon is set in <tt>Game1::updateWeatherIcon</tt>, which sets an index in <tt>LooseSprite/Cursors.xnb</tt>:
+
The weather icon is set in <samp>Game1::updateWeatherIcon</samp>, which sets an index in <samp>LooseSprite/Cursors.xnb</samp>:
    
# If snowing: 7.
 
# If snowing: 7.
Строка 255: Строка 255:     
===Rain Totem===
 
===Rain Totem===
The rain totem (item #681) and is controlled by <tt>Object::rainTotem</tt>, which is invoked by <tt>Object::performUseAction</tt>. 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 <tt>weather_rain</tt> and displays the message.
+
The rain totem (item #681) and is controlled by <samp>Object::rainTotem</samp>, which is invoked by <samp>Object::performUseAction</samp>. 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 <samp>weather_rain</samp> and displays the message.
    
==Weather probability by type==
 
==Weather probability by type==
Строка 294: Строка 294:     
==Save files==
 
==Save files==
The save file is a snapshot of the day at 0600 the next morning. The <tt>WeatherForTommorow</tt> 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:
+
The save file is a snapshot of the day at 0600 the next morning. The <samp>WeatherForTommorow</samp> 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:
    
{|class="wikitable"
 
{|class="wikitable"
 
|-
 
|-
 
! weather  
 
! weather  
! <tt>isRaining</tt>
+
! <samp>isRaining</samp>
! <tt>isDebrisWeather</tt>
+
! <samp>isDebrisWeather</samp>
! <tt>isLightning</tt>
+
! <samp>isLightning</samp>
! <tt>isSnowing</tt>
+
! <samp>isSnowing</samp>
 
|-
 
|-
 
| sunny
 
| sunny
Строка 347: Строка 347:  
|}
 
|}
   −
'''Примечание:''' changing <tt>isDebrisWeather</tt> during an active game will not create the array. You'll need to call <tt>Game1::populateDebrisWeatherArray</tt> to get the debris populated. Correspondingly, if you're removing the debris weather flag, remember to call <tt>Game1::debrisWeather::Clear</tt>.
+
'''Примечание:''' changing <samp>isDebrisWeather</samp> during an active game will not create the array. You'll need to call <samp>Game1::populateDebrisWeatherArray</samp> to get the debris populated. Correspondingly, if you're removing the debris weather flag, remember to call <samp>Game1::debrisWeather::Clear</samp>.
    
==Примечания/FAQ==
 
==Примечания/FAQ==