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

◆ TriggerLunarApocalypse()

static void Terraria.WorldGen.TriggerLunarApocalypse ( )
inlinestatic

Definition at line 76684 of file WorldGen.cs.

76685 {
76686 List<int> list = new List<int> { 517, 422, 507, 493 };
76687 int[] array = new int[4];
76688 for (int i = 0; i < 4; i++)
76689 {
76690 array[i] = list[Main.rand.Next(list.Count)];
76691 list.Remove(array[i]);
76692 }
76693 int num = Main.maxTilesX / 5;
76694 int num2 = (int)Main.worldSurface;
76695 for (int j = 0; j < 4; j++)
76696 {
76697 int num3 = num * (1 + j);
76698 bool flag = false;
76699 for (int k = 0; k < 30; k++)
76700 {
76701 int num4 = Main.rand.Next(-100, 101);
76702 if (Main.remixWorld && Main.getGoodWorld)
76703 {
76704 int num5 = Main.rand.Next((int)Main.worldSurface, Main.maxTilesY - 350);
76705 if (!PlayerLOS(num3 + num4 - 10, num5) && !PlayerLOS(num3 + num4 + 10, num5) && !PlayerLOS(num3 + num4 - 10, num5 - 20) && !PlayerLOS(num3 + num4 + 10, num5 - 20))
76706 {
76707 int num6 = NPC.NewNPC(new EntitySource_WorldEvent(), (num3 + num4) * 16, num5 * 16, array[j]);
76708 if (Main.netMode == 2 && num6 < 200)
76709 {
76710 NetMessage.SendData(23, -1, -1, null, num6);
76711 }
76712 flag = true;
76713 break;
76714 }
76715 continue;
76716 }
76717 for (int num7 = num2; num7 > 100; num7--)
76718 {
76719 if (!Collision.SolidTiles(num3 + num4 - 10, num3 + num4 + 10, num7 - 20, num7 + 15) && !PlayerLOS(num3 + num4 - 10, num7) && !PlayerLOS(num3 + num4 + 10, num7) && !PlayerLOS(num3 + num4 - 10, num7 - 20) && !PlayerLOS(num3 + num4 + 10, num7 - 20))
76720 {
76721 int num8 = NPC.NewNPC(new EntitySource_WorldEvent(), (num3 + num4) * 16, num7 * 16, array[j]);
76722 if (Main.netMode == 2 && num8 < 200)
76723 {
76724 NetMessage.SendData(23, -1, -1, null, num8);
76725 }
76726 flag = true;
76727 break;
76728 }
76729 }
76730 if (flag)
76731 {
76732 break;
76733 }
76734 }
76735 if (!flag)
76736 {
76737 NPC.NewNPC(new EntitySource_WorldEvent(), num3 * 16, (num2 - 40) * 16, array[j]);
76738 }
76739 }
76740 NPC.TowerActiveVortex = (NPC.TowerActiveNebula = (NPC.TowerActiveSolar = (NPC.TowerActiveStardust = true)));
76741 NPC.LunarApocalypseIsUp = true;
76742 NPC.ShieldStrengthTowerSolar = (NPC.ShieldStrengthTowerVortex = (NPC.ShieldStrengthTowerNebula = (NPC.ShieldStrengthTowerStardust = NPC.ShieldStrengthTowerMax)));
76743 NetMessage.SendData(101);
76745 }
bool ICollection< KeyValuePair< TKey, TValue > >. Remove(KeyValuePair< TKey, TValue > keyValuePair)
static void MessageLunarApocalypse()
static bool PlayerLOS(int x, int y)

References System.array, Terraria.Main.getGoodWorld, System.list, Terraria.Main.netMode, Terraria.NPC.NewNPC(), Terraria.Main.rand, Terraria.Main.remixWorld, System.Collections.Generic.Dictionary< TKey, TValue >.Remove(), Terraria.NetMessage.SendData(), Terraria.NPC.ShieldStrengthTowerMax, Terraria.Collision.SolidTiles(), and Terraria.Main.worldSurface.

Referenced by Terraria.NPC.DoDeathEvents().