using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class RealmRavagerBullet : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; public override void SetStaticDefaults() { ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { Projectile.width = 4; Projectile.height = 4; Projectile.light = 0.5f; Projectile.alpha = 255; Projectile.DamageType = DamageClass.Ranged; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.aiStyle = ProjAIStyleID.Arrow; AIType = ProjectileID.BulletHighVelocity; Projectile.extraUpdates = 3; Projectile.penetrate = 1; Projectile.timeLeft = 90; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override bool PreDraw(ref Color lightColor) { CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, lightColor); return false; } public override void Kill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); Projectile.ExpandHitboxBy(32); for (int d = 0; d < 2; d++) { Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Smoke, 0f, 0f, 100, default, 1.5f); } for (int d = 0; d < 20; d++) { int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 0, default, 2.5f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 3f; idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 1.5f); Main.dust[idx].velocity *= 2f; Main.dust[idx].noGravity = true; } Projectile.maxPenetrate = -1; Projectile.penetrate = -1; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; Projectile.damage /= 2; Projectile.Damage(); } } }