using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { public class SlagRound : ModProjectile { public override void SetStaticDefaults() { DisplayName.SetDefault("Round"); } public override void SetDefaults() { projectile.width = 6; projectile.height = 6; projectile.friendly = true; projectile.ranged = true; projectile.penetrate = 1; projectile.aiStyle = 1; aiType = ProjectileID.Bullet; } public override void AI() { projectile.localAI[0] += 1f; if (projectile.localAI[0] > 2f) { for (int num468 = 0; num468 < 3; num468++) { int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 32, 0f, 0f, 100, default, 1.25f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 120); } public override void Kill(int timeLeft) { for (int k = 0; k < 5; k++) { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 32, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); } float spread = 180f * 0.0174f; double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; int i; if (projectile.owner == Main.myPlayer) { for (i = 0; i <= 1; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)((double)projectile.damage * 0.35f), projectile.knockBack, projectile.owner, 0f, 0f); Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)((double)projectile.damage * 0.35f), projectile.knockBack, projectile.owner, 0f, 0f); } } } } }