Diferenças entre edições de "Modificações:Dados climáticos"

Fonte: Stardew Valley Wiki
Saltar para a navegação Saltar para a pesquisa
(new page)
 
Linha 1: Linha 1:
 
← [[Modificações:Índice|Índice]]
 
← [[Modificações:Índice|Índice]]
 
{{Traduzir}}
 
{{Traduzir}}
This page documents how the game generates [[clima]] in the game.
+
Esta página documenta como é gerado o [[clima]] dentro do jogo.
  
==Data==
+
==Dados==
The weather is controlled by the integer field <tt>Game1::weatherForTomorrow</tt>. The possible values are:
+
O clima é controlado integralmente pelo campo <tt>Game1::weatherForTomorrow</tt>. Os possível valores são:
  
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
! value
+
! valor
! constant
+
! constante
! weather
+
! clima
 
|-
 
|-
 
| 0
 
| 0
 
| <tt>weather_sunny</tt>
 
| <tt>weather_sunny</tt>
| sunny
+
| Ensolarado
 
|-
 
|-
 
| 1
 
| 1
 
| <tt>weather_rain</tt>
 
| <tt>weather_rain</tt>
| rain
+
| Chovendo
 
|-
 
|-
 
| 2
 
| 2
 
| <tt>weather_debris</tt>
 
| <tt>weather_debris</tt>
| windy
+
| Ventando
 
|-
 
|-
 
| 3
 
| 3
 
| <tt>weather_lightning</tt>
 
| <tt>weather_lightning</tt>
| lightning
+
| Tempestade
 
|-
 
|-
 
| 4
 
| 4
 
| <tt>weather_festival</tt>
 
| <tt>weather_festival</tt>
| festival
+
| Festival
 
|-
 
|-
 
| 5
 
| 5
 
| <tt>weather_snow</tt>
 
| <tt>weather_snow</tt>
| snow
+
| Neve
 
|-
 
|-
 
| 6
 
| 6
 
| <tt>weather_wedding</tt>
 
| <tt>weather_wedding</tt>
| wedding
+
| Casamento
 
|}
 
|}
  
==Algorithm==
+
==Algoritmo==
===Forced weather===
+
===Clima fixo===
Certain dates always have the same weather:
+
Certas dadas possuem sempre o mesmo clima:
  
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
! date
+
! data
! weather
+
! clima
! overridden by
+
! sobrescrito por
 
|-
 
|-
| spring 1
+
| primavera 1
 
| <tt>weather_sunny</tt>
 
| <tt>weather_sunny</tt>
| <tt>newday</tt> and <tt>tv</tt>
+
| <tt>newday</tt> e <tt>tv</tt>
 
|-
 
|-
| spring 2 (year 1)
+
| primevera 2 (ano 1)
 
| <tt>weather_sunny</tt>
 
| <tt>weather_sunny</tt>
 
| <tt>newday</tt>
 
| <tt>newday</tt>
 
|-
 
|-
| spring 3 (year 1)
+
| primavera 3 (ano 1)
 
| <tt>weather_rain</tt>
 
| <tt>weather_rain</tt>
 
| <tt>newday</tt>
 
| <tt>newday</tt>
 
|-
 
|-
| spring 4 (year 1)
+
| primavera 4 (ano 1)
 
| <tt>weather_sunny</tt>
 
| <tt>weather_sunny</tt>
 
| <tt>newday</tt>
 
| <tt>newday</tt>
 
|-
 
|-
| spring 13
+
| primavera 13
 
| <tt>weather_festival</tt>
 
| <tt>weather_festival</tt>
 
| <tt>newday</tt>
 
| <tt>newday</tt>
 
|-
 
|-
| spring 24
+
| primavera 24
 
| <tt>weather_festival</tt>
 
| <tt>weather_festival</tt>
 
| <tt>newday</tt>
 
| <tt>newday</tt>
 
|-
 
|-
| summer 1
+
| verão 1
 
| <tt>weather_sunny</tt>
 
| <tt>weather_sunny</tt>
 
| <tt>newday</tt> and <tt>tv</tt>
 
| <tt>newday</tt> and <tt>tv</tt>
 
|-
 
|-
| summer 11
+
| verão 11
 
| <tt>weather_festival</tt>
 
| <tt>weather_festival</tt>
 
| <tt>newday</tt>
 
| <tt>newday</tt>
 
|-
 
|-
| summer 13
+
| verão 13
 
| <tt>weather_lightning</tt>
 
| <tt>weather_lightning</tt>
 
| <tt>newday</tt>
 
| <tt>newday</tt>
 
|-
 
|-
| summer 26
+
| verão 26
 
| <tt>weather_lightning</tt>
 
| <tt>weather_lightning</tt>
 
| <tt>newday</tt>
 
| <tt>newday</tt>
 
|-
 
|-
| summer 28
+
| verão 28
 
| <tt>weather_festival</tt>
 
| <tt>weather_festival</tt>
 
| <tt>newday</tt>
 
| <tt>newday</tt>
 
|-
 
|-
| fall 1
+
| outono 1
 
| <tt>weather_sunny</tt>
 
| <tt>weather_sunny</tt>
 
| <tt>newday</tt> and <tt>tv</tt>
 
| <tt>newday</tt> and <tt>tv</tt>
 
|-
 
|-
| fall 16
+
| outono 16
 
| <tt>weather_festival</tt>
 
| <tt>weather_festival</tt>
 
| <tt>newday</tt>
 
| <tt>newday</tt>
 
|-
 
|-
| fall 27
+
| outono 27
 
| <tt>weather_festival</tt>
 
| <tt>weather_festival</tt>
 
| <tt>newday</tt>
 
| <tt>newday</tt>
 
|-
 
|-
| winter 1
+
| inverno 1
 
| <tt>weather_sunny</tt>
 
| <tt>weather_sunny</tt>
 
| <tt>newday</tt> and <tt>tv</tt>
 
| <tt>newday</tt> and <tt>tv</tt>
 
|-
 
|-
| winter 8
+
| inverno 8
 
| <tt>weather_festival</tt>
 
| <tt>weather_festival</tt>
 
| <tt>newday</tt>
 
| <tt>newday</tt>
 
|-
 
|-
| winter 14
+
| inverno 14
 
| <tt>weather_sunny</tt>
 
| <tt>weather_sunny</tt>
 
| <tt>newday</tt>
 
| <tt>newday</tt>
 
|-
 
|-
| winter 15
+
| inverno 15
 
| <tt>weather_sunny</tt>
 
| <tt>weather_sunny</tt>
 
| <tt>newday</tt>
 
| <tt>newday</tt>
 
|-
 
|-
| winter 16
+
| inverno 16
 
| <tt>weather_sunny</tt>
 
| <tt>weather_sunny</tt>
 
| <tt>newday</tt>
 
| <tt>newday</tt>
 
|-
 
|-
| winter 25
+
| inverno 25
 
| <tt>weather_festival</tt>
 
| <tt>weather_festival</tt>
 
| <tt>newday</tt>
 
| <tt>newday</tt>
 
|}
 
|}
  
===Generated weather===
+
===Geração do clima===
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).
+
O clima em Stardew Valley é definido dentro da função <tt>Game1::newDayAfterFade()</tt> (após o código de mudança de dia, mas antes do evento do SMAPI <tt>SaveEvents.BeforeSave</tt>).
  
The game follows these steps to decide which weather and debris to set for the next day:
+
O jogo segue estes passos para decidir que clima e detritos serão definidos para o dia seguinte:
  
# Check for [[#Forced weather|forced weather]].
+
# Verifique o [[#Forced weather|clima fixo]].
# If today is a festival, set the weather to <tt>weather_festival</tt>.
+
# Se hoje é um festival, define o clima como <tt>weather_festival</tt>.
# If today is a wedding, set the weather to <tt>weather_wedding</tt>.
+
# Se hoje é um casamento, define o clima como <tt>weather_wedding</tt>.
# Set <tt>Game1::wasRainingYesterday</tt> based on whether it was raining or storming.
+
# Define <tt>Game1::wasRainingYesterday</tt> com base em se havia chuva ou tempestade.
# Reset all weather flags, and sets them in the following pattern
+
# Redefine todos os sinalizadores de tempo e os coloca no seguinte padrão
## If it is going to rain or storm, set the rain flag to true
+
## Se vai haver chuva ou tempestade, ajusta o sinal de chuva para true
## If it is going to storm, set the storm flag to true
+
## Se vai haver uma tempestade, ajusta o sinal de tempestade para true
## If the weather is (sunny, debris) or (festival || snowy || wedding), clear all the flags
+
## Se o tempo é (ensolarado, detritos) ou (festival, nevando, casamento), limpa todos os sinalizadores
## and then if it's snowy, set snowy to true
+
## Se estiver negando, define nevando para true
## It then sets the song based on this
+
## Em seguida, define a música com base nisto
## Clear the debris weather array and clear the flag
+
## Limpa a matriz meteorológica de detritos e os sinalizadores
 
## if bloom isn't null, clear it's visibility
 
## if bloom isn't null, clear it's visibility
 
## If the wedding is debris, populate the debris array.
 
## If the wedding is debris, populate the debris array.

Revisão das 08h36min de 28 de janeiro de 2019

Índice

Robin building.png
“Ainda tenho muito trabalho a fazer”
— Robin

Tradução incompleta

Este artigo ou seção não foi completamente traduzido para o português. Você está convidado a ajudar na sua construção editando-o
Última edição por Werister em 2019-01-28 08:36:48.

Esta página documenta como é gerado o clima dentro do jogo.

Dados

O clima é controlado integralmente pelo campo Game1::weatherForTomorrow. Os possível valores são:

valor constante clima
0 weather_sunny Ensolarado
1 weather_rain Chovendo
2 weather_debris Ventando
3 weather_lightning Tempestade
4 weather_festival Festival
5 weather_snow Neve
6 weather_wedding Casamento

Algoritmo

Clima fixo

Certas dadas possuem sempre o mesmo clima:

data clima sobrescrito por
primavera 1 weather_sunny newday e tv
primevera 2 (ano 1) weather_sunny newday
primavera 3 (ano 1) weather_rain newday
primavera 4 (ano 1) weather_sunny newday
primavera 13 weather_festival newday
primavera 24 weather_festival newday
verão 1 weather_sunny newday and tv
verão 11 weather_festival newday
verão 13 weather_lightning newday
verão 26 weather_lightning newday
verão 28 weather_festival newday
outono 1 weather_sunny newday and tv
outono 16 weather_festival newday
outono 27 weather_festival newday
inverno 1 weather_sunny newday and tv
inverno 8 weather_festival newday
inverno 14 weather_sunny newday
inverno 15 weather_sunny newday
inverno 16 weather_sunny newday
inverno 25 weather_festival newday

Geração do clima

O clima em Stardew Valley é definido dentro da função Game1::newDayAfterFade() (após o código de mudança de dia, mas antes do evento do SMAPI SaveEvents.BeforeSave).

O jogo segue estes passos para decidir que clima e detritos serão definidos para o dia seguinte:

  1. Verifique o clima fixo.
  2. Se hoje é um festival, define o clima como weather_festival.
  3. Se hoje é um casamento, define o clima como weather_wedding.
  4. Define Game1::wasRainingYesterday com base em se havia chuva ou tempestade.
  5. Redefine todos os sinalizadores de tempo e os coloca no seguinte padrão
    1. Se vai haver chuva ou tempestade, ajusta o sinal de chuva para true
    2. Se vai haver uma tempestade, ajusta o sinal de tempestade para true
    3. Se o tempo é (ensolarado, detritos) ou (festival, nevando, casamento), limpa todos os sinalizadores
    4. Se estiver negando, define nevando para true
    5. Em seguida, define a música com base nisto
    6. Limpa a matriz meteorológica de detritos e os sinalizadores
    7. if bloom isn't null, clear it's visibility
    8. If the wedding is debris, populate the debris array.
  6. If it's not raining, and the chance to rain tomorrow is less than .1, it will try to create a bloom day.
  7. It then calculates the rain chance for tomorrow. It follows the following algorithm
    1. Check to see if it's summer.
      1. If not, check to see if it's winter.
        1. If it's not, the rain chance is .183
        2. Else, it's .63
      2. If it is, it uses the following: Check if it's day 1.
        1. If it's not, the chance is .12 + Game1::dayOfMonth * 3/1000
        2. If it is, the chance is 0. Which.. is kinda redundant, as the force days take care of this.
  8. Check to see if a random number is less than the odds. If it is, it follows the following algorithm
    1. Set Game1::weatherForTomorrow to weather_rain
    2. If:
      1. It's summer, and if a random number is less than .85
      2. 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
      3. Set Game1::weatherForTomorrow to weather_lightning
    3. If it is winter
      1. Set Game1::weatherForTomorrow to weather_snow
  9. Else, if it's over the rain odds.
    1. If you've played less than 3 days.
    2. Or: if
      1. It's not spring or a random number is greater than or equal to .2 (so 80%) and spring.
      2. And it's not fall or a random number is greater than or equal to .6 (so 40%) and fall.
      3. Or: If there is a wedding today
        1. Set Game1::weatherForTomorrow to weather_sunny if true
        2. Set Game1::weatherForTomorrow to weather_debris if false
    3. Check if tomorrow is a festival, and set weather to weather_festival if true.
    4. Again force the 3rd day to be weather_rain

At this point, the main function is done setting weather.

TV Channel

The TV checks the weather, but will occasionally set it on certain days. 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.

The TV will check the weather and show the following message:

weather message
sunny or wedding 50% chance each:
  • "It's going to be clear and sunny all day."
  • "It's going to be a beautiful, sunny day tommorow!"
rain "It's going to rain all day tomorrow"
debris Per conditions:
  1. If spring: "Partially cloudy with a light breeze. Expect lots of pollen!"
  2. If not fall: "It's going to snow all day. Make sure you bundle up, folks!" and defaults with: "It's going to be cloudy, with gusts of wind throught the day."
  3. If storm: "Looks like a storm is approaching. Thunder and lightning is expected."
  4. If festival, it attempts to read the festival data. If it fails, it will say "Um... that's odd. My information sheet just says 'null'. This is embarrassing..." If it succeeds, it will read out where it is and when it is.
  5. If snow, a 50% chance of one of two strings: "Expect a few inches of snow tomorrow" or "Bundle up, folks. It's going to snow tomorrow!"
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:

  1. If snowing: 7.
  2. If sunny: 2.
  3. If wedding: 0.
  4. If festival: 1.
  5. If raining: 4.
  6. If stormy: 5.
  7. If spring: debris weather is 3.
  8. If summer: unset (defaults to sunny).
  9. If fall: 6.
  10. If winter: 7 (same as snowing).

Rain Totem

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 86% on summer 1 to 79.9% on summer 28. The precise chance is 1 - [13% + (.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 14% on summer 2 to 21.1% on Summer 27. There's an 85% chance that rain becomes storms. So you have a scale of [13% + (.3 * day of the month)] * .85 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

Debris weather covers weather variable 2.

  • Spring: there's a 20% chance of this after rain, so approximately 16.6% chance of debris weather.
  • Summer: no debris weather.
  • Fall: there's a 60% chance for this after rain, so approximately 49.8% chance of debris weather.
  • Winter: no debris weather.

Stormy

Stormy weather covers weather variable 3.

  • Spring: 4.57% chance of storms.
  • Summer: variable chance of storms; starts at 11.9% and increases to 17.9%.
  • Fall: 4.57% chance of storms.
  • Winter: no stormy weather.

Snowy

In winter, there's a 63% chance of snow. No other season has snow.

Save files

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

Note: 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.

Notes/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.