using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class Razorwind : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; public override string Texture => "CalamityMod/Projectiles/TornadoProj"; public override void SetStaticDefaults() { ProjectileID.Sets.TrailCacheLength[Projectile.type] = 15; ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { Projectile.width = 40; Projectile.height = 40; Projectile.alpha = 255; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; Projectile.timeLeft = 300; Projectile.extraUpdates = 2; Projectile.penetrate = 3; Projectile.ignoreWater = true; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 8; } public override void AI() { Projectile.rotation += Projectile.velocity.X * 0.1f; Projectile.alpha -= 5; if (Projectile.alpha < 50) { Projectile.alpha = 50; } Projectile.localAI[1] += 1f; if (Projectile.localAI[1] > 4f) { for (int num468 = 0; num468 < 3; num468++) { int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 187, 0f, 0f, 100, new Color(53, Main.DiscoG, 255), 2f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } } CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 250f, 12f, 20f); } public override bool OnTileCollide(Vector2 oldVelocity) => false; public override void Kill(int timeLeft) { for (int k = 0; k < 10; k++) { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 187, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 100, new Color(53, Main.DiscoG, 255)); } } public override Color? GetAlpha(Color lightColor) { return new Color(53, Main.DiscoG, 255, Projectile.alpha); } public override bool PreDraw(ref Color lightColor) { CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } }