Documentation
¶
Overview ¶
Package datetime owns the Britannian calendar and calendar-derived presentation phases.
Index ¶
- Constants
- type BritannianDate
- type MoonPhase
- type TimeOfDay
- type UltimaDate
- func (d *UltimaDate) Advance(nMinutes int)
- func (d UltimaDate) DateOnly() BritannianDate
- func (d *UltimaDate) GetAmbientTintDarkness() float32
- func (d *UltimaDate) GetCurrentMoonPhase() MoonPhase
- func (d *UltimaDate) GetDateAsString() string
- func (d *UltimaDate) GetFeluccaMoonPhase() MoonPhase
- func (d *UltimaDate) GetMoongateMoonPhase() MoonPhase
- func (d *UltimaDate) GetTimeAsString() string
- func (d *UltimaDate) GetTotalDays() int
- func (d *UltimaDate) GetTrammelMoonPhase() MoonPhase
- func (d *UltimaDate) GetVisibilityFactorWithoutTorch(baselineMin float32) float32
- func (d *UltimaDate) IsDayLight() bool
- func (d *UltimaDate) IsFullDaylight() bool
- func (d *UltimaDate) IsNight() bool
- func (d *UltimaDate) IsVisibilityDaylight() bool
- func (d *UltimaDate) IsWithinFirstMonth() bool
- func (d *UltimaDate) SetTimeOfDay(timeOfDay TimeOfDay)
Constants ¶
const ( DaysInMonth = 28 MonthsPerYear = 13 MinutesPerHour = 60 HoursPerDay = 24 MaximumAdvanceMinutes = MinutesPerHour * 9 )
Calendar dimensions and the maximum supported interval per advancement call.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BritannianDate ¶
BritannianDate is an in-game calendar date without time-of-day or turn state.
func (BritannianDate) IsValid ¶
func (d BritannianDate) IsValid() bool
IsValid reports whether the date is inside the Britannian calendar range.
type MoonPhase ¶
type MoonPhase int
MoonPhase represents the 8 moon phases for moongate transportation Based on original Ultima V moon phase system (0-7)
const ( MoonPhaseNew MoonPhase = iota // 0 MoonPhaseCrescentWaxing // 1 MoonPhaseFirstQuarter // 2 MoonPhaseGibbousWaxing // 3 MoonPhaseFull // 4 MoonPhaseGibbousWaning // 5 MoonPhaseLastQuarter // 6 MoonPhaseCrescentWaning // 7 )
Lunar phases in their original cyclic order.
func (MoonPhase) ToMoonstoneIndex ¶
ToMoonstoneIndex converts moon phase to moonstone index (0-7) Each moon phase corresponds to a specific moonstone for moongate travel
type UltimaDate ¶
UltimaDate records the authoritative calendar and turn count.
func (*UltimaDate) Advance ¶
func (d *UltimaDate) Advance(nMinutes int)
Advance applies one bounded calendar interval and increments the turn count.
func (UltimaDate) DateOnly ¶
func (d UltimaDate) DateOnly() BritannianDate
DateOnly returns the Britannian calendar date represented by d.
func (*UltimaDate) GetAmbientTintDarkness ¶
func (d *UltimaDate) GetAmbientTintDarkness() float32
GetAmbientTintDarkness returns the cosmetic night-tint strength from 0 to 1. REDUX DEVIATION: Original sight changes in steps during hours 5 (ref:LIGHT-0001) and 19. Redux fades only the ambient tint during 05:00-05:30 and 19:30-20:00 so dawn and dusk change smoothly without altering tile visibility.
func (*UltimaDate) GetCurrentMoonPhase ¶
func (d *UltimaDate) GetCurrentMoonPhase() MoonPhase
GetCurrentMoonPhase returns Trammel's phase for compatibility with displays that represent one moon. Moongate routing uses GetMoongateMoonPhase.
func (*UltimaDate) GetDateAsString ¶
func (d *UltimaDate) GetDateAsString() string
GetDateAsString formats the calendar as month-day-year.
func (*UltimaDate) GetFeluccaMoonPhase ¶
func (d *UltimaDate) GetFeluccaMoonPhase() MoonPhase
GetFeluccaMoonPhase returns Felucca's phase for the current day; ref:MOON-0002.
func (*UltimaDate) GetMoongateMoonPhase ¶
func (d *UltimaDate) GetMoongateMoonPhase() MoonPhase
GetMoongateMoonPhase selects Trammel before noon and Felucca from noon onward; ref:MOON-0003.
func (*UltimaDate) GetTimeAsString ¶
func (d *UltimaDate) GetTimeAsString() string
GetTimeAsString formats the clock with an AM/PM suffix.
func (*UltimaDate) GetTotalDays ¶
func (d *UltimaDate) GetTotalDays() int
GetTotalDays returns the total number of days since the start of the game. Ultima V uses Year 1, Month 1, Day 1 as the epoch.
func (*UltimaDate) GetTrammelMoonPhase ¶
func (d *UltimaDate) GetTrammelMoonPhase() MoonPhase
GetTrammelMoonPhase returns Trammel's phase for the current day; ref:MOON-0002.
func (*UltimaDate) GetVisibilityFactorWithoutTorch ¶
func (d *UltimaDate) GetVisibilityFactorWithoutTorch(baselineMin float32) float32
GetVisibilityFactorWithoutTorch returns a 0–1 visibility factor (despite the word “Percent” in the name).
func (*UltimaDate) IsDayLight ¶
func (d *UltimaDate) IsDayLight() bool
IsDayLight reports the broad daytime window, including twilight.
func (*UltimaDate) IsFullDaylight ¶
func (d *UltimaDate) IsFullDaylight() bool
IsFullDaylight returns true during full daylight hours (after dawn, before dusk). Ordinary original ambient sight reaches 50 only during hours 6-18 (ref:LIGHT-0001). Cosmetic dusk interpolation is independent of this lighthouse activation boundary.
func (*UltimaDate) IsNight ¶
func (d *UltimaDate) IsNight() bool
IsNight reports whether the clock is outside the daytime window.
func (*UltimaDate) IsVisibilityDaylight ¶
func (d *UltimaDate) IsVisibilityDaylight() bool
IsVisibilityDaylight preserves Redux's daylight visibility window separately from the original lighthouse sight threshold. Cosmetic dusk does not reduce LOS.
func (*UltimaDate) IsWithinFirstMonth ¶
func (d *UltimaDate) IsWithinFirstMonth() bool
IsWithinFirstMonth returns true if the game is within the first in-game month. Used for "easy mode" where monster counts are reduced. Opening-campaign state reduces eligible encounter counts; ref:TIME-0007.
func (*UltimaDate) SetTimeOfDay ¶
func (d *UltimaDate) SetTimeOfDay(timeOfDay TimeOfDay)
SetTimeOfDay selects a preset hour.