Chapter - The Heavens
Outdoors is a region.
A heavenly body is a kind of backdrop. A heavenly body is always minor. The provoke message of a heavenly body is usually "Would that you could." First report remembering a heavenly body: say "[The noun] is [if dawn and noun is sun]not yet in[else]no longer in[end if] the sky." instead.
Understand "sky/horizon" as up. Instead of examining up when location is regionally in Outdoors:
if sunup begin;
try examining sun;
if moonup, try examining moon;
otherwise;
if moonup, try examining moon;
otherwise try examining stars;
end if.
Every turn when the player is awake and the player is regionally in Lacuna and we are not landmark-going (this is the motions of the heavenly spheres rule):
if sunup:
if the heavens are being debugged, say "// The Heavens: placing the daytime heavens in scope.";
move the sun to Outdoors;
remove the stars from play;
remove the galaxy from play;
otherwise:
if the heavens are being debugged, say "// The Heavens: placing the nighttime heavens in scope.";
remove the sun from play;
move the stars to Outdoors;
move the galaxy to Outdoors;
if the tide counter > 841 or tide counter < 229:
remove the moon from play;
if the heavens are being debugged, say "// The Heavens: removing the moon.";
otherwise:
move the moon to Outdoors;
if the heavens are being debugged, say "// The Heavens: placing the moon in scope. Tide counter: [tide counter].".
The stars are a heavenly body. [ Can't recognize "star" due to conflict with a beat.]The description is "There must be millions of stars overhead, sparkling above you and lorded over by the great [if galaxy is named]galaxy [o]Capalla[x][otherwise][o]galaxy[x][end if] running through them all."
The great galaxy is a heavenly body. Understand "Capalla" as galaxy. The description is "Stretching nearly from horizon to horizon, the galaxy[if named][one of] -- Capalla, [the Progue] called it --[or] Capalla[stopping][end if] is rich with a million tiny dots finer than dust grains, streaked through with every shade of orange-tinted silver you can imagine."
Noticing-The-Galaxy is a scene. Noticing-The-Galaxy begins when galaxy is on-stage and night and location is outdoorsy and location is regionally in Lacuna. Noticing-The-Galaxy ends when Noticing-The-Galaxy begins. When Noticing-The-Galaxy begins: say "Gazing up at the sky, you pause for a moment in wonder. Spanning the horizon is a fantastic sight-- a silver-orange [o]galaxy[x], glimmering in the night like some vision. You've seen countless night skies in your travels, but this certainly counts as one of the most spectacular.".
Phase is a kind of value. The phases are new, sliver, crescent, fat crescent, half, waxing, three quarter, almost full, and fullmoon.
The moon is a heavenly body. The moon is in Outdoors. The moon has a phase. The description of the moon is "[if we have not examined the moon]There is almost always a moon, no matter the world. This one[otherwise]The moon[end if] is about the size of your fist held at arm's length, and it glows a ghostly pink, streaked through with shades of orange. Hanging [moon location], it's [long moon description]."
Check remembering the moon: say "The moon is not up right now." instead.
To say moon location:
if tide counter >= 229 and tide counter < 300, say "just above the eastern horizon";
if tide counter >= 300 and tide counter < 371, say "low in the eastern sky";
if tide counter >= 371 and tide counter < 443, say "halfway up the eastern sky";
if tide counter >= 443 and tide counter < 514, say "high in the eastern sky";
if tide counter >= 514 and tide counter < 585, say "almost directly overhead";
if tide counter >= 585 and tide counter < 657, say "high in the western sky";
if tide counter >= 657 and tide counter < 728, say "halfway down the western sky";
if tide counter >= 728 and tide counter < 800, say "low in the western sky";
if tide counter >= 800 or tide counter < 229, say "on the edge of the western horizon".
moon_wester is a truth state that varies.
To calculate moon phase:
[ set sun_time to a number from 0 to 1439 representing the time of day / sun's position in the sky.]
let sun_time be the hours part of time of day * 60;
let sun_time be sun_time plus the minutes part of time of day;
[ set moon_time to the moon's position in the sky on the same scale, losing some accuracy to stay within Inform's 32,768 integer maximum.]
let tmp be ( tide counter / 10 ) * 144;
let moon_time be tmp / 11;
[ the difference between these is the distance between the two bodies; convert this to 360 degrees (which is 1/4 of 1440) to get the angular distance between the two bodies, which in turn will be the phase of the moon. ]
let offset be ( sun_time - moon_time ) / 4;
[ for descriptive purposes, check whether the moon is on the west or east side of the sun. ]
if offset < 0, now moon_wester is true;
otherwise now moon_wester is false;
[ We don't care whether the moon is waxing or waning, so we can simplify to just a number between 0 (new) and 180 (full). ]
if offset > 180, change offset to offset - 360;
if offset < -180, change offset to offset + 360;
if offset < 0, change offset to offset * -1;
[ now we can decide on the moon's phase. ]
if offset < 20, now the phase of the moon is new;
if offset >= 20 and offset < 40, now the phase of the moon is sliver;
if offset >= 40 and offset < 60, now the phase of the moon is crescent;
if offset >= 60 and offset < 80, now the phase of the moon is fat crescent;
if offset >= 80 and offset < 100, now the phase of the moon is half;
if offset >= 100 and offset < 120, now the phase of the moon is waxing;
if offset >= 120 and offset < 140, now the phase of the moon is three quarter;
if offset >= 140 and offset < 160, now the phase of the moon is almost full;
if offset >= 160, now the phase of the moon is fullmoon;
if the heavens is being debugged, say "// The Heavens: calculate moon phase (sun_time: [sun_time]; moon_time: [moon_time]; offset: [offset]; [the phase of the moon]).".
To say moon description:
calculate moon phase;
if phase of moon is new, say "tiny sliver of a";
if phase of moon is sliver, say "thin sliver of a";
if phase of moon is crescent, say "crescent";
if phase of moon is fat crescent, say "fat crescent";
if phase of moon is half, say "half";
if phase of moon is waxing, say "just over half";
if phase of moon is three quarter, say "three-quarter";
if phase of moon is almost full, say "almost full";
if phase of moon is fullmoon, say "full".
To say long moon description:
calculate moon phase;
say "[if phase of moon is new]a barely visible splinter [moonclosesunbit][end if][if phase of moon is sliver]a skinny sliver [moonclosesunbit], its edges delicately traced in pink and black[end if][if phase of moon is crescent]a rounded crescent[end if][if phase of moon is fat crescent]a fat crescent, nearly half-full[end if]";
say "[if phase of moon is half]half full, the dark half faintly visible[end if][if phase of moon is waxing]a little more than half full[end if][if phase of moon is three quarter]three quarters full[end if][if phase of moon is almost full]almost full, the only imperfection a rounded sliver of shadow along one side[end if][if phase of moon is fullmoon]full and bright[end if]".
To say moonclosesunbit:
if phase of moon is new, say "just ";
if moon_wester is true begin;
if midmorning or midday or afternoon, say "west of";
if evening or sunset, say "below";
if sunrise or dawn or morning or twilight or night, say "above";
otherwise;
if midmorning or midday or afternoon, say "east of";
if evening or sunset or twilight, say "above";
if sunrise or morning or dawn or night, say "below";
end if;
say " [if sunset or evening]the blaze of the setting sun[otherwise if sunrise or morning]the bright rising sun[otherwise if sunup]the blaze of the sun[otherwise if dawn or twilight or night]the horizon[otherwise]in the sky[end if]".
The sun is a seen heavenly body. The sun is in Outdoors. The description of the sun is "[if sunrise]The sun creeps over the ocean with yellow gold fire, lighting up a brilliant streak in the waves[otherwise if morning]The morning sun beams brightly down on you, burning away the faint chill of night[otherwise if midmorning]The sun is high in the eastern sky. It's beginning to get hot[otherwise if midday]The sun is directly overhead, bright, and scorching[otherwise if afternoon]High in the western sky, the sun is bright and hot[otherwise if evening]Colors begin to deepen as the sun approaches the western horizon[otherwise if sunset]The sunset over the waves is spectacular[otherwise]The sun has slipped beneath the waves[end if]." Understand "sunrise" and "sunset" as the sun. Understand "flash" or "green flash" as the sun when Progue is idle.
To pass (span - a number) minutes of time:
now the time of day is span minutes after the time of day;
increase the tide counter by span;
if the tide counter is greater than 1100, change the tide counter to the tide counter minus 1100.
The Heavens is a thing. Check object-debugging sun: try object-debugging the heavens instead. Check object-debugging moon: try object-debugging the heavens instead. Check object-debugging galaxy: try object-debugging the heavens instead. Check object-debugging rain clouds: try object-debugging the heavens instead.
To say light-source:
if sunup begin; say "sun";
otherwise;
if moonup, say "moonlight";
otherwise say "stars";
end if.
To say approximate time: say "[if dawn]Dawn[end if][if sunrise]Sunrise[end if][if morning]Morning[end if][if midmorning]Midmorning[end if][if midday]Midday[end if][aptime2]". To say aptime2: say "[if afternoon]Afternoon[end if][if evening]Evening[end if][if sunset]Sunset[end if][if twilight]Twilight[end if][if night]Night[end if]".