Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ UpdateTime_StartNight()

static void Terraria.Main.UpdateTime_StartNight ( ref bool stopEvents)
inlinestatic

Definition at line 61922 of file Main.cs.

61923 {
61925 {
61926 fastForwardTimeToDusk = false;
61928 }
61929 if (moondialCooldown > 0)
61930 {
61932 }
61933 NPC.ResetBadgerHatTime();
61934 NPC.freeCake = false;
61935 Star.NightSetup();
61936 NPC.setFireFlyChance();
61939 WorldGen.mysticLogsEvent.StartNight();
61940 WorldGen.prioritizedTownNPCType = 0;
61941 checkForSpawns = 0;
61942 if (rand.Next(50) == 0 && netMode != 1 && NPC.downedBoss2)
61943 {
61944 WorldGen.spawnMeteor = true;
61945 }
61947 {
61948 stopEvents = true;
61949 }
61950 if (eclipse && netMode != 1)
61951 {
61953 }
61954 eclipse = false;
61955 if (netMode != 1)
61956 {
61958 }
61960 {
61961 if (!NPC.downedBoss1 && netMode != 1)
61962 {
61963 bool flag = false;
61964 for (int i = 0; i < 255; i++)
61965 {
61966 if (player[i].active && player[i].statLifeMax >= 200 && player[i].statDefense > 10)
61967 {
61968 flag = true;
61969 break;
61970 }
61971 }
61972 if (flag && rand.Next(3) == 0)
61973 {
61974 int num = 0;
61975 for (int j = 0; j < 200; j++)
61976 {
61977 if (npc[j].active && npc[j].townNPC)
61978 {
61979 num++;
61980 }
61981 }
61982 if (num >= 4)
61983 {
61984 WorldGen.spawnEye = true;
61985 if (netMode == 0)
61986 {
61987 NewText(Lang.misc[9].Value, 50, byte.MaxValue, 130);
61988 }
61989 else if (netMode == 2)
61990 {
61991 ChatHelper.BroadcastChatMessage(Lang.misc[9].ToNetworkText(), new Microsoft.Xna.Framework.Color(50, 255, 130));
61992 }
61993 }
61994 }
61995 }
61996 if (netMode != 1 && !pumpkinMoon && !DD2Event.Ongoing && !snowMoon && WorldGen.altarCount > 0 && hardMode && !WorldGen.spawnEye && rand.Next(10) == 0)
61997 {
61998 bool flag2 = false;
61999 for (int k = 0; k < 200; k++)
62000 {
62001 if (npc[k].active && npc[k].boss)
62002 {
62003 flag2 = true;
62004 }
62005 }
62006 if (!flag2 && (!NPC.downedMechBoss1 || !NPC.downedMechBoss2 || !NPC.downedMechBoss3))
62007 {
62008 if (remixWorld && getGoodWorld)
62009 {
62010 if (rand.Next(2) == 0)
62011 {
62012 WorldGen.spawnHardBoss = rand.Next(3) + 1;
62013 if (netMode == 0)
62014 {
62015 NewText(Lang.misc[108].Value, 50, byte.MaxValue, 130);
62016 }
62017 else if (netMode == 2)
62018 {
62019 ChatHelper.BroadcastChatMessage(Lang.misc[108].ToNetworkText(), new Microsoft.Xna.Framework.Color(50, 255, 130));
62020 }
62021 }
62022 }
62023 else
62024 {
62025 for (int l = 0; l < 1000; l++)
62026 {
62027 int num2 = rand.Next(3) + 1;
62028 if (num2 == 1 && !NPC.downedMechBoss1)
62029 {
62030 WorldGen.spawnHardBoss = num2;
62031 if (netMode == 0)
62032 {
62033 NewText(Lang.misc[28].Value, 50, byte.MaxValue, 130);
62034 }
62035 else if (netMode == 2)
62036 {
62037 ChatHelper.BroadcastChatMessage(Lang.misc[28].ToNetworkText(), new Microsoft.Xna.Framework.Color(50, 255, 130));
62038 }
62039 break;
62040 }
62041 if (num2 == 2 && !NPC.downedMechBoss2)
62042 {
62043 WorldGen.spawnHardBoss = num2;
62044 if (netMode == 0)
62045 {
62046 NewText(Lang.misc[29].Value, 50, byte.MaxValue, 130);
62047 }
62048 else if (netMode == 2)
62049 {
62050 ChatHelper.BroadcastChatMessage(Lang.misc[29].ToNetworkText(), new Microsoft.Xna.Framework.Color(50, 255, 130));
62051 }
62052 break;
62053 }
62054 if (num2 == 3 && !NPC.downedMechBoss3)
62055 {
62056 WorldGen.spawnHardBoss = num2;
62057 if (netMode == 0)
62058 {
62059 NewText(Lang.misc[30].Value, 50, byte.MaxValue, 130);
62060 }
62061 else if (netMode == 2)
62062 {
62063 ChatHelper.BroadcastChatMessage(Lang.misc[30].ToNetworkText(), new Microsoft.Xna.Framework.Color(50, 255, 130));
62064 }
62065 break;
62066 }
62067 }
62068 }
62069 }
62070 }
62071 int maxValue = 9;
62073 {
62074 maxValue = 6;
62075 }
62076 if (!WorldGen.spawnEye && moonPhase != 4 && rand.Next(maxValue) == 0 && netMode != 1)
62077 {
62078 for (int m = 0; m < 255; m++)
62079 {
62080 if (player[m].active && player[m].statLifeMax > 120)
62081 {
62082 bloodMoon = true;
62083 break;
62084 }
62085 }
62086 if (bloodMoon)
62087 {
62088 sundialCooldown = 0;
62089 moondialCooldown = 0;
62091 if (netMode == 0)
62092 {
62093 NewText(Lang.misc[8].Value, 50, byte.MaxValue, 130);
62094 }
62095 else if (netMode == 2)
62096 {
62097 ChatHelper.BroadcastChatMessage(Lang.misc[8].ToNetworkText(), new Microsoft.Xna.Framework.Color(50, 255, 130));
62098 }
62099 }
62100 }
62101 }
62102 time = 0.0;
62103 dayTime = false;
62104 if (netMode == 2)
62105 {
62106 NetMessage.SendData(7);
62107 }
62108 }
static void BroadcastChatMessage(NetworkText text, Color color, int excludedPlayer=-1)
Definition ChatHelper.cs:46
static int checkForSpawns
Definition Main.cs:1316
static double time
Definition Main.cs:1284
static int netMode
Definition Main.cs:2095
static bool IsFastForwardingTime()
Definition Main.cs:5721
static bool dayTime
Definition Main.cs:1282
static bool bloodMoon
Definition Main.cs:1296
static int moonPhase
Definition Main.cs:1288
static void NewText(string newText, byte R=byte.MaxValue, byte G=byte.MaxValue, byte B=byte.MaxValue)
Definition Main.cs:61429
static bool getGoodWorld
Definition Main.cs:341
static int moondialCooldown
Definition Main.cs:2287
static bool eclipse
Definition Main.cs:1312
static UnifiedRandom rand
Definition Main.cs:1387
static NPC[] npc
Definition Main.cs:1685
static void UpdateTimeRate()
Definition Main.cs:5760
static bool tenthAnniversaryWorld
Definition Main.cs:343
static int sundialCooldown
Definition Main.cs:2283
static bool snowMoon
Definition Main.cs:1300
static bool pumpkinMoon
Definition Main.cs:1298
static bool hardMode
Definition Main.cs:1022
static Player[] player
Definition Main.cs:1803
static bool fastForwardTimeToDusk
Definition Main.cs:2285
static bool remixWorld
Definition Main.cs:349

References Terraria.WorldGen.altarCount, Terraria.Main.bloodMoon, Terraria.Chat.ChatHelper.BroadcastChatMessage(), Terraria.Main.checkForSpawns, Terraria.GameContent.Events.BirthdayParty.CheckNight(), Terraria.GameContent.Events.LanternNight.CheckNight(), Terraria.Main.dayTime, Terraria.NPC.downedBoss1, Terraria.NPC.downedBoss2, Terraria.NPC.downedMechBoss1, Terraria.NPC.downedMechBoss2, Terraria.NPC.downedMechBoss3, Terraria.Main.eclipse, Terraria.Main.fastForwardTimeToDusk, Terraria.Main.getGoodWorld, Terraria.Main.hardMode, System.Text.RegularExpressions.i, Terraria.Main.IsFastForwardingTime(), Terraria.GameContent.Events.LanternNight.LanternsUp, Terraria.Lang.misc, Terraria.Main.moondialCooldown, Terraria.Main.moonPhase, Terraria.WorldGen.mysticLogsEvent, Terraria.Main.netMode, Terraria.Main.NewText(), Terraria.Star.NightSetup(), Terraria.GameContent.Achievements.AchievementsHelper.NotifyProgressionEvent(), Terraria.Main.npc, Terraria.GameContent.Events.DD2Event.Ongoing, Terraria.Main.player, Terraria.Main.pumpkinMoon, Terraria.Main.rand, Terraria.Main.remixWorld, Terraria.NPC.ResetBadgerHatTime(), Terraria.NetMessage.SendData(), Terraria.NPC.setFireFlyChance(), Terraria.Main.snowMoon, Terraria.WorldGen.spawnEye, Terraria.Main.sundialCooldown, Terraria.Main.tenthAnniversaryWorld, Terraria.Main.time, and Terraria.Main.UpdateTimeRate().

Referenced by Terraria.Main.SkipToTime(), and Terraria.Main.UpdateTime().