using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class ElementRay : ModProjectile { public override void SetStaticDefaults() { DisplayName.SetDefault("Ray"); } public override void SetDefaults() { projectile.width = 4; projectile.height = 4; projectile.friendly = true; projectile.magic = true; projectile.penetrate = 10; projectile.extraUpdates = 100; projectile.timeLeft = 180; } public override void AI() { projectile.localAI[1] += 1f; if (projectile.localAI[1] >= 22f && projectile.owner == Main.myPlayer) { projectile.localAI[1] = 0f; Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); } projectile.localAI[0] += 1f; if (projectile.localAI[0] > 9f) { for (int num447 = 0; num447 < 3; num447++) { Vector2 vector33 = projectile.position; vector33 -= projectile.velocity * ((float)num447 * 0.25f); projectile.alpha = 255; int num448 = Dust.NewDust(vector33, 1, 1, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.25f); Main.dust[num448].noGravity = true; Main.dust[num448].position = vector33; Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; Main.dust[num448].velocity *= 0.2f; } } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 120); target.AddBuff(ModContent.BuffType(), 120); target.AddBuff(ModContent.BuffType(), 120); target.AddBuff(ModContent.BuffType(), 120); } } }