using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class SunlightBlade : ModProjectile { public override void SetStaticDefaults() { DisplayName.SetDefault("Blade"); ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; ProjectileID.Sets.TrailingMode[projectile.type] = 0; } public override void SetDefaults() { projectile.width = 50; projectile.height = 50; projectile.aiStyle = 18; projectile.alpha = 100; projectile.friendly = true; projectile.tileCollide = false; projectile.melee = true; projectile.penetrate = 5; projectile.timeLeft = 180; projectile.ignoreWater = true; aiType = 274; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 3; } public override void AI() { Lighting.AddLight(projectile.Center, 0.25f, 0.25f, 0f); } public override Color? GetAlpha(Color lightColor) { if (projectile.timeLeft < 85) { byte b2 = (byte)(projectile.timeLeft * 3); byte a2 = (byte)(100f * ((float)b2 / 255f)); return new Color((int)b2, (int)b2, (int)b2, (int)a2); } return new Color(255, 255, 255, 100); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 300); } } }