using Terraria.ModLoader; using Terraria; using Microsoft.Xna.Framework; using System; namespace ForgottenWawiTech.Content.Rarities { public class SingularityItem : ModRarity { // Fade between very dark purple and bright purple (avoids unreadable black) // with periodic brightness pulses for a "singularity" feel. public override Color RarityColor { get { float time = Main.GlobalTimeWrappedHourly; // Base fade (slow): very dark purple <-> bright purple const float fadeHz = 0.5f; // cycles per second float fadeT = (float)((Math.Sin(time * fadeHz * MathHelper.TwoPi) + 1f) * 0.5f); // 0..1 // Keep a minimum fade so text stays readable const float minFade = 0.25f; // never dip below 25% toward bright fadeT = minFade + (1f - minFade) * fadeT; // remap to [minFade, 1] Color veryDarkPurple = new Color(50, 0, 80); Color brightPurple = new Color(160, 0, 255); Color baseColor = Color.Lerp(veryDarkPurple, brightPurple, fadeT); // Pulse (quick, narrow peaks). Using a powered sine to make sharp flashes. const float pulseHz = 1.2f; // pulses per second float s = (float)Math.Sin(time * pulseHz * MathHelper.TwoPi); float pulse = (float)Math.Pow(Math.Max(0f, s), 3f); // 0..1, narrow peaks float brightness = 1f + 0.25f * pulse; // up to +25% brightness at pulse peak // Multiply to apply brightness pulse. Color*float clamps components safely. return baseColor * brightness; } } } }