using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Rogue { public class TheSyringeProj : ModProjectile { public override void SetStaticDefaults() { DisplayName.SetDefault("Syringe"); } public override void SetDefaults() { projectile.width = 10; projectile.height = 10; projectile.light = 0.5f; projectile.extraUpdates = 1; projectile.friendly = true; projectile.Calamity().rogue = true; projectile.ignoreWater = true; projectile.aiStyle = 1; aiType = 242; projectile.penetrate = 1; projectile.timeLeft = 600; } public override void AI() { if (Main.rand.Next(8) == 0) { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, Main.rand.Next(2) == 1 ? 107 : 89, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } projectile.damage += projectile.Calamity().defDamage / 200; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 600); } public override void Kill(int timeLeft) { projectile.position = projectile.Center; projectile.width = projectile.height = 100; projectile.position.X = projectile.position.X - (float)(projectile.width / 2); projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); projectile.maxPenetrate = -1; projectile.penetrate = -1; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 10; projectile.Damage(); Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 107); for (int k = 0; k < 7; k++) { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 89, projectile.oldVelocity.X, projectile.oldVelocity.Y); } int num251 = Main.rand.Next(1, 3); if (projectile.owner == Main.myPlayer) { for (int num252 = 0; num252 < num251; num252++) { Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); while (value15.X == 0f && value15.Y == 0f) { value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); } value15.Normalize(); value15 *= (float)Main.rand.Next(70, 101) * 0.1f; Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.5), 0f, Main.myPlayer, 0f, 0f); } for (int index = 0; index < 2; ++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.Center.X + SpeedX, projectile.Center.Y + SpeedY, SpeedX, SpeedY, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.25), 0f, Main.myPlayer, Main.rand.Next(3), 0f); } } if (projectile.owner == Main.myPlayer && projectile.ai[1] == 1) { int num3; for (int num639 = 0; num639 < 5; num639 = num3 + 1) { float speedX = (float)Main.rand.Next(-35, 36) * 0.02f; float speedY = (float)Main.rand.Next(-35, 36) * 0.02f; int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, speedX, speedY, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.5), 0f, Main.myPlayer, 0f, 0f); Main.projectile[proj].penetrate = 1; num3 = num639; } } } } }