using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { public class MarkRound : ModProjectile { public override string Texture => "CalamityMod/Projectiles/LaserProj"; public override void SetStaticDefaults() { DisplayName.SetDefault("Laser"); } public override void SetDefaults() { projectile.width = 5; projectile.height = 5; projectile.friendly = true; projectile.alpha = 255; projectile.penetrate = 1; projectile.extraUpdates = 2; projectile.timeLeft = 300; } public override void AI() { if (projectile.alpha > 0) { projectile.alpha -= 25; } if (projectile.alpha < 0) { projectile.alpha = 0; } Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0.5f, 0f, 0.7f); float num55 = 30f; float num56 = 2f; if (projectile.ai[1] == 0f) { projectile.localAI[0] += num56; if (projectile.localAI[0] > num55) { projectile.localAI[0] = num55; } } else { projectile.localAI[0] -= num56; if (projectile.localAI[0] <= 0f) { projectile.Kill(); } } } public override Color? GetAlpha(Color lightColor) => new Color(200, 0, 250, 0); public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(30f, 2f, lightColor); public override void Kill(int timeLeft) { int dustAmt = Main.rand.Next(3, 7); for (int d = 0; d < dustAmt; d++) { int purple = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, 173, 0f, 0f, 100, default, 2.1f); Main.dust[purple].velocity *= 2f; Main.dust[purple].noGravity = true; } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 300); } public override void OnHitPvp(Player target, int damage, bool crit) { target.AddBuff(ModContent.BuffType(), 300); } } }