using Terraria; using Terraria.ModLoader; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Projectiles.Rogue { public class HoneycombFragment : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; public override void SetDefaults() { Projectile.friendly = true; Projectile.width = 14; Projectile.height = 14; Projectile.DamageType = RogueDamageClass.Instance; } public override bool PreDraw(ref Color lightColor) { //Changes the texture of the projectile if (Projectile.ai[0] == 1f) { Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Rogue/HoneycombFragment2").Value; Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, 12, 14)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, 20 / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } if (Projectile.ai[0] == 2f) { Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Rogue/HoneycombFragment3").Value; Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, 16, 14)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, 20 / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } return true; } public override void AI() { //Rotation and gravity Projectile.rotation += 0.6f * Projectile.direction; Projectile.velocity.Y = Projectile.velocity.Y + 0.27f; if (Projectile.velocity.Y > 16f) { Projectile.velocity.Y = 16f; } } public override void Kill(int timeLeft) { //Dust effect int splash = 0; while (splash < 4) { Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 9, -Projectile.velocity.X * 0.15f, -Projectile.velocity.Y * 0.10f, 159, default, 0.9f); splash += 1; } } } }