using Microsoft.Xna.Framework; using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Enemy { public class PearlRain : ModProjectile { public override void SetStaticDefaults() { DisplayName.SetDefault("Pearl Rain"); Main.projFrames[projectile.type] = 4; } public override void SetDefaults() { projectile.width = 40; projectile.height = 64; projectile.hostile = true; projectile.penetrate = -1; projectile.alpha = 255; projectile.timeLeft = 300; projectile.ignoreWater = true; projectile.tileCollide = false; } public override void AI() { Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0.5f / 255f); if (Main.rand.NextBool(5)) { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 92, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 0, new Color(255, 255, 255), 0.7f); } projectile.frameCounter++; if (projectile.frameCounter > 3) { projectile.frame++; projectile.frameCounter = 0; } if (projectile.frame > 3) { projectile.frame = 0; } projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) - 1.57f; projectile.alpha -= 6; } public override Color? GetAlpha(Color lightColor) { return new Color(255, 255, 255); } } }