using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Dusts; namespace CalamityMod.Projectiles.Magic { public class TearsofHeavenProjectile : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; public override void SetStaticDefaults() { ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { Projectile.width = 24; Projectile.height = 24; Projectile.friendly = true; Projectile.DamageType = DamageClass.Magic; Projectile.penetrate = 2; Projectile.alpha = 255; Projectile.timeLeft = 240; Projectile.light = 0.5f; Projectile.tileCollide = false; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 20; } public override void AI() { if (Projectile.alpha > 0) { Projectile.alpha -= 25; if (Projectile.alpha < 0) Projectile.alpha = 0; } Projectile.localAI[0] += 1f; if (Projectile.localAI[0] > 4f) { int Smalldust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.ProfanedFire, 0f, 0f, 100, default, 1f); Main.dust[Smalldust].noGravity = true; int Bigdust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.ProfanedFire, 0f, 0f, 100, default, 2f); Main.dust[Bigdust].noGravity = true; } CalamityUtils.HomeInOnNPC(Projectile, true, 250f, 8f, 20f); Projectile.rotation += 0.3f * (float)Projectile.direction; } public override bool PreDraw(ref Color lightColor) { CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 180); } } }