Example #1
0
        private static void NaturalAttempt()
        {
            if (Main.netMode == 1 || !LanternNight.LanternsCanStart())
            {
                return;
            }
            bool flag = false;

            if (LanternNight.LanternNightsOnCooldown > 0)
            {
                --LanternNight.LanternNightsOnCooldown;
            }
            if (LanternNight.LanternNightsOnCooldown == 0 && NPC.downedMoonlord && Main.rand.Next(14) == 0)
            {
                flag = true;
            }
            if (!flag && LanternNight.NextNightIsLanternNight)
            {
                LanternNight.NextNightIsLanternNight = false;
                flag = true;
            }
            if (!flag)
            {
                return;
            }
            LanternNight.GenuineLanterns         = true;
            LanternNight.LanternNightsOnCooldown = Main.rand.Next(5, 11);
        }
Example #2
0
 public static void UpdateTime()
 {
     if (LanternNight.GenuineLanterns && !LanternNight.LanternsCanPersist())
     {
         LanternNight.GenuineLanterns = false;
     }
     if (LanternNight._wasLanternNight != LanternNight.LanternsUp)
     {
         if (Main.netMode != 2)
         {
             if (LanternNight.LanternsUp)
             {
                 SkyManager.Instance.Activate("Lantern", new Vector2());
             }
             else
             {
                 SkyManager.Instance.Deactivate("Lantern");
             }
         }
         else
         {
             NetMessage.SendData(7, -1, -1, (NetworkText)null, 0, 0.0f, 0.0f, 0.0f, 0, 0, 0);
         }
     }
     LanternNight._wasLanternNight = LanternNight.LanternsUp;
 }
Example #3
0
 public static bool LanternsCanStart()
 {
     return(!Main.bloodMoon && !Main.pumpkinMoon && (!Main.snowMoon && Main.invasionType == 0) && NPC.MoonLordCountdown == 0 && !LanternNight.BossIsActive());
 }
Example #4
0
 public static bool LanternsCanPersist()
 {
     return(!Main.dayTime && LanternNight.LanternsCanStart());
 }
Example #5
0
 public static void CheckNight()
 {
     LanternNight.NaturalAttempt();
 }