using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class IcicleArrowProj : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; public override string Texture => "CalamityMod/Items/Ammo/IcicleArrow"; public override void SetDefaults() { Projectile.width = 10; Projectile.height = 10; Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.arrow = true; Projectile.coldDamage = true; Projectile.penetrate = 1; Projectile.extraUpdates = 1; Projectile.coldDamage = true; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() { //icicle dust if (Main.rand.NextBool(2)) { int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 68, Projectile.velocity.X, Projectile.velocity.Y, 0, default, 1.1f); Main.dust[index2].noGravity = true; } Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(BuffID.Frostburn2, 180); } public override void Kill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item27, Projectile.position); for (int index1 = 0; index1 < 5; ++index1) { int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 68, 0f, 0f, 0, new Color(), 1f); Main.dust[index2].noGravity = true; Main.dust[index2].velocity *= 1.5f; Main.dust[index2].scale *= 0.9f; } if (Projectile.owner == Main.myPlayer) { for (int index = 0; index < 3; ++index) { float SpeedX = -Projectile.velocity.X * Main.rand.Next(40, 70) * 0.01f + Main.rand.Next(-20, 21) * 0.4f; float SpeedY = -Projectile.velocity.Y * Main.rand.Next(40, 70) * 0.01f + Main.rand.Next(-20, 21) * 0.4f; Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X + SpeedX, Projectile.Center.Y + SpeedY, SpeedX, SpeedY, ProjectileID.CrystalShard, Projectile.damage / 3, 0f, Projectile.owner); } } } } }