Chapter - Weather
[ This is very simple. Each afternoon there is a certain chance that there
will be a storm. This lasts the whole afternoon (but only the afternoon)
and is divided into three phases: gathering clouds, storm, dispersing clouds. ]
Weather status is a kind of value. The weather statuses are undecided, endgame-storm, endgame-dispersing, decided to rain, decided not to rain, gathering clouds, raining, and dispersing clouds. The weather state is a weather status that varies. The last weather state is a weather status that varies. The weather state is undecided. The last weather state is undecided.
Every turn when weather state is undecided and afternoon (this is the deciding on the weather rule):
if the heavens are being debugged, say "// The Heavens: deciding whether to rain (because weather state is undecided and afternoon).";
if a random chance of 1 in 2 succeeds, now the weather state is decided to rain;
otherwise now the weather state is decided not to rain;
if the heavens are being debugged, say "// The Heavens: decided [if weather state is decided not to rain]not [end if]to rain.".
Every turn when the weather state is not decided not to rain and the weather state is not undecided and yourself is awake (this is the rainstorm computations rule):
if the heavens are being debugged, say "// The Heavens: rainstorm computations rule.";
if it is after 3:30 PM and it is before 4:31 PM begin;
if weather state is not raining begin;
if the heavens are being debugged, say "// The Heavens: setting weather state to raining.";
now weather state is raining;
move rain clouds to Outdoors;
move lightning to Outdoors;
if the player is in Outdoors, say "With a crash of thunder, raindrops begin to fall. A moment later you are in a downpour.";
otherwise if the player is in Outdoors; add potential messages from the Table of Rainstorms, only one;
end if;
otherwise if it is after 2:30 PM and it is before 3:31 PM;
if weather state is not gathering clouds begin;
if the heavens are being debugged, say "// The Heavens: setting weather state to gathering clouds.";
now weather state is gathering clouds;
if the player is in Outdoors, say "The sky overhead is beginning to fill up with dark [o]clouds[x].";
move rain clouds to Outdoors;
otherwise if the player is in Outdoors; add potential messages from the Table of Gathering Clouds, only one;
end if;
otherwise if it is after 4:30 PM and it is before 5:31 PM;
if weather state is not dispersing clouds begin;
if the heavens are being debugged, say "// The Heavens: setting weather state to dispersing clouds.";
now weather state is dispersing clouds;
move rain clouds to Outdoors; move lightning to Outdoors;
if the player is in Outdoors, say "The rain peters out and the [o]clouds[x] begin to disperse.";
if a random chance of 1 in 3 succeeds, move rainbow to Outdoors;
otherwise if the player is in Outdoors; add potential messages from the Table of Dispersing Clouds, only one;
end if;
otherwise if it is after 5:30 PM;
if the heavens are being debugged, say "// The Heavens: cleaning up rainstorm aftermath & setting weather state to undecided.";
remove rain clouds from play;
remove lightning from play;
remove rainbow from play;
now weather state is undecided;
now last weather state is dispersing clouds;
end if.
Check listening when weather state is raining: say "The sound of rain falling all around you creates a torrential cacophany." instead.
Some rain clouds are a backdrop. Understand "dark/cloud/thunderheads/wind/storm" as rain clouds. The description is "[if weather state is gathering clouds]They are flying in rapidly from the east, black and ominous[end if][if weather state is raining]Buckets of warm rain pour down from the black thunderheads above[end if][if weather state is dispersing clouds]The clouds are quickly being carried off westward, revealing a reddish-orange evening sky[end if]." Check smelling rain clouds: say "[if raining or weather state is dispersing clouds]The smell of wet earth and clean rain is thick in the air[otherwise if weather state is gathering clouds]The expectant smell of approaching rain rides on the breeze[end if]." instead.
A rainbow is a backdrop. The description is "It arcs triumphantly over the ocean, scintillating wetly in the air as the sun shines past the retreating thunderheads to light it.".
The flash of lightning is a backdrop. The description is "Only a purple blotch over your vision, now."
Every turn when night (this is the finishing up the weather business rule):
if the heavens are being debugged, say "// The Heavens: ensuring weather state is undecided (because night).";
now weather state is undecided;
now last weather state is undecided.
To decide whether rained: if weather state is dispersing clouds or last weather state is dispersing clouds, decide yes; decide no. To decide whether cloudy: if weather state is gathering clouds or weather state is dispersing clouds, decide yes; decide no.
To decide whether didnt rain: if rained or raining, decide no; decide yes.
To decide whether raining: if the weather state is raining, decide yes; decide no. To decide whether not raining: if raining, decide no; decide yes.
Table of Gathering Clouds
freq | start time | end time | text | table | trigger | flag | |
frequent | an interval | an interval | "[one of]Heavy rain clouds[or]Dark thunderheads[or]Dark grey clouds[in random order] [one of]are gathering overhead[or]race in, blotting out the sun more and more each minute[or]scud quickly across the sky[or]drag cold shadows across the island, gusts of sweet-smelling wind trailing behind[or]continue to gather above[in random order]." |
Table of Rainstorms
freq | start time | end time | text | table | trigger | flag | |
frequent | an interval | an interval | "[one of]Lightning flashes and thunder rumbles as the storm continues[or]Wind and rain buffet you in waves as the storm rages on[or]Sheets of rain dance through the air[or]A sudden flash of lightning somewhere above you glints off the [surface-material], followed moments later by a resounding crack of thunder[or]The rainfall patters on every surface around you[or]The storm continues around you[or]Deep grey thunderheads race through the sky above you as the storm continues[or]Muffled flickers of lightning gutter in the clouds above you as the rain continues[in random order]." |
Table of Dispersing Clouds
freq | start time | end time | text | table | trigger | flag | |
frequent | an interval | an interval | "[if rainbow is on-stage][rainbowmsg][otherwise][one of]The rain clouds[or]The storm clouds[or]The clouds[or]The grey remnants of the storm[in random order] [one of]continue to slowly disperse[or]break up more and more each minute[or]are scattering, letting streaks of blue sky through[or]are dissolving in the late afternoon sunlight[in random order][end if]." |
To say rainbowmsg: say "A rainbow [one of]floats serenely above the water[or]shines brightly below the clouds[or]hovers gracefully out over the ocean[in random order], [one of]glimmering in the afternoon light[or]the spill of color making the tropical view even more magical[or]an unexpected coda to the rainfall[in random order]".
The heavens has an interval called saved time. The saved-weather-state is a weather status that varies.
After going from an outdoorsy room to an indoorsy room:
now the saved time of the heavens is current interval;
now the saved-weather-state is weather state;
continue the action.
[ To help keep players aware of the passage of time, we note it when the player steps outdoors after having been indoors for a while. ]
After going from an indoorsy room to an outdoorsy room:
if former location is Inside-Manta, continue the action; [ If we're leaving the manta, we have to describe that process first, so it doesn't make sense to print the below message.]
if current interval is not saved time of the heavens or ( afternoon and weather state is not saved-weather-state ) begin;
say "[one of]As you emerge, you see that[or]Stepping outside, you discover that[at random] [if dawn]the beginnings of daylight flush the sky[otherwise if sunrise or morning]the sun has come up, flooding your eyes with light[otherwise if midmorning]the morning sun has moved higher into the sky, chasing off the long dawn shadows[otherwise if midday]the sun is now high in the sky, beating down from near the zenith[otherwise if afternoon and raining]a rain storm has blown in, waves of wind and water descending on the island in buckets[otherwise if afternoon and weather state is decided not to rain]the sun has moved down in the westward sky, and afternoon light colors everything in shades of burnt gold[otherwise if afternoon]clouds have moved over the sun, hiding the afternoon light in racing streaks of white and grey[otherwise if evening or sunset]the sun has sunken to near the horizon, producing a spectacular display[otherwise if twilight]the sun has set, leaving the island in a fading twilight[otherwise if night]the sun has set and the light has gone, leaving you in the black of night[end if].";
end if;
continue the action.