diff --git a/Items/Weapons/Ranged/HavocsBreath.cs b/Items/Weapons/Ranged/HavocsBreath.cs index 7c5e9546fe..24ef2416fa 100644 --- a/Items/Weapons/Ranged/HavocsBreath.cs +++ b/Items/Weapons/Ranged/HavocsBreath.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.DamageType = DamageClass.Ranged; Item.width = 50; Item.height = 18; - Item.useTime = 9; + Item.useTime = 5; Item.useAnimation = 30; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; @@ -28,13 +28,9 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 8.5f; Item.useAmmo = AmmoID.Gel; + Item.consumeAmmoOnFirstShotOnly = true; } - public override bool CanConsumeAmmo(Item ammo, Player player) => Main.rand.NextBool(); - - public override Vector2? HoldoutOffset() - { - return new Vector2(-10, 0); - } + public override Vector2? HoldoutOffset() => new Vector2(-10, 0); } } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson index ac101f7c9a..43fe750091 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson @@ -116,6 +116,7 @@ AuroraBlazer: { Tooltip: ''' Spews astral flames that travel in a star-shaped patterns + Uses gel for ammo 60% chance to save ammo ''' } @@ -142,7 +143,7 @@ BladedgeGreatbow: { BlightSpewer: { DisplayName: Blight Spewer - Tooltip: "" + Tooltip: Uses gel for ammo } BlissfulBombardier: { @@ -222,7 +223,11 @@ ClaretCannon: { CleansingBlaze: { DisplayName: Cleansing Blaze - Tooltip: 50% chance to save ammo + Tooltip: + ''' + Uses gel for ammo + 50% chance to save ammo + ''' } ClockGatlignum: { @@ -349,7 +354,11 @@ DarkechoGreatbow: { DeadSunsWind: { DisplayName: Dead Sun's Wind - Tooltip: 70% chance to save ammo + Tooltip: + ''' + Uses gel for ammo + 70% chance to save ammo + ''' } Deathwind: { @@ -428,6 +437,7 @@ ElementalEruption: { Tooltip: ''' Fires a spread of rainbow flames + Uses gel for ammo 90% chance to save ammo ''' } @@ -551,6 +561,7 @@ HalleysInferno: { ''' Fires a highly concentrated shot of lunar fire Press to zoom out + Uses gel for ammo 50% chance to save ammo 'Halley came sooner than expected' ''' @@ -563,7 +574,7 @@ HandheldTank: { HavocsBreath: { DisplayName: Havoc's Breath - Tooltip: 50% chance to save ammo + Tooltip: Uses gel for ammo } HeavenlyGale: { @@ -699,6 +710,7 @@ Meowthrower: { Tooltip: ''' Fires blue and pink flames that emit meows on enemy hits + Uses gel for ammo 85% chance to save ammo ''' } @@ -808,6 +820,7 @@ OverloadedBlaster: { Tooltip: ''' Fires a large spread of bouncing slime + Uses gel for ammo 33% chance to save ammo ''' } @@ -852,6 +865,7 @@ Photoviscerator: { ''' Fires a stream of exo flames and light that explodes into homing sparks Press to fire homing flares which stick to enemies and incinerate them + Uses gel for ammo 90% chance to save ammo ''' } @@ -906,6 +920,7 @@ PristineFury: { ''' Fires an intense helix of flames that explode into a column of fire Press to fire a short ranged cloud of lingering flames + Uses gel for ammo ''' } @@ -1011,7 +1026,7 @@ SepticSkewer: { Shadethrower: { DisplayName: Shadethrower - Tooltip: "" + Tooltip: Uses gel for ammo } Shellshooter: { @@ -1058,7 +1073,7 @@ SomaPrime: { SparkSpreader: { DisplayName: Spark Spreader - Tooltip: "" + Tooltip: Uses gel for ammo } SpectralstormCannon: { @@ -1169,7 +1184,11 @@ TelluricGlare: { TerraFlameburster: { DisplayName: Terra Flameburster - Tooltip: 80% chance to save ammo + Tooltip: + ''' + Uses gel for ammo + 80% chance to save ammo + ''' } TheBallista: { diff --git a/Projectiles/Ranged/BrimstoneFireFriendly.cs b/Projectiles/Ranged/BrimstoneFireFriendly.cs index 5944635129..8631d6af51 100644 --- a/Projectiles/Ranged/BrimstoneFireFriendly.cs +++ b/Projectiles/Ranged/BrimstoneFireFriendly.cs @@ -1,5 +1,8 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged @@ -7,81 +10,126 @@ namespace CalamityMod.Projectiles.Ranged public class BrimstoneFireFriendly : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override string Texture => "CalamityMod/Projectiles/FireProj"; + + public static int Lifetime => 90; + public static int Fadetime => 80; + public ref float Time => ref Projectile.ai[0]; + public int MistType = -1; public override void SetDefaults() { - Projectile.width = 6; - Projectile.height = 6; + Projectile.width = Projectile.height = 10; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = -1; - Projectile.extraUpdates = 3; - Projectile.timeLeft = 90; + Projectile.MaxUpdates = 3; + Projectile.timeLeft = Lifetime; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 8; } public override void AI() { - Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.25f / 255f, (255 - Projectile.alpha) * 0.05f / 255f, (255 - Projectile.alpha) * 0.05f / 255f); - if (Projectile.timeLeft > 90) + Time++; + if (Time < Fadetime && Main.rand.NextBool(6)) { - Projectile.timeLeft = 90; + Vector2 cinderPos = Projectile.Center + Main.rand.NextVector2Circular(60f, 60f) * Utils.Remap(Time, 0f, Lifetime, 0.5f, 1f); + float cinderSize = Utils.GetLerpValue(6f, 12f, Time, true); + Dust cinder = Dust.NewDustDirect(cinderPos, 4, 4, ModContent.DustType(), Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f); + if (Main.rand.NextBool(3)) + { + cinder.scale *= 2f; + cinder.velocity *= 2f; + } + cinder.noGravity = true; + cinder.scale *= cinderSize * 1.2f; + cinder.velocity += Projectile.velocity * Utils.Remap(Time, 0f, Fadetime * 0.75f, 1f, 0.1f) * Utils.Remap(Time, 0f, Fadetime * 0.1f, 0.1f, 1f); } - if (Projectile.ai[0] > 7f) - { - float num296 = 1f; - if (Projectile.ai[0] == 8f) - { - num296 = 0.25f; - } - else if (Projectile.ai[0] == 9f) - { - num296 = 0.5f; - } - else if (Projectile.ai[0] == 10f) - { - num296 = 0.75f; - } - Projectile.ai[0] += 1f; - int num297 = 235; - if (Main.rand.NextBool()) - { - for (int num298 = 0; num298 < 1; num298++) - { - int num299 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, num297, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); - if (Main.rand.NextBool(3)) - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 3f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X *= 2f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y *= 2f; - } - else - { - Main.dust[num299].scale *= 1.5f; - } - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X *= 1.2f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y *= 1.2f; - Main.dust[num299].scale *= num296; - } - } - } - else - { - Projectile.ai[0] += 1f; - } - Projectile.rotation += 0.3f * (float)Projectile.direction; + + if (MistType == -1) + MistType = Main.rand.Next(3); + + Lighting.AddLight(Projectile.Center, 1f, 0.2f, 0.2f); } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + // Keeping the flames in place when hitting a block + public override bool OnTileCollide(Vector2 oldVelocity) { - target.immune[Projectile.owner] = 7; - target.AddBuff(ModContent.BuffType(), 240); + Projectile.velocity = oldVelocity * 0.95f; + Projectile.position -= Projectile.velocity; + Time++; + Projectile.timeLeft--; + return false; + } + + // Expanding hitbox + public override void ModifyDamageHitbox(ref Rectangle hitbox) + { + int size = (int)Utils.Remap(Time, 0f, Fadetime, 10f, 40f); + + // Shrinks again after fading + if (Time > Fadetime) + size = (int)Utils.Remap(Time, Fadetime, Lifetime, 40f, 0f); + hitbox.Inflate(size, size); + } + + // Anti-wall hacking checks + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => projHitbox.Intersects(targetHitbox) && Collision.CanHit(Projectile.Center, 0, 0, targetHitbox.Center.ToVector2(), 0, 0) ? null : false; + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 240); + + public override bool PreDraw(ref Color lightColor) + { + Texture2D fire = ModContent.Request(Texture).Value; + Texture2D mist = ModContent.Request("CalamityMod/Particles/MediumMist").Value; + + // The conga line of colors to sift through + Color color1 = new Color(255, 110, 100, 200); + Color color2 = new Color(255, 50, 50, 70); + Color color3 = new Color(255, 100, 100, 100); + Color color4 = new Color(200, 35, 30, 100); + float length = ((Time > Fadetime - 10f) ? 0.1f : 0.15f); + float vOffset = Math.Min(Time, 20f); + float timeRatio = Utils.GetLerpValue(0f, Lifetime, Time); + float fireSize = Utils.Remap(timeRatio, 0.2f, 0.5f, 0.25f, 1f); + + if (timeRatio >= 1f) + return false; + + for (float j = 1f; j >= 0f; j -= length) + { + // Color + Color fireColor = ((timeRatio < 0.1f) ? Color.Lerp(Color.Transparent, color1, Utils.GetLerpValue(0f, 0.1f, timeRatio)) : + ((timeRatio < 0.2f) ? Color.Lerp(color1, color2, Utils.GetLerpValue(0.1f, 0.2f, timeRatio)) : + ((timeRatio < 0.35f) ? color2 : + ((timeRatio < 0.7f) ? Color.Lerp(color2, color3, Utils.GetLerpValue(0.35f, 0.7f, timeRatio)) : + ((timeRatio < 0.85f) ? Color.Lerp(color3, color4, Utils.GetLerpValue(0.7f, 0.85f, timeRatio)) : + Color.Lerp(color4, Color.Transparent, Utils.GetLerpValue(0.85f, 1f, timeRatio))))))); + fireColor *= (1f - j) * Utils.GetLerpValue(0f, 0.2f, timeRatio, true); + Color innerColor = Color.Lerp(fireColor, Color.Black, 0.3f); + + // Positions and rotations + Vector2 firePos = Projectile.Center - Main.screenPosition - Projectile.velocity * vOffset * j; + float mainRot = -j * MathHelper.PiOver2 - Main.GlobalTimeWrappedHourly * (j + 1f) * 2f / length; + float trailRot = MathHelper.PiOver4 - mainRot; + + // Draw one backtrail + Vector2 trailOffset = Projectile.velocity * vOffset * length * 0.5f; + Main.EntitySpriteDraw(fire, firePos - trailOffset, null, innerColor * 0.25f, trailRot, fire.Size() * 0.5f, fireSize, SpriteEffects.None); + + // Draw the main fire + Main.EntitySpriteDraw(fire, firePos, null, innerColor, mainRot, fire.Size() * 0.5f, fireSize, SpriteEffects.None); + + // Draw the masking smoke + Main.spriteBatch.SetBlendState(BlendState.Additive); + Rectangle frame = mist.Frame(1, 3, 0, MistType); + Main.EntitySpriteDraw(mist, firePos, frame, Color.Lerp(fireColor, Color.White, 0.3f), mainRot, frame.Size() * 0.5f, fireSize, SpriteEffects.None); + Main.EntitySpriteDraw(mist, firePos, frame, fireColor, mainRot, frame.Size() * 0.5f, fireSize * 3f, SpriteEffects.None); + Main.spriteBatch.SetBlendState(BlendState.AlphaBlend); + } + return false; } } } diff --git a/Projectiles/Ranged/EssenceFire.cs b/Projectiles/Ranged/EssenceFire.cs index d8374a8ff4..2be009ff56 100644 --- a/Projectiles/Ranged/EssenceFire.cs +++ b/Projectiles/Ranged/EssenceFire.cs @@ -86,6 +86,7 @@ namespace CalamityMod.Projectiles.Ranged } Projectile.velocity = oldVelocity * 0.95f; Projectile.position -= Projectile.velocity; + Time += 2; Projectile.timeLeft -= 2; spawnParticles = false; return false; diff --git a/Projectiles/Ranged/SparkSpreaderFire.cs b/Projectiles/Ranged/SparkSpreaderFire.cs index 96ba7941f3..1607b2b872 100644 --- a/Projectiles/Ranged/SparkSpreaderFire.cs +++ b/Projectiles/Ranged/SparkSpreaderFire.cs @@ -1,4 +1,5 @@ -using CalamityMod.Particles; +using CalamityMod.Dusts; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -40,19 +41,18 @@ namespace CalamityMod.Projectiles.Ranged if (Time >= 8f) { float cinderSize = Utils.GetLerpValue(6f, 12f, Time, true); - Dust cinder = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, 6, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 10, default, 0.75f); + Dust cinder = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 10, default, 0.75f); if (Main.rand.NextBool(3)) { cinder.scale *= 3f; cinder.velocity *= 1.5f; } cinder.noGravity = true; - cinder.velocity *= 1.2f; - cinder.scale *= cinderSize * 0.5f; + cinder.scale *= cinderSize * 0.8f; cinder.velocity += Projectile.velocity; } - else if (Time == 7f) // Create sparks around the tip - SpawnSparks(2); + else if (Time == 7f && !Main.rand.NextBool(4)) // Create short sparks around the tip at a pretty high chance + SpawnSparks(3, true); } // On-impact sparks @@ -74,7 +74,7 @@ namespace CalamityMod.Projectiles.Ranged SpawnSparks(5); } - public void SpawnSparks(int count) + public void SpawnSparks(int count, bool shorts = false) { for (int i = 0; i < count; i++) { @@ -87,7 +87,7 @@ namespace CalamityMod.Projectiles.Ranged Vector2 sparkVelocity = Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(30f)) * Main.rand.NextFloat(1.5f, 3f); sparkVelocity.Y -= Main.rand.NextFloat(6f, 8f); - SparkParticle spark = new SparkParticle(Projectile.Center, sparkVelocity, true, sparkLifetime, sparkScale, sparkColor); + SparkParticle spark = new SparkParticle(Projectile.Center, (sparkVelocity * (shorts ? 0.75f : 1f)), true, sparkLifetime, sparkScale, sparkColor); GeneralParticleHandler.SpawnParticle(spark); } }