From a2e7eabb555375c574d2bdfb9182053a0afcab07 Mon Sep 17 00:00:00 2001 From: Xhack <72313282+energykid@users.noreply.github.com> Date: Sun, 28 Jul 2024 00:14:18 -0400 Subject: [PATCH] More projectile changes --- NPCs/Providence/Providence.cs | 32 ++------- Particles/HeavySmoke.cs | 2 +- Projectiles/Boss/HolyBlast.cs | 14 ++-- Projectiles/Boss/HolySpear.cs | 92 ++++++++++++++++++++------ Projectiles/Boss/MoltenBlast.cs | 45 ++++++++----- Projectiles/Boss/MoltenBlob.cs | 92 ++++++++++++++++---------- Projectiles/Boss/MoltenBlob.png | Bin 293 -> 261 bytes Projectiles/Boss/MoltenBlobNight.png | Bin 251 -> 261 bytes Projectiles/Boss/ProfanedSpear.cs | 26 ++++++++ Projectiles/Rogue/MoltenBlobThrown.cs | 7 +- 10 files changed, 202 insertions(+), 108 deletions(-) diff --git a/NPCs/Providence/Providence.cs b/NPCs/Providence/Providence.cs index b5694aee78..1b6e88d5c1 100644 --- a/NPCs/Providence/Providence.cs +++ b/NPCs/Providence/Providence.cs @@ -1250,6 +1250,7 @@ namespace CalamityMod.NPCs.Providence case (int)Phase.FlameCocoon: + Vector2 fireSparklesFrom = fireFrom + new Vector2(0, -30); if (!targetDead && !getFuckedAI) { if (NPC.velocity.Length() <= 2f) @@ -1291,10 +1292,10 @@ namespace CalamityMod.NPCs.Providence projectileType = ModContent.ProjectileType(); dmgAmt = NPC.GetProjectileDamageNoScaling(projectileType); if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom, vector2, projectileType, 0, 0f, Main.myPlayer, 0f, dmgAmt); + Projectile.NewProjectile(NPC.GetSource_FromAI(), fireSparklesFrom, vector2, projectileType, 0, 0f, Main.myPlayer, 0f, dmgAmt); } else if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom, vector2, projectileType, dmgAmt, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), fireSparklesFrom, vector2, projectileType, dmgAmt, 0f, Main.myPlayer); } // Radial offset @@ -1332,29 +1333,10 @@ namespace CalamityMod.NPCs.Providence projectileType = ModContent.ProjectileType(); dmgAmt = NPC.GetProjectileDamageNoScaling(projectileType); if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom, vector2, projectileType, 0, 0f, Main.myPlayer, 0f, dmgAmt); + Projectile.NewProjectile(NPC.GetSource_FromAI(), fireSparklesFrom, vector2, projectileType, 0, 0f, Main.myPlayer, 0f, dmgAmt); } else if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom, vector2, projectileType, dmgAmt, 0f, Main.myPlayer); - - Color dustColor = Main.hslToRgb(Main.rgbToHsl(nightAI ? new Color(100, 200, 250) : (projectileType == ModContent.ProjectileType() ? Color.Orange : Color.Green)).X, 1f, 0.5f); - dustColor.A = 255; - int maxDust = 3; - for (int j = 0; j < maxDust; j++) - { - int dust = Dust.NewDust(fireFrom, 0, 0, DustID.RainbowMk2, 0f, 0f, 0, dustColor, 1f); - Main.dust[dust].position = fireFrom; - Main.dust[dust].velocity = vector2 * cocoonProjVelocity * (j * 0.5f + 1f); - Main.dust[dust].noGravity = true; - Main.dust[dust].scale = 1f + j; - Main.dust[dust].fadeIn = Main.rand.NextFloat() * 2f; - Dust dust2 = Dust.CloneDust(dust); - Dust dust3 = dust2; - dust3.scale /= 2f; - dust3 = dust2; - dust3.fadeIn /= 2f; - dust2.color = new Color(255, 255, 255, 255); - } + Projectile.NewProjectile(NPC.GetSource_FromAI(), fireSparklesFrom, vector2, projectileType, dmgAmt, 0f, Main.myPlayer); } } } @@ -1373,10 +1355,10 @@ namespace CalamityMod.NPCs.Providence } foreach (int t in targets) { - Vector2 velocity2 = Vector2.Normalize(Main.player[t].Center - fireFrom) * cocoonProjVelocity * 1.5f; + Vector2 velocity2 = Vector2.Normalize(Main.player[t].Center - fireSparklesFrom) * cocoonProjVelocity * 1.5f; int type = ModContent.ProjectileType(); if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom, velocity2, type, holyStarDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), fireSparklesFrom, velocity2, type, holyStarDamage, 0f, Main.myPlayer); Color dustColor = Main.hslToRgb(Main.rgbToHsl(nightAI ? new Color(100, 200, 250) : Color.Orange).X, 1f, 0.5f); dustColor.A = 255; diff --git a/Particles/HeavySmoke.cs b/Particles/HeavySmoke.cs index a7fa2365ef..f8ea0115eb 100644 --- a/Particles/HeavySmoke.cs +++ b/Particles/HeavySmoke.cs @@ -66,7 +66,7 @@ namespace CalamityMod.Particles if (AffectedByLight) { - col = Lighting.GetColor((Position / 16).ToPoint()).MultiplyRGBA(col); + col = col.MultiplyRGBA(Lighting.GetColor((Position / 16).ToPoint())); } spriteBatch.Draw(tex, Position - Main.screenPosition, frame, col, Rotation, frame.Size() / 2f, Scale, SpriteEffects.None, 0); diff --git a/Projectiles/Boss/HolyBlast.cs b/Projectiles/Boss/HolyBlast.cs index fac7c1e22b..d4e11dac20 100644 --- a/Projectiles/Boss/HolyBlast.cs +++ b/Projectiles/Boss/HolyBlast.cs @@ -5,6 +5,7 @@ using System.Linq; using CalamityMod.Graphics.Primitives; using CalamityMod.NPCs; using CalamityMod.NPCs.Providence; +using CalamityMod.NPCs.TownNPCs; using CalamityMod.Particles; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -95,10 +96,10 @@ namespace CalamityMod.Projectiles.Boss if (!started) { - for (int i = 0; i < 6; i++) + for (int i = 0; i < 13; i++) { - GeneralParticleHandler.SpawnParticle(new PointParticle(Projectile.Center, Projectile.velocity.RotatedBy(MathHelper.ToRadians(Main.rand.NextFloat(-30f, 30f))) * Main.rand.NextFloat(2.4f, 4.2f), false, 30, Main.rand.NextFloat(3f, 6f), ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 255, false))); - GeneralParticleHandler.SpawnParticle(new SparkParticle(Projectile.Center, Projectile.velocity.RotatedBy(MathHelper.ToRadians(Main.rand.NextFloat(-50f, 50f))) * Main.rand.NextFloat(2.4f, 4.2f), false, 30, Main.rand.NextFloat(2f, 5f), ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 255, false))); + GeneralParticleHandler.SpawnParticle(new PointParticle(Projectile.Center, Projectile.velocity.RotatedBy(MathHelper.ToRadians(Main.rand.NextFloat(-30f, 30f))) * Main.rand.NextFloat(2.4f, 4.2f), false, 15, Main.rand.NextFloat(3f, 6f), ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 255, false))); + GeneralParticleHandler.SpawnParticle(new SparkParticle(Projectile.Center, Projectile.velocity.RotatedBy(MathHelper.ToRadians(Main.rand.NextFloat(-50f, 50f))) * Main.rand.NextFloat(2.4f, 4.2f), false, 15, Main.rand.NextFloat(2f, 5f), ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 255, false))); } started = true; } @@ -120,14 +121,11 @@ namespace CalamityMod.Projectiles.Boss Projectile.localAI[0] = 1f; SoundEngine.PlaySound(ShootSound, Projectile.Center); } - - if (Main.rand.NextBool(3)) - GeneralParticleHandler.SpawnParticle(new SparkParticle(Projectile.Center + Projectile.velocity + new Vector2(Main.rand.NextFloat(-40, 40), 0).RotatedBy(Vector2.Zero.AngleTo(Projectile.velocity.RotatedBy(MathHelper.PiOver2))), Projectile.velocity * Main.rand.NextFloat(-3f, -1f), false, 10, Main.rand.NextFloat(1f, 1.5f), ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 255, false))); - if (Math.Abs(Projectile.velocity.X) > 0.2) Projectile.spriteDirection = -Projectile.direction; - GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center + new Vector2(Main.rand.NextFloat(35), 0).RotatedByRandom(MathHelper.TwoPi), Projectile.velocity.RotatedBy(Math.PI) * 1.6f, false, 10, Main.rand.NextFloat(1f, 2f), ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 255))); + GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center + new Vector2(Main.rand.NextFloat(50), 0).RotatedByRandom(MathHelper.TwoPi), Projectile.velocity.RotatedBy(Math.PI) * 0.6f, false, 20, Main.rand.NextFloat(1f, 2f), ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 255))); + GeneralParticleHandler.SpawnParticle(new MediumMistParticle(Projectile.Center + new Vector2(40, 0).RotatedBy(Vector2.Zero.AngleTo(-Projectile.velocity)) + new Vector2(Main.rand.NextFloat(20), 0).RotatedByRandom(MathHelper.TwoPi), Projectile.velocity.RotatedBy(Math.PI) * 0.6f, Color.LightSlateGray, Color.DarkSlateGray, Main.rand.NextFloat(1f, 3f), 150f)); if (Projectile.velocity.X < 0f) Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X); diff --git a/Projectiles/Boss/HolySpear.cs b/Projectiles/Boss/HolySpear.cs index 697dfa6c2a..df12252236 100644 --- a/Projectiles/Boss/HolySpear.cs +++ b/Projectiles/Boss/HolySpear.cs @@ -4,6 +4,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Events; using CalamityMod.NPCs; using CalamityMod.NPCs.Providence; +using CalamityMod.Particles; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -16,11 +17,12 @@ namespace CalamityMod.Projectiles.Boss public class HolySpear : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Boss"; + Vector2 velocity = Vector2.Zero; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 15; ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } @@ -141,6 +143,51 @@ namespace CalamityMod.Projectiles.Boss Projectile.Opacity = MathHelper.Lerp(240f, 220f, Projectile.timeLeft); Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + bool aimedSpear = Projectile.ai[0] > 0f; + + int red = 255; + int green = 255; + int blue = 0; + switch (Projectile.maxPenetrate) + { + case (int)Providence.BossMode.Red: + red = 255; + green = aimedSpear ? 0 : 125; + blue = aimedSpear ? 0 : 255; + break; + case (int)Providence.BossMode.Orange: + red = 255; + green = 125; + blue = aimedSpear ? 0 : 175; + break; + case (int)Providence.BossMode.Yellow: //Same as day + case (int)Providence.BossMode.Day: + red = 255; + green = aimedSpear ? 255 : 125; + blue = aimedSpear ? 25 : 125; + break; + case (int)Providence.BossMode.Green: + red = 0; + green = 255; + blue = aimedSpear ? 0 : 175; + break; + case (int)Providence.BossMode.Blue: //Same as night + case (int)Providence.BossMode.Night: + red = aimedSpear ? 100 : 175; + green = aimedSpear ? 255 : 175; + blue = 255; + break; + case (int)Providence.BossMode.Violet: + red = aimedSpear ? 125 : 255; + green = aimedSpear ? 0 : 255; + blue = 125; + break; + default: + break; + } + Color baseColor = new Color(red, green, blue, 0); + + GeneralParticleHandler.SpawnParticle(new SparkParticle(Projectile.Center + new Vector2(Main.rand.NextFloat(20), 0).RotatedByRandom(MathHelper.TwoPi), Projectile.velocity, false, 15, Main.rand.NextFloat(0.5f, 1.5f) * MathHelper.Clamp(Projectile.velocity.Length() / 15, 0f, 2f), aimedSpear ? baseColor : ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 255, false))); } public override bool PreDraw(ref Color lightColor) @@ -189,16 +236,21 @@ namespace CalamityMod.Projectiles.Boss break; } Color baseColor = new Color(red, green, blue, 0); + Color baseColor2 = new Color(15, 35, 50, 0); - Color baseColor2 = baseColor; - Vector2 projDirection = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); + if (!aimedSpear) + { + baseColor = ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 0); + baseColor2 = ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 0, true); + } + + Vector2 projDirection = Main.screenPosition - new Vector2(0f, Projectile.gfxOffY); Vector2 halfTextureSize = drawTexture.Size() / 2f; Color halfOfHalfBaseColor = baseColor2 * 0.5f; - float timeLeftColorScale = Utils.GetLerpValue(15f, 30f, Projectile.timeLeft, clamped: true) * Utils.GetLerpValue(240f, 200f, Projectile.timeLeft, clamped: true) * (1f + 0.2f * (float)Math.Cos(Main.GlobalTimeWrappedHourly % 30f / 0.5f * ((float)Math.PI * 2f) * 3f)) * 0.8f; - Vector2 timeLeftDrawEffect = new Vector2(1f, 1.5f) * timeLeftColorScale; - Vector2 timeLeftDrawEffect2 = new Vector2(0.5f, 1f) * timeLeftColorScale; - baseColor2 *= timeLeftColorScale; - halfOfHalfBaseColor *= timeLeftColorScale; + + float squish = MathHelper.Clamp(Projectile.velocity.Length() / 20, -0.3f, 0.3f); + + Vector2 sc = new Vector2(1 - squish, 1 + squish); SpriteEffects spriteEffects = SpriteEffects.None; if (Projectile.spriteDirection == -1) @@ -208,21 +260,16 @@ namespace CalamityMod.Projectiles.Boss { for (int i = 0; i < Projectile.oldPos.Length; i++) { - Vector2 drawPos = Projectile.oldPos[i] + projDirection; - Color baseColorAlpha = Projectile.GetAlpha(baseColor2) * ((Projectile.oldPos.Length - i) / Projectile.oldPos.Length); - Main.spriteBatch.Draw(drawTexture, drawPos, null, baseColorAlpha, Projectile.rotation, halfTextureSize, timeLeftDrawEffect, SpriteEffects.None, 0); - Main.spriteBatch.Draw(drawTexture, drawPos, null, baseColorAlpha, Projectile.rotation, halfTextureSize, timeLeftDrawEffect2, SpriteEffects.None, 0); - - baseColorAlpha = Projectile.GetAlpha(halfOfHalfBaseColor) * ((Projectile.oldPos.Length - i) / Projectile.oldPos.Length); - Main.spriteBatch.Draw(drawTexture, drawPos, null, baseColorAlpha, Projectile.rotation, halfTextureSize, timeLeftDrawEffect * 0.6f, SpriteEffects.None, 0); - Main.spriteBatch.Draw(drawTexture, drawPos, null, baseColorAlpha, Projectile.rotation, halfTextureSize, timeLeftDrawEffect2 * 0.6f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(drawTexture, Projectile.oldPos[i] - projDirection + (Projectile.Size / 2), null, Color.Lerp(baseColor, baseColor2, MathHelper.Lerp((float)i / (float)Projectile.oldPos.Length, 1f, 0.5f)), Projectile.rotation, halfTextureSize, sc * MathHelper.Lerp(1, 0, (float)((float)i / Projectile.oldPos.Length)), spriteEffects, 0); } } - Main.EntitySpriteDraw(drawTexture, projDirection, null, baseColor2, Projectile.rotation, halfTextureSize, timeLeftDrawEffect, spriteEffects, 0); - Main.EntitySpriteDraw(drawTexture, projDirection, null, baseColor2, Projectile.rotation, halfTextureSize, timeLeftDrawEffect2, spriteEffects, 0); - Main.EntitySpriteDraw(drawTexture, projDirection, null, halfOfHalfBaseColor, Projectile.rotation, halfTextureSize, timeLeftDrawEffect * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(drawTexture, projDirection, null, halfOfHalfBaseColor, Projectile.rotation, halfTextureSize, timeLeftDrawEffect2 * 0.6f, spriteEffects, 0); + for (float i = 0; i < 360; i += 90) + { + Main.EntitySpriteDraw(drawTexture, Projectile.Center + new Vector2(4, 0).RotatedBy(MathHelper.ToRadians(i)) - projDirection, null, Color.Lerp(baseColor, baseColor2, 0.75f), Projectile.rotation, halfTextureSize, sc, spriteEffects, 0); + } + + Main.EntitySpriteDraw(drawTexture, Projectile.Center - projDirection, null, baseColor, Projectile.rotation, halfTextureSize, sc, spriteEffects, 0); return false; } @@ -242,5 +289,10 @@ namespace CalamityMod.Projectiles.Boss ProvUtils.ApplyHitEffects(target, Projectile.maxPenetrate, 120, 20); } + + public override Color? GetAlpha(Color lightColor) + { + return ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 0, false); + } } } diff --git a/Projectiles/Boss/MoltenBlast.cs b/Projectiles/Boss/MoltenBlast.cs index 18ee564f3b..8659930354 100644 --- a/Projectiles/Boss/MoltenBlast.cs +++ b/Projectiles/Boss/MoltenBlast.cs @@ -3,6 +3,7 @@ using System.IO; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.NPCs; using CalamityMod.NPCs.Providence; +using CalamityMod.Particles; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -52,6 +53,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.Hitbox.Intersects(new Rectangle((int)Projectile.ai[0], (int)Projectile.ai[1], Player.defaultWidth, Player.defaultHeight))) Projectile.tileCollide = true; + Projectile.maxPenetrate = (int)Providence.BossMode.Day; // Day mode by default but syncs with the boss if (CalamityGlobalNPC.holyBoss != -1) { @@ -117,11 +119,20 @@ namespace CalamityMod.Projectiles.Boss } Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; + + float vel = Math.Clamp(((Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) / 2), 0f, 1f); + + GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center + new Vector2(Main.rand.NextFloat(15), 0).RotatedByRandom(MathHelper.TwoPi), Projectile.velocity.RotatedBy(Math.PI) * 0.5f, false, 10, Main.rand.NextFloat(0.8f, 1.2f), ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 255))); + + if (Main.rand.NextBool()) + { + GeneralParticleHandler.SpawnParticle(new MediumMistParticle(Projectile.Center, Vector2.Zero, Color.LightSlateGray, Color.DarkSlateGray, Main.rand.NextFloat(vel), 150, MathHelper.ToRadians(Main.rand.NextFloat(-1f, 1f)))); + } } public override Color? GetAlpha(Color lightColor) { - return ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha); + return ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 0); } public override bool PreDraw(ref Color lightColor) @@ -136,6 +147,22 @@ namespace CalamityMod.Projectiles.Boss public override void OnKill(int timeLeft) { + Color hiColor = ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 255, false); + Color loColor = ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 0, true); + + for (int i = 0; i < 25; i++) + { + GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center, new Vector2(Main.rand.NextFloat(10), 0).RotatedByRandom(MathHelper.TwoPi), false, 10, Main.rand.NextFloat(0.8f, 1.2f), hiColor)); + } + + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, 0f, 0.5f, 0.1f, 4)); + + for (float i = 0; i < 1; i += 0.25f) + { + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.02f * i, 0.125f * i, 8)); + } + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.02f, 0.045f, 5)); + int blobAmt = (Projectile.maxPenetrate != (int)Providence.BossMode.Day) ? 9 : 6; if (Projectile.owner == Main.myPlayer) { @@ -149,22 +176,6 @@ namespace CalamityMod.Projectiles.Boss } } SoundEngine.PlaySound(SoundID.Item74, Projectile.Center); - - int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); - for (int i = 0; i < 4; i++) - { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 50, default, 1.5f); - Main.dust[dust].noGravity = true; - } - for (int j = 0; j < 40; j++) - { - int killHolyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 2.5f); - Main.dust[killHolyDust].noGravity = true; - Main.dust[killHolyDust].velocity *= 3f; - killHolyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 50, default, 1.5f); - Main.dust[killHolyDust].velocity *= 2f; - Main.dust[killHolyDust].noGravity = true; - } } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 18f, targetHitbox); diff --git a/Projectiles/Boss/MoltenBlob.cs b/Projectiles/Boss/MoltenBlob.cs index f0516d1376..e6c1d5ced5 100644 --- a/Projectiles/Boss/MoltenBlob.cs +++ b/Projectiles/Boss/MoltenBlob.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.NPCs; using CalamityMod.NPCs.Providence; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -11,10 +12,15 @@ namespace CalamityMod.Projectiles.Boss { public class MoltenBlob : ModProjectile, ILocalizedModType { + float Landing = 1f; + bool colliding = false; + + bool inLava = false; + public new string LocalizationCategory => "Projectiles.Boss"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 2; + Main.projFrames[Projectile.type] = 3; } public override void SetDefaults() @@ -33,6 +39,7 @@ namespace CalamityMod.Projectiles.Boss { Lighting.AddLight(Projectile.Center, 0.3f, 0.225f, 0f); + Projectile.maxPenetrate = (int)Providence.BossMode.Day; // Day mode by default but syncs with the boss if (CalamityGlobalNPC.holyBoss != -1) { @@ -52,22 +59,40 @@ namespace CalamityMod.Projectiles.Boss else Projectile.maxPenetrate = (int)Providence.BossMode.Day; + Landing += 0.1f; + + Landing = MathHelper.Clamp(Landing, 0f, 1f); + + colliding = Projectile.velocity.Y == 0f; + + if (colliding) + { + Landing = 0f; + Projectile.localAI[2] = 5; + + Projectile.velocity.X *= 0.8f; + } + Projectile.velocity.X *= 0.95f; if (Projectile.wet || Projectile.lavaWet) { - Projectile.velocity.Y -= 0.2f; - if (Projectile.velocity.Y < -10f) - Projectile.velocity.Y = -10f; + if (!inLava) + { + Projectile.position.Y -= Projectile.velocity.Y; + Projectile.velocity.Y = 0f; + inLava = true; + } } else { - if (Projectile.velocity.Y < 0f) - Projectile.velocity.Y = 0f; + if (!inLava) + { + if (Projectile.velocity.Y < 0f) + Projectile.velocity.Y = 0f; - Projectile.velocity.Y += 0.1f; - if (Projectile.velocity.Y > 5f) - Projectile.velocity.Y = 5f; + Projectile.velocity.Y += 0.15f; + } } Projectile.frameCounter++; @@ -90,46 +115,45 @@ namespace CalamityMod.Projectiles.Boss public override Color? GetAlpha(Color lightColor) { - return ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha); + return ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 0); } public override bool PreDraw(ref Color lightColor) { Texture2D texture = (Projectile.maxPenetrate == (int)Providence.BossMode.Day) ? Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/MoltenBlobNight").Value; int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; - int y6 = framing * Projectile.frame; - Projectile.DrawBackglow(ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha, true), 4f, texture); - Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, framing / 2f), Projectile.scale, SpriteEffects.None, 0); + int y6 = framing * (1 + Projectile.frame); + float squish = CalamityUtils.SineBumpEasing(Landing, 1) * 0.5f; + Projectile.rotation = 0f; + if (!colliding) + { + y6 = 0; + squish = -MathHelper.Clamp(Projectile.velocity.Length() / 15, 0, 0.5f); + Projectile.rotation = Vector2.Zero.AngleTo(Projectile.velocity) + MathHelper.PiOver2; + } + Vector2 vec = new Vector2(0, framing * squish); + Projectile.DrawBackglow(ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha, true), 4f, new Vector2(1 + squish, 1 - squish), texture, offset: vec); + Main.spriteBatch.Draw(texture, Projectile.Center + vec - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, framing / 2f), new Vector2(1 + squish, 1 - squish), SpriteEffects.None, 0); return false; } public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); - Projectile.position.X = Projectile.position.X + (Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y + (Projectile.height / 2); - Projectile.width = 10; - Projectile.height = 10; - Projectile.position.X = Projectile.position.X - (Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); - int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); - for (int i = 0; i < 3; i++) + Color hiColor = ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 255, false); + Color loColor = ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 0, true); + + for (int i = 0; i < 25; i++) { - int holyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); - Main.dust[holyDust].noGravity = true; - if (Main.rand.NextBool()) - { - Main.dust[holyDust].scale = 0.5f; - Main.dust[holyDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; - } + GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center, new Vector2(Main.rand.NextFloat(3), 0).RotatedByRandom(MathHelper.TwoPi), false, 10, Main.rand.NextFloat(0.1f, 0.4f), hiColor)); } - for (int j = 0; j < 5; j++) + + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, 0f, 0.5f, 0.1f, 4)); + + for (float i = 0; i < 1; i += 0.25f) { - int holyDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 3f); - Main.dust[holyDust2].noGravity = true; - holyDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); - Main.dust[holyDust2].noGravity = true; + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.002f * i, 0.0125f * i, 8)); } + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.002f, 0.015f, 5)); } public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) diff --git a/Projectiles/Boss/MoltenBlob.png b/Projectiles/Boss/MoltenBlob.png index 811a46069d1524d0a254cec54f15a53365c77a0d..f2a81160995c8ddb579897d0840329f1d7a0a2d7 100644 GIT binary patch delta 218 zcmZ3=)XFqLoXd=ZnSp`f%dwgE6BQNe`2&1HT+fwQ|KIQV|Npd^p4vdUFrkZ$K#H{_ z$S?Rm5HS4S#up3};4JWnEM{QfI|Ravq8eTeK*2mu7sn6_|GO6hxeh4sFkd)U_20OE z&9vMb>wXKgJYB!O!)rv+%U*na+aP@0WcwMsH1i_WAH^uuzix2iJ ze3D*P6j696@hGSM>WZYWg4oQ^Co)ghpUHp!_LA3*>j#vKo=vn={9ebvSj?B}!D02y>e zSaefwW^{L9a%BK;VQFr3E^cLXAT%y8E;2FkAZe8V005OqL_t(YOYM|V3VW( z=mg%Uvjm-{8+0W@n(<>@NkySxAIyi$_LhirhSAQotw9Uwel%$e>UJmyr+*UmCpdRy zFBmR9{1Rd^p$vM?kPC|YZCR>2BoGUJvCN>P?OUPfBLEVogjX~WG1#g!S#_Jg_ z=Jl5eWzbh&m&3#?_-ZoQ0-Uwkn6zk`_-8nG14oK`>vhR`$N&HU07*qoM6N<$f~}-t A1ONa4 diff --git a/Projectiles/Boss/MoltenBlobNight.png b/Projectiles/Boss/MoltenBlobNight.png index fa915552dfd9b87db620d0ae9826195e969ae675..524da76f30d81615bf0db0da1ca9ca22d25c05d3 100644 GIT binary patch delta 246 zcmey(*vd3Pyxxq1nSp`f%dwgEK#H+A$lZxy-8q?;Kn_c~qpu?a!^VE@KZ&eBK7W8u zh-*hj$I+ulKY#ul8ygE0J8;o93`nt-1o;L32LguQ+xUWk0-OaNk;M!Qe1|}oQB=dL z0VtT~>Eak-;eYpHAlCr}9_9iftIK1*LQd=X2 zC3v+KD-f(_7Xlg3T{pvQ!py{vDnV22yy$7cugdyqd8I$Ln;a4eT2xa+^c!L!xFvbizsat`Y zd+&qm!?75cyM2-`@9KdY{D6MEi+9z)`QovUCOn!Q%s!gtq*U8HJxrfJnpO=Sl~5|? mdx?`oi-G@s2@8N&qkjW`JET|X4-dZp0000 1) + if (Projectile.frame > 2) { - Projectile.frame = 0; + Projectile.frame = 1; } }