using Terraria; using Terraria.ID; using Terraria.ModLoader; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Projectiles.Rogue { public class SphereYellow : ModProjectile { public override void SetStaticDefaults() { DisplayName.SetDefault("Yellow Thruster Sphere"); ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; ProjectileID.Sets.TrailingMode[projectile.type] = 0; } public override void SetDefaults() { projectile.width = 20; projectile.height = 20; projectile.friendly = true; projectile.penetrate = -1; projectile.aiStyle = 3; projectile.timeLeft = 300; aiType = ProjectileID.WoodenBoomerang; projectile.Calamity().rogue = true; } public override void AI() { Lighting.AddLight(projectile.Center, 1f, 1f, 0f); if (Main.rand.NextBool(5)) { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 229, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 100); } if (projectile.ai[0] == 1f) { projectile.extraUpdates = 1; } } public override bool OnTileCollide(Vector2 oldVelocity) { if (projectile.velocity.X != oldVelocity.X) { projectile.velocity.X = -oldVelocity.X; } if (projectile.velocity.Y != oldVelocity.Y) { projectile.velocity.Y = -oldVelocity.Y; } return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { Main.PlaySound(SoundID.NPCHit34, projectile.position); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); return false; } } }