diff --git a/ExtraTextures/LineFade.png b/ExtraTextures/LineFade.png new file mode 100644 index 0000000000..2fbccf4dac Binary files /dev/null and b/ExtraTextures/LineFade.png differ diff --git a/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs b/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs index 9455c06678..14e3fc9aee 100644 --- a/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs +++ b/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs @@ -11,6 +11,8 @@ using Terraria.ID; using Terraria.ModLoader; using System.IO; using Terraria.Audio; +using CalamityMod.Particles; +using Steamworks; namespace CalamityMod.NPCs.SupremeCalamitas { @@ -22,6 +24,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas public Player Target => Main.player[NPC.target]; public Vector2 EyePosition => NPC.Center + new Vector2(NPC.spriteDirection == -1 ? 40f : -36f, 16f); + public Vector2 ProjPosition; public ref float RotationalDegreeOffset => ref NPC.ai[1]; @@ -149,18 +152,60 @@ namespace CalamityMod.NPCs.SupremeCalamitas } if (Main.netMode != NetmodeID.MultiplayerClient) { + float targetDist = Vector2.Distance(Target.Center, ProjPosition); int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); if (BossRushEvent.BossRushActive) damage /= 2; - Vector2 shootVelocity = (Target.Center - EyePosition).SafeNormalize(Vector2.UnitY) * 9f; - Projectile.NewProjectile(NPC.GetSource_FromAI(), EyePosition, shootVelocity, type, damage, 1f, Main.myPlayer); + Vector2 shootVelocity = (Target.Center - ProjPosition).SafeNormalize(Vector2.UnitY) * 5f; + if (targetDist <= 160 || targetDist >= 1952) + { + for (int i = 0; i < 10; i++) + { + Dust failShotDust = Dust.NewDustPerfect(ProjPosition, 114); + failShotDust.noGravity = true; + failShotDust.velocity = new Vector2(3, 3).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.3f); + failShotDust.scale = Main.rand.NextFloat(1.3f, 2.4f); + } + } + else + { + Projectile.NewProjectile(NPC.GetSource_FromAI(), ProjPosition, shootVelocity, type, damage, 1f, Main.myPlayer, 0, 0, 2); + for (int i = 0; i < 5; i++) + { + Dust ShotDust = Dust.NewDustPerfect(ProjPosition, 114); + ShotDust.noGravity = true; + ShotDust.velocity = shootVelocity.RotatedByRandom(1f) * Main.rand.NextFloat(2.2f, 3.8f); + ShotDust.scale = Main.rand.NextFloat(1.8f, 2.1f); + } + } } timer = 0; NPC.netUpdate = true; } + if (timer == shootRate - 35) + { + ProjPosition = NPC.Center; - NPC.position = SCal.Center - MathHelper.ToRadians(RotationalDegreeOffset).ToRotationVector2() * 300f - NPC.Size * 0.5f; + Particle pulse = new StaticPulseRing(NPC.Center, Vector2.Zero, Color.Red * 2.5f, new Vector2(2f, 2f), 0, 0.03f, 0.005f, 45); + GeneralParticleHandler.SpawnParticle(pulse); + for (int i = 0; i < 4; i++) + { + Dust prepShotDust = Dust.NewDustPerfect(NPC.Center, 182); + prepShotDust.noGravity = true; + prepShotDust.velocity = new Vector2(3, 3).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.3f); + prepShotDust.scale = Main.rand.NextFloat(1.3f, 2.4f); + } + } + if (timer >= shootRate - 35) + { + Dust prepShotDust = Dust.NewDustPerfect(ProjPosition, 182); + prepShotDust.noGravity = true; + prepShotDust.velocity = new Vector2(3, 3).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 0.8f); + prepShotDust.scale = Main.rand.NextFloat(1.2f, 1.9f); + } + + NPC.position = SCal.Center - MathHelper.ToRadians(RotationalDegreeOffset).ToRotationVector2() * 300f - NPC.Size * 0.5f; RotationalDegreeOffset += 0.5f; } @@ -218,6 +263,17 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { + Texture2D lineTex = ModContent.Request("CalamityMod/ExtraTextures/LineFade").Value; + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + int shootRate = BossRushEvent.BossRushActive ? 144 : 216; + float opacity = timer >= shootRate - 35 ? (timer - (BossRushEvent.BossRushActive ? 101 : 181)) * 0.03f : 0; + Vector2 lineDir = (ProjPosition - Target.Center).SafeNormalize(Vector2.UnitY); + Vector2 linePos = (lineDir * (lineTex.Height * 0.25f)) + ProjPosition - Main.screenPosition; + spriteBatch.Draw(lineTex, linePos, null, Color.Red * opacity, lineDir.ToRotation(), lineTex.Size(), NPC.scale * 1.1f, SpriteEffects.None, 0f); + Main.spriteBatch.End(); + Main.spriteBatch.Begin(); + SpriteEffects spriteEffects = SpriteEffects.None; if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index d0ada4a1cd..b7ffbfb0f8 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -39,6 +39,10 @@ using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; using Terraria.GameContent.ItemDropRules; +using ReLogic.Utilities; +using CalamityMod.Projectiles.Ranged; +using Steamworks; +using CalamityMod.Particles; namespace CalamityMod.NPCs.SupremeCalamitas { @@ -192,6 +196,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas public static readonly SoundStyle DashSound = new("CalamityMod/Sounds/Custom/SCalSounds/SCalDash"); public static readonly SoundStyle HellblastSound = new("CalamityMod/Sounds/Custom/SCalSounds/BrimstoneHellblastSound"); public static readonly SoundStyle HurtSound = new("CalamityMod/Sounds/NPCHit/ShieldHit", 3); + public static readonly SoundStyle BulletHellSound = new("CalamityMod/Sounds/Custom/SCalSounds/SCalRumble"); + public static readonly SoundStyle BulletHellEndSound = new("CalamityMod/Sounds/Custom/SCalSounds/SCalEndBH"); + public SlotId BulletHellRumbleSlot; // TODO -- This is cumbersome. Change it to be better in 1.4. internal static void LoadHeadIcons() @@ -853,7 +860,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas } #endregion #region SecondAttack - if (bulletHellCounter2 < SecondBulletHellEndValue && startSecondAttack) + if (bulletHellCounter2 < SecondBulletHellEndValue && startSecondAttack) // Bullet hell lasts 1800 { despawnProj = true; bulletHellCounter2++; @@ -861,6 +868,35 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.chaseable = false; NPC.dontTakeDamage = true; + #region BulletHellEndTelegraphBH2 + if (bulletHellCounter2 == (SecondBulletHellEndValue - 360)) + BulletHellRumbleSlot = SoundEngine.PlaySound(BulletHellSound, player.Center); + if (bulletHellCounter2 > (SecondBulletHellEndValue - 360)) + { + if (SoundEngine.TryGetActiveSound(BulletHellRumbleSlot, out var BHSound) && BHSound.IsPlaying) + { + BHSound.Position = player.MountedCenter; + } + } + if (bulletHellCounter2 == SecondBulletHellEndValue) + { + for (int i = 0; i < 100; i++) + { + Vector2 dustVel = new Vector2(15, 15).RotatedByRandom(100); + Dust failShotDust = Dust.NewDustPerfect(NPC.Center + dustVel * 3, Main.rand.NextBool(3) ? 60 : 114); + failShotDust.noGravity = true; + failShotDust.velocity = dustVel * Main.rand.NextFloat(0.3f, 1.3f); + failShotDust.scale = Main.rand.NextFloat(2f, 3.2f); + } + Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, Color.Red, new Vector2(1f, 1f), 0, 0.1f, 5f, 15); + GeneralParticleHandler.SpawnParticle(pulse); + Particle pulse2 = new DirectionalPulseRing(NPC.Center, Vector2.Zero, Color.Red, new Vector2(1f, 1f), 0, 0.05f, 4f, 18); + GeneralParticleHandler.SpawnParticle(pulse2); + + SoundEngine.PlaySound(BulletHellEndSound, NPC.Center); + } + #endregion + if (!canDespawn) NPC.velocity *= 0.95f; @@ -963,6 +999,35 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.chaseable = false; NPC.dontTakeDamage = true; + #region BulletHellEndTelegraphBH3 + if (bulletHellCounter2 == (ThirdBulletHellEndValue - 360)) + BulletHellRumbleSlot = SoundEngine.PlaySound(BulletHellSound, player.Center); + if (bulletHellCounter2 > (ThirdBulletHellEndValue - 360)) + { + if (SoundEngine.TryGetActiveSound(BulletHellRumbleSlot, out var BHSound) && BHSound.IsPlaying) + { + BHSound.Position = player.MountedCenter; + } + } + if (bulletHellCounter2 == ThirdBulletHellEndValue) + { + for (int i = 0; i < 100; i++) + { + Vector2 dustVel = new Vector2(15, 15).RotatedByRandom(100); + Dust failShotDust = Dust.NewDustPerfect(NPC.Center + dustVel * 3, Main.rand.NextBool(3) ? 60 : 114); + failShotDust.noGravity = true; + failShotDust.velocity = dustVel * Main.rand.NextFloat(0.3f, 1.3f); + failShotDust.scale = Main.rand.NextFloat(2f, 3.2f); + } + Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, Color.Red, new Vector2(1f, 1f), 0, 0.1f, 5f, 15); + GeneralParticleHandler.SpawnParticle(pulse); + Particle pulse2 = new DirectionalPulseRing(NPC.Center, Vector2.Zero, Color.Red, new Vector2(1f, 1f), 0, 0.05f, 4f, 18); + GeneralParticleHandler.SpawnParticle(pulse2); + + SoundEngine.PlaySound(BulletHellEndSound, NPC.Center); + } + #endregion + if (cirrus) { Vector2 destination = player.Center; @@ -1059,6 +1124,35 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.chaseable = false; NPC.dontTakeDamage = true; + #region BulletHellEndTelegraphBH4 + if (bulletHellCounter2 == (FourthBulletHellEndValue - 360)) + BulletHellRumbleSlot = SoundEngine.PlaySound(BulletHellSound, player.Center); + if (bulletHellCounter2 > (FourthBulletHellEndValue - 360)) + { + if (SoundEngine.TryGetActiveSound(BulletHellRumbleSlot, out var BHSound) && BHSound.IsPlaying) + { + BHSound.Position = player.MountedCenter; + } + } + if (bulletHellCounter2 == FourthBulletHellEndValue) + { + for (int i = 0; i < 100; i++) + { + Vector2 dustVel = new Vector2(15, 15).RotatedByRandom(100); + Dust failShotDust = Dust.NewDustPerfect(NPC.Center + dustVel * 3, Main.rand.NextBool(3) ? 60 : 114); + failShotDust.noGravity = true; + failShotDust.velocity = dustVel * Main.rand.NextFloat(0.3f, 1.3f); + failShotDust.scale = Main.rand.NextFloat(2f, 3.2f); + } + Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, Color.Red, new Vector2(1f, 1f), 0, 0.1f, 5f, 15); + GeneralParticleHandler.SpawnParticle(pulse); + Particle pulse2 = new DirectionalPulseRing(NPC.Center, Vector2.Zero, Color.Red, new Vector2(1f, 1f), 0, 0.05f, 4f, 18); + GeneralParticleHandler.SpawnParticle(pulse2); + + SoundEngine.PlaySound(BulletHellEndSound, NPC.Center); + } + #endregion + if (!canDespawn) NPC.velocity *= 0.95f; @@ -1160,6 +1254,35 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.chaseable = false; NPC.dontTakeDamage = true; + #region BulletHellEndTelegraphBH5 + if (bulletHellCounter2 == (FifthBulletHellEndValue - 360)) + BulletHellRumbleSlot = SoundEngine.PlaySound(BulletHellSound, player.Center); + if (bulletHellCounter2 > (FifthBulletHellEndValue - 360)) + { + if (SoundEngine.TryGetActiveSound(BulletHellRumbleSlot, out var BHSound) && BHSound.IsPlaying) + { + BHSound.Position = player.MountedCenter; + } + } + if (bulletHellCounter2 == FifthBulletHellEndValue) + { + for (int i = 0; i < 100; i++) + { + Vector2 dustVel = new Vector2(15, 15).RotatedByRandom(100); + Dust failShotDust = Dust.NewDustPerfect(NPC.Center + dustVel * 3, Main.rand.NextBool(3) ? 60 : 114); + failShotDust.noGravity = true; + failShotDust.velocity = dustVel * Main.rand.NextFloat(0.3f, 1.3f); + failShotDust.scale = Main.rand.NextFloat(2f, 3.2f); + } + Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, Color.Red, new Vector2(1f, 1f), 0, 0.1f, 5f, 15); + GeneralParticleHandler.SpawnParticle(pulse); + Particle pulse2 = new DirectionalPulseRing(NPC.Center, Vector2.Zero, Color.Red, new Vector2(1f, 1f), 0, 0.05f, 4f, 18); + GeneralParticleHandler.SpawnParticle(pulse2); + + SoundEngine.PlaySound(BulletHellEndSound, NPC.Center); + } + #endregion + if (cirrus) { Vector2 destination = player.Center; diff --git a/Particles/BloomParticle.cs b/Particles/BloomParticle.cs new file mode 100644 index 0000000000..5a788818cf --- /dev/null +++ b/Particles/BloomParticle.cs @@ -0,0 +1,53 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; +using static CalamityMod.CalamityUtils; + +namespace CalamityMod.Particles +{ + public class BloomParticle : Particle + { + public override string Texture => "CalamityMod/Particles/BloomCircle"; + public override bool UseAdditiveBlend => true; + public override bool SetLifetime => true; + public override bool UseCustomDraw => true; + + private float OriginalScale; + private float FinalScale; + private float opacity; + private Color BaseColor; + private bool Fade; + + public BloomParticle(Vector2 position, Vector2 velocity, Color color, float originalScale, float finalScale, int lifeTime, bool fade = true) + { + Position = position; + Velocity = velocity; + BaseColor = color; + OriginalScale = originalScale; + FinalScale = finalScale; + Scale = originalScale; + Lifetime = lifeTime; + Fade = fade; + } + + public override void Update() + { + float pulseProgress = PiecewiseAnimation(LifetimeCompletion, new CurveSegment[] { new CurveSegment(EasingType.PolyOut, 0f, 0f, 1f, 4) }); + Scale = MathHelper.Lerp(OriginalScale, FinalScale, pulseProgress); + if (Fade) + opacity = (float)Math.Sin(MathHelper.PiOver2 + LifetimeCompletion * MathHelper.PiOver2); + + Color = BaseColor * (Fade ? opacity : 1); + Lighting.AddLight(Position, Color.R / 255f, Color.G / 255f, Color.B / 255f); + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Texture2D tex = ModContent.Request(Texture).Value; + spriteBatch.Draw(tex, Position - Main.screenPosition, null, Color * (Fade ? opacity : 1), 0, tex.Size() / 2f, Scale, SpriteEffects.None, 0); + } + + } +} diff --git a/Projectiles/Boss/BrimstoneBarrage.cs b/Projectiles/Boss/BrimstoneBarrage.cs index 87d5eba4d6..64758f9706 100644 --- a/Projectiles/Boss/BrimstoneBarrage.cs +++ b/Projectiles/Boss/BrimstoneBarrage.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.NPCs; using CalamityMod.NPCs.CalClone; @@ -78,6 +79,19 @@ namespace CalamityMod.Projectiles.Boss Projectile.velocity *= scaleFactor; } } + if (Projectile.ai[2] == 2f) + { + if (Projectile.timeLeft > 660) + Projectile.velocity *= 1.02f; + Projectile.scale = 0.8f; + if (Projectile.timeLeft % 3 == 0) + { + Dust trailDust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(5, 5), 182); + trailDust.noGravity = true; + trailDust.velocity = (-Projectile.velocity * 0.5f) * Main.rand.NextFloat(0.1f, 0.9f); + trailDust.scale = Main.rand.NextFloat(0.5f, 0.8f); + } + } if (Projectile.localAI[0] == 0f) { diff --git a/Projectiles/Boss/SCalBrimstoneFireblast.cs b/Projectiles/Boss/SCalBrimstoneFireblast.cs index e47e4e401c..1246843935 100644 --- a/Projectiles/Boss/SCalBrimstoneFireblast.cs +++ b/Projectiles/Boss/SCalBrimstoneFireblast.cs @@ -11,6 +11,8 @@ using Terraria.ID; using Terraria.Audio; using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.NPCs; +using static Humanizer.In; +using CalamityMod.Particles; namespace CalamityMod.Projectiles.Boss { @@ -18,6 +20,8 @@ namespace CalamityMod.Projectiles.Boss { public new string LocalizationCategory => "Projectiles.Boss"; public static readonly SoundStyle ImpactSound = new("CalamityMod/Sounds/Custom/SCalSounds/BrimstoneFireblastImpact"); + public bool withinRange = false; + public bool setLifetime = false; public override void SetStaticDefaults() { Main.projFrames[Projectile.type] = 5; @@ -33,6 +37,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.penetrate = 1; Projectile.Opacity = 0f; Projectile.timeLeft = 150; + Projectile.tileCollide = false; CooldownSlot = ImmunityCooldownID.Bosses; } @@ -51,10 +56,13 @@ namespace CalamityMod.Projectiles.Boss Lighting.AddLight(Projectile.Center, 0.9f * Projectile.Opacity, 0f, 0f); - if (Projectile.ai[1] == 1f) - Projectile.Opacity = MathHelper.Clamp(Projectile.timeLeft / 60f, 0f, 1f); - else - Projectile.Opacity = MathHelper.Clamp(1f - ((Projectile.timeLeft - 90) / 60f), 0f, 1f); + if (!withinRange) + { + if (Projectile.ai[1] == 1f) + Projectile.Opacity = MathHelper.Clamp(Projectile.timeLeft / 60f, 0f, 1f); + else + Projectile.Opacity = MathHelper.Clamp(1f - ((Projectile.timeLeft - 90) / 60f), 0f, 1f); + } Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; @@ -64,24 +72,80 @@ namespace CalamityMod.Projectiles.Boss SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); } - float inertia = revenge ? 80f : 100f; - float homeSpeed = revenge ? 20f : 15f; - float minDist = 40f; int target = (int)Projectile.ai[0]; - if (target >= 0 && Main.player[target].active && !Main.player[target].dead) + + if (!withinRange) { - if (Projectile.Distance(Main.player[target].Center) > minDist) + float inertia = revenge ? 80f : 100f; + float homeSpeed = revenge ? 20f : 15f; + float minDist = 40f; + if (target >= 0 && Main.player[target].active && !Main.player[target].dead) { - Vector2 moveDirection = Projectile.SafeDirectionTo(Main.player[target].Center, Vector2.UnitY); - Projectile.velocity = (Projectile.velocity * (inertia - 1f) + moveDirection * homeSpeed) / inertia; + if (Projectile.Distance(Main.player[target].Center) > minDist) + { + Vector2 moveDirection = Projectile.SafeDirectionTo(Main.player[target].Center, Vector2.UnitY); + Projectile.velocity = (Projectile.velocity * (inertia - 1f) + moveDirection * homeSpeed) / inertia; + } + } + else + { + if (Projectile.ai[0] != -1f) + { + Projectile.ai[0] = -1f; + Projectile.netUpdate = true; + } } } - else + + float targetDist = Vector2.Distance(Main.player[target].Center, Projectile.Center); + if (targetDist < 640 && Main.rand.NextBool() && Projectile.Opacity == 1f && !withinRange) { - if (Projectile.ai[0] != -1f) + for (int i = 0; i < (6 - (int)(targetDist * 0.01f)); i++) { - Projectile.ai[0] = -1f; - Projectile.netUpdate = true; + Dust failShotDust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(3) ? 60 : 114); + failShotDust.noGravity = true; + failShotDust.velocity = new Vector2(4, 4).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.3f); + failShotDust.scale = Main.rand.NextFloat(0.2f, 0.8f) * (6 - targetDist * 0.01f); + } + } + if ((Projectile.timeLeft == 1 && !withinRange) || (targetDist < 160 && Projectile.Opacity == 1f)) // When within 12 blocks of player or when it runs out of time + { + if (!setLifetime) + { + Projectile.timeLeft = 60; + setLifetime = true; + } + withinRange = true; + } + if (withinRange) + { + Projectile.velocity *= 0.95f; + for (int i = 0; i < 2; i++) + { + Dust failShotDust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(3) ? 60 : 114); + failShotDust.noGravity = true; + failShotDust.velocity = new Vector2(4, 4).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.3f); + failShotDust.scale = Main.rand.NextFloat(0.7f, 1.8f); + } + if (Projectile.timeLeft <= 40) + { + if (Projectile.Opacity > 0) + Projectile.Opacity -= 0.05f; + } + if (Projectile.timeLeft == 30) + { + Projectile.Opacity = 0; + Projectile.velocity *= 0; + for (int i = 0; i < 3; i++) + { + Particle bloom = new BloomParticle(Projectile.Center, Vector2.Zero, Color.Red, 0.1f, 0.8f, 30, false); + GeneralParticleHandler.SpawnParticle(bloom); + } + } + if (Projectile.timeLeft == 15) + { + Particle bloom = new BloomParticle(Projectile.Center, Vector2.Zero, Color.White, 0.1f, 0.6f, 15, false); + GeneralParticleHandler.SpawnParticle(bloom); } } } @@ -133,7 +197,7 @@ namespace CalamityMod.Projectiles.Boss int totalProjectiles = bossRush ? 20 : death ? 16 : revenge ? 14 : expertMode ? 12 : 8; float radians = MathHelper.TwoPi / totalProjectiles; int type = ModContent.ProjectileType(); - float velocity = 7f; + float velocity = 8f; Vector2 spinningPoint = new Vector2(0f, -velocity); for (int k = 0; k < totalProjectiles; k++) { diff --git a/Projectiles/Boss/SCalBrimstoneGigablast.cs b/Projectiles/Boss/SCalBrimstoneGigablast.cs index 2d9a1cf7df..ef1864acce 100644 --- a/Projectiles/Boss/SCalBrimstoneGigablast.cs +++ b/Projectiles/Boss/SCalBrimstoneGigablast.cs @@ -11,6 +11,7 @@ using Terraria.ID; using Terraria.Audio; using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.NPCs; +using CalamityMod.Particles; namespace CalamityMod.Projectiles.Boss { @@ -18,7 +19,8 @@ namespace CalamityMod.Projectiles.Boss { public new string LocalizationCategory => "Projectiles.Boss"; public static readonly SoundStyle ImpactSound = new("CalamityMod/Sounds/Custom/SCalSounds/BrimstoneGigablastImpact"); - + public bool withinRange = false; + public bool setLifetime = false; public override void SetStaticDefaults() { Main.projFrames[Projectile.type] = 6; @@ -34,6 +36,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.penetrate = 1; Projectile.timeLeft = 120; Projectile.Opacity = 0f; + Projectile.tileCollide = false; CooldownSlot = ImmunityCooldownID.Bosses; } @@ -48,10 +51,13 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.frame > 5) Projectile.frame = 0; - if (Projectile.ai[1] == 1f) - Projectile.Opacity = MathHelper.Clamp(Projectile.timeLeft / 60f, 0f, 1f); - else - Projectile.Opacity = MathHelper.Clamp(1f - ((Projectile.timeLeft - 60) / 60f), 0f, 1f); + if (!withinRange) + { + if (Projectile.ai[1] == 1f) + Projectile.Opacity = MathHelper.Clamp(Projectile.timeLeft / 60f, 0f, 1f); + else + Projectile.Opacity = MathHelper.Clamp(1f - ((Projectile.timeLeft - 60) / 60f), 0f, 1f); + } Lighting.AddLight(Projectile.Center, 0.9f * Projectile.Opacity, 0f, 0f); @@ -64,13 +70,69 @@ namespace CalamityMod.Projectiles.Boss } int target = Player.FindClosest(Projectile.Center, 1, 1); - float projSpeed = Projectile.velocity.Length(); - Vector2 playerVec = Main.player[target].Center - Projectile.Center; - playerVec.Normalize(); - playerVec *= projSpeed; - Projectile.velocity = (Projectile.velocity * 24f + playerVec) / 25f; - Projectile.velocity.Normalize(); - Projectile.velocity *= projSpeed; + + if (!withinRange) + { + float projSpeed = Projectile.velocity.Length(); + Vector2 playerVec = Main.player[target].Center - Projectile.Center; + playerVec.Normalize(); + playerVec *= projSpeed; + Projectile.velocity = (Projectile.velocity * 24f + playerVec) / 25f; + Projectile.velocity.Normalize(); + Projectile.velocity *= projSpeed; + } + + float targetDist = Vector2.Distance(Main.player[target].Center, Projectile.Center); + if (targetDist < 640 && Main.rand.NextBool() && Projectile.Opacity == 1f && !withinRange) + { + for (int i = 0; i < (6 - (int)(targetDist * 0.01f)); i++) + { + Dust failShotDust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(3) ? 60 : 114); + failShotDust.noGravity = true; + failShotDust.velocity = new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.3f); + failShotDust.scale = Main.rand.NextFloat(0.2f, 0.8f) * (6 - targetDist * 0.01f); + } + } + if ((Projectile.timeLeft == 1 && !withinRange) || (targetDist < 160 && Projectile.Opacity == 1f)) // When within 12 blocks of player or when it runs out of time + { + if (!setLifetime) + { + Projectile.timeLeft = 60; + setLifetime = true; + } + withinRange = true; + } + if (withinRange) + { + Projectile.velocity *= 0.95f; + for (int i = 0; i < 2; i++) + { + Dust failShotDust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(3) ? 60 : 114); + failShotDust.noGravity = true; + failShotDust.velocity = new Vector2(4, 4).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.3f); + failShotDust.scale = Main.rand.NextFloat(0.7f, 1.8f); + } + if (Projectile.timeLeft <= 40) + { + if (Projectile.Opacity > 0) + Projectile.Opacity -= 0.05f; + } + if (Projectile.timeLeft == 30) + { + Projectile.Opacity = 0; + Projectile.velocity *= 0; + for (int i = 0; i < 3; i++) + { + Particle bloom = new BloomParticle(Projectile.Center, Vector2.Zero, Color.Red, 0.1f, 1.1f, 30, false); + GeneralParticleHandler.SpawnParticle(bloom); + } + } + if (Projectile.timeLeft == 15) + { + Particle bloom = new BloomParticle(Projectile.Center, Vector2.Zero, Color.White, 0.1f, 0.9f, 15, false); + GeneralParticleHandler.SpawnParticle(bloom); + } + } } public override bool PreDraw(ref Color lightColor) @@ -120,7 +182,7 @@ namespace CalamityMod.Projectiles.Boss int totalProjectiles = bossRush ? 44 : death ? 36 : revenge ? 32 : expertMode ? 28 : 20; float radians = MathHelper.TwoPi / totalProjectiles; int type = ModContent.ProjectileType(); - float velocity = 5f; + float velocity = 6.5f; Vector2 spinningPoint = new Vector2(0f, -velocity); for (int k = 0; k < totalProjectiles; k++) { diff --git a/Sounds/Custom/SCalSounds/SCalEndBH.ogg b/Sounds/Custom/SCalSounds/SCalEndBH.ogg new file mode 100644 index 0000000000..6c5860b3cb Binary files /dev/null and b/Sounds/Custom/SCalSounds/SCalEndBH.ogg differ diff --git a/Sounds/Custom/SCalSounds/SCalRumble.ogg b/Sounds/Custom/SCalSounds/SCalRumble.ogg new file mode 100644 index 0000000000..0ed9a09f26 Binary files /dev/null and b/Sounds/Custom/SCalSounds/SCalRumble.ogg differ