public override void ModifySunLightColor(ref Color tileColor, ref Color backgroundColor) { if (Main.myPlayer < 0 || Main.gameMenu || !Main.LocalPlayer.active) { return; } CustomSky erilipahSky = SkyManager.Instance["Erilipah:ErilipahBiome"]; if (erilipahSky.IsActive()) { float tile = MathHelper.Lerp(1f, erilipahIsBright ? 0.52f : 0.4f, erilipahSky.Opacity); float back = MathHelper.Lerp(1f, erilipahIsBright ? 0.25f : 0.22f, erilipahSky.Opacity); totalBright *= erilipahIsBright ? 1 : MathHelper.Lerp(1f, 0.8f, erilipahSky.Opacity); if (Main.raining && Main.LocalPlayer.Center.Y < Main.rockLayer * 16) { tile /= 2f; back /= 2f; totalBright *= 0.8f; } tileColor = new Color( (byte)(tileColor.R * tile * 0.85f), (byte)(tileColor.G * tile * 0.7f), (byte)(tileColor.B * tile * 1.0f), tileColor.A ); backgroundColor = new Color( (byte)(backgroundColor.R * back * 0.8f), (byte)(backgroundColor.G * back * 0.7f), (byte)(backgroundColor.B * back * 1.0f), backgroundColor.A ); } }
public override void PostUpdate() { if (!Main.dayTime) { if (_oldIsDay && Main.netMode != NetmodeID.MultiplayerClient) { if (Main.netMode != NetmodeID.MultiplayerClient && Main.rand.NextBool(15) && NPC.downedBoss1) { ActiveMagicStorm(); } } if (Main.netMode != NetmodeID.Server) { CustomSky customSky = SkyManager.Instance["Entrogic:MagicStormScreen"]; if (magicStorm) { if (!customSky.IsActive()) { SkyManager.Instance.Activate("Entrogic:MagicStormScreen", default(Vector2), new object[] { true }); } } else if (customSky.IsActive()) { SkyManager.Instance.Deactivate("Entrogic:MagicStormScreen", new object[] { default(Vector2), true }); } } int mimicrySpawnRate = 962; if (Main.netMode != NetmodeID.MultiplayerClient && magicStorm) { mimicrySpawnRate = 565; } if (Main.hardMode) { mimicrySpawnRate -= 182; } if (Main.rand.NextBool(mimicrySpawnRate) && Main.netMode != NetmodeID.MultiplayerClient) { foreach (Player player in Main.player) { if (player.ZoneOverworldHeight && player.active && !player.dead) { Point rand = new Point(Main.rand.Next(-80, 81), Main.rand.Next(-60, 61)); Point tilePlrPos = player.position.ToTileCoordinates(); if (!SummonMimicryAvailable(new Point(rand.X + (int)tilePlrPos.X, rand.Y + (int)tilePlrPos.Y))) { continue; } int mimicry = Projectile.NewProjectile(player.position + rand.ToWorldCoordinates(), Vector2.Zero, ProjectileType <Projectiles.Miscellaneous.Arcana>(), 0, 0f, player.whoAmI); NetMessage.SendData(MessageID.SyncProjectile, -1, -1, null, mimicry); } } } } else { if (_oldIsNight && Main.netMode != NetmodeID.MultiplayerClient) { if (magicStorm) { magicStorm = false; if (Main.dedServ) { NetworkText text = NetworkText.FromKey("魔力平静了下来"); NetMessage.BroadcastChatMessage(text, new Color(150, 150, 250)); var packet = mod.GetPacket(); packet.Write((byte)EntrogicModMessageType.ReceiveMagicStormRequest); packet.Write(magicStorm); packet.Send(); // 不填即为发给服务器 } else { string text = "魔力平静了下来"; Main.NewText(text, 150, 150, 250); } } } } _oldIsDay = Main.dayTime; _oldIsNight = !Main.dayTime; }