From bd69eaeef792b20c7ec14ee292dbe4f46acc9a40 Mon Sep 17 00:00:00 2001 From: mountaindrew10 Date: Tue, 10 May 2022 02:47:03 -0500 Subject: [PATCH] 1 - DoG shouldn't be able to get an insane burst of speed when swapping phases anymore, regardless of the distance from his target. 2 - Queen Slime adjustments. --- NPCs/DevourerofGods/DevourerofGodsHead.cs | 58 +++++++++++++++++++ .../Bosses/QueenSlimeAI.cs | 10 ++-- Projectiles/CalamityGlobalProjectile.cs | 4 ++ 3 files changed, 67 insertions(+), 5 deletions(-) diff --git a/NPCs/DevourerofGods/DevourerofGodsHead.cs b/NPCs/DevourerofGods/DevourerofGodsHead.cs index 7007d22f27..e79175a40c 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHead.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHead.cs @@ -57,6 +57,9 @@ namespace CalamityMod.NPCs.DevourerofGods // Laser velocity private const float laserVelocity = 10f; + // Velocity prior to swapping from flight to ground and vice versa + private float velocityPriorToPhaseSwap = 0f; + // Phase 1 variables // Enums @@ -186,6 +189,9 @@ namespace CalamityMod.NPCs.DevourerofGods { bool wasDyingBefore = Dying; + // Velocity sync + writer.Write(velocityPriorToPhaseSwap); + // Phase 1 syncs writer.Write(NPC.dontTakeDamage); writer.Write(spawnedGuardians); @@ -235,6 +241,9 @@ namespace CalamityMod.NPCs.DevourerofGods public override void ReceiveExtraAI(BinaryReader reader) { + // Velocity sync + velocityPriorToPhaseSwap = reader.ReadSingle(); + // Phase 1 syncs NPC.dontTakeDamage = reader.ReadBoolean(); spawnedGuardians = reader.ReadBoolean(); @@ -326,6 +335,7 @@ namespace CalamityMod.NPCs.DevourerofGods float turnSpeed = malice ? 0.36f : death ? 0.33f : 0.3f; float homingSpeed = malice ? 36f : death ? 30f : 24f; float homingTurnSpeed = malice ? 0.48f : death ? 0.405f : 0.33f; + float velocityPriorToPhaseSwapIncrement = 0.05f; if (expertMode) { @@ -1053,10 +1063,22 @@ namespace CalamityMod.NPCs.DevourerofGods } } + // Set velocity so that DoG cannot speed burst instantly at the start of a phase swap + if (velocityPriorToPhaseSwap > 0f) + { + if (NPC.velocity.Length() > velocityPriorToPhaseSwap) + { + NPC.velocity.Normalize(); + NPC.velocity *= velocityPriorToPhaseSwap; + velocityPriorToPhaseSwap += velocityPriorToPhaseSwapIncrement; + } + } + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) + MathHelper.PiOver2; if (calamityGlobalNPC.newAI[2] > phaseLimit) { + velocityPriorToPhaseSwap = NPC.velocity.Length(); NPC.ai[3] = 1f; calamityGlobalNPC.newAI[2] = 0f; NPC.TargetClosest(); @@ -1282,6 +1304,17 @@ namespace CalamityMod.NPCs.DevourerofGods } } + // Set velocity so that DoG cannot speed burst instantly at the start of a phase swap + if (velocityPriorToPhaseSwap > 0f) + { + if (NPC.velocity.Length() > velocityPriorToPhaseSwap) + { + NPC.velocity.Normalize(); + NPC.velocity *= velocityPriorToPhaseSwap; + velocityPriorToPhaseSwap += velocityPriorToPhaseSwapIncrement; + } + } + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) + MathHelper.PiOver2; if (flies) @@ -1304,6 +1337,7 @@ namespace CalamityMod.NPCs.DevourerofGods if (calamityGlobalNPC.newAI[2] > phaseLimit) { + velocityPriorToPhaseSwap = NPC.velocity.Length(); NPC.ai[3] = 0f; calamityGlobalNPC.newAI[2] = 0f; NPC.TargetClosest(); @@ -1736,10 +1770,22 @@ namespace CalamityMod.NPCs.DevourerofGods } } + // Set velocity so that DoG cannot speed burst instantly at the start of a phase swap + if (velocityPriorToPhaseSwap > 0f) + { + if (NPC.velocity.Length() > velocityPriorToPhaseSwap) + { + NPC.velocity.Normalize(); + NPC.velocity *= velocityPriorToPhaseSwap; + velocityPriorToPhaseSwap += velocityPriorToPhaseSwapIncrement; + } + } + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) + MathHelper.PiOver2; if (calamityGlobalNPC.newAI[2] > phaseLimit) { + velocityPriorToPhaseSwap = NPC.velocity.Length(); NPC.ai[3] = 1f; calamityGlobalNPC.newAI[2] = 0f; NPC.TargetClosest(); @@ -1951,6 +1997,17 @@ namespace CalamityMod.NPCs.DevourerofGods } } + // Set velocity so that DoG cannot speed burst instantly at the start of a phase swap + if (velocityPriorToPhaseSwap > 0f) + { + if (NPC.velocity.Length() > velocityPriorToPhaseSwap) + { + NPC.velocity.Normalize(); + NPC.velocity *= velocityPriorToPhaseSwap; + velocityPriorToPhaseSwap += velocityPriorToPhaseSwapIncrement; + } + } + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) + MathHelper.PiOver2; if (flies) @@ -1973,6 +2030,7 @@ namespace CalamityMod.NPCs.DevourerofGods if (calamityGlobalNPC.newAI[2] > phaseLimit) { + velocityPriorToPhaseSwap = NPC.velocity.Length(); NPC.ai[3] = 0f; calamityGlobalNPC.newAI[2] = 0f; NPC.TargetClosest(); diff --git a/NPCs/VanillaNPCOverrides/Bosses/QueenSlimeAI.cs b/NPCs/VanillaNPCOverrides/Bosses/QueenSlimeAI.cs index d6b4831c2f..3fd51972fb 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/QueenSlimeAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/QueenSlimeAI.cs @@ -222,7 +222,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses switch ((int)npc.Calamity().newAI[0]) { - case 4: + default: npc.ai[0] = Main.rand.NextBool() ? 6f : 5f; break; case 5: @@ -247,7 +247,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { switch ((int)npc.Calamity().newAI[0]) { - case 3: + default: npc.ai[0] = Main.rand.NextBool() ? 5f : 4f; break; case 4: @@ -465,7 +465,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Eruption of crystals in phase 3 if (npc.ai[0] == 6f && phase3) { - float projectileVelocity = 12f; + float projectileVelocity = 24f; type = ProjectileID.QueenSlimeMinionBlueSpike; damage = npc.GetProjectileDamage(type); Vector2 destination = new Vector2(npc.Center.X, npc.Center.Y - 100f) - npc.Center; @@ -552,7 +552,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses for (int j = 0; j < totalProjectiles; j++) { Vector2 projVelocity = npc.velocity.RotatedBy(radians * j + MathHelper.PiOver2); - Projectile.NewProjectile(npc.GetSource_FromAI(), fireFrom, projVelocity, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(npc.GetSource_FromAI(), fireFrom, projVelocity * 2f, type, damage, 0f, Main.myPlayer); } } } @@ -724,7 +724,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.netUpdate = true; } - int num28 = (int)(npc.lifeMax * 0.04f); + int num28 = (int)(npc.lifeMax * (phase2 ? 0.03f : 0.015f)); if (!((npc.life + num28) < npc.localAI[0])) return false; diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 5867d8db03..d115447e2d 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -1957,6 +1957,10 @@ namespace CalamityMod.Projectiles { if (projectile.hostile) { + // These projectiles are way too fucking fast so they need to be slower + if (projectile.type == ProjectileID.QueenSlimeMinionBlueSpike || projectile.type == ProjectileID.QueenSlimeMinionPinkBall) + projectile.velocity *= 0.5f; + if (CalamityPlayer.areThereAnyDamnBosses && affectedByMaliceModeVelocityMultiplier && (CalamityWorld.malice || BossRushEvent.BossRushActive)) projectile.velocity *= MaliceModeProjectileVelocityMultiplier;