using Microsoft.Xna.Framework; using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class WaywasherProj : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; public override void SetDefaults() { Projectile.width = 16; Projectile.height = 16; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.alpha = 0; Projectile.penetrate = 2; Projectile.timeLeft = 300; Projectile.DamageType = DamageClass.Magic; } public override void AI() { Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.02f * (float)Projectile.direction; Lighting.AddLight(Projectile.Center, 0f, 0.1f, 0.7f); for (int i = 0; i < 2; i++) { float shortXVel = Projectile.velocity.X / 3f * (float)i; float shortYVel = Projectile.velocity.Y / 3f * (float)i; int fourConst = 4; int waterDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)fourConst, Projectile.position.Y + (float)fourConst), Projectile.width - fourConst * 2, Projectile.height - fourConst * 2, 33, 0f, 0f, 0, new Color(64, 224, 208), 1.2f); Dust dust = Main.dust[waterDust]; dust.noGravity = true; dust.velocity *= 0.1f; dust.velocity += Projectile.velocity * 0.1f; dust.position.X -= shortXVel; dust.position.Y -= shortYVel; } if (Main.rand.NextBool(5)) { int otherFourConst = 4; int otherWaterDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)otherFourConst, Projectile.position.Y + (float)otherFourConst), Projectile.width - otherFourConst * 2, Projectile.height - otherFourConst * 2, 33, 0f, 0f, 0, new Color(64, 224, 208), 0.6f); Main.dust[otherWaterDust].velocity *= 0.25f; Main.dust[otherWaterDust].velocity += Projectile.velocity * 0.5f; } if (Projectile.velocity.Y > 16f) { Projectile.velocity.Y = 16f; } } public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item10, Projectile.position); for (int k = 0; k < 10; k++) { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 33, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f, 0, new Color(0, 142, 255), 1f); } } } }