bool IsNewMoon() { LunarPhases massarPhase = DaggerfallUnity.Instance.WorldTime.Now.MassarLunarPhase; LunarPhases secundaPhase = DaggerfallUnity.Instance.WorldTime.Now.SecundaLunarPhase; return(massarPhase == LunarPhases.New || secundaPhase == LunarPhases.New); }
bool IsHalfMoon() { LunarPhases massarPhase = DaggerfallUnity.Instance.WorldTime.Now.MassarLunarPhase; LunarPhases secundaPhase = DaggerfallUnity.Instance.WorldTime.Now.SecundaLunarPhase; return(massarPhase == LunarPhases.HalfWane || massarPhase == LunarPhases.HalfWax || secundaPhase == LunarPhases.HalfWane || secundaPhase == LunarPhases.HalfWax); }
// Borrowed this code from Lypyl's Enhanched Sky mod and cleaned up just to return phase value // This should return same value for lunar phases as Enhanced Sky so lycanthropes will see full moon on days they are forced to change // Moon phases are also used by "extra spell pts" item power during "full moon", "half moon", "new moon" private LunarPhases GetLunarPhase(bool isMasser) { // Validate if (Year < 0) { Debug.LogError("GetLunarPhase: Year < 0 not supported."); return(LunarPhases.None); } // 3 aligns full moon with vanilla DF for Masser, -1 for secunda int offset = (isMasser) ? 3 : -1; // Find the lunar phase for current day int moonRatio = (DayOfYear + Year * MonthsPerYear * DaysPerMonth + offset) % 32; LunarPhases phase = LunarPhases.None; if (moonRatio == 0) { phase = LunarPhases.Full; } else if (moonRatio == 16) { phase = LunarPhases.New; } else if (moonRatio <= 5) { phase = LunarPhases.ThreeWane; } else if (moonRatio <= 10) { phase = LunarPhases.HalfWane; } else if (moonRatio <= 15) { phase = LunarPhases.OneWane; } else if (moonRatio <= 22) { phase = LunarPhases.OneWax; } else if (moonRatio <= 28) { phase = LunarPhases.HalfWax; } else if (moonRatio <= 31) { phase = LunarPhases.ThreeWax; } return(phase); }