From efaf4a73554c8eff5f124f07e5209032ed69e6b9 Mon Sep 17 00:00:00 2001 From: mountaindrew10 Date: Wed, 24 Jan 2024 08:08:38 -0600 Subject: [PATCH] Rev+ Queen Bee makes me go insane...also a Death Mode BoC knockback and afterimage edit. --- DataStructures/NPCStats.cs | 4 +- NPCs/CalamityGlobalAI.cs | 127 ++++++++---------- NPCs/CalamityGlobalNPC.cs | 36 ++++- .../Bosses/BrainOfCthulhuAI.cs | 7 +- NPCs/VanillaNPCOverrides/Bosses/QueenBeeAI.cs | 64 +++++---- Projectiles/CalamityGlobalProjectile.cs | 1 - 6 files changed, 138 insertions(+), 101 deletions(-) diff --git a/DataStructures/NPCStats.cs b/DataStructures/NPCStats.cs index aff4cd6275..4a000da3a3 100644 --- a/DataStructures/NPCStats.cs +++ b/DataStructures/NPCStats.cs @@ -340,8 +340,8 @@ namespace CalamityMod { ModContent.NPCType(), new int[] { 10, 20, 26, 30, 45 } }, { NPCID.QueenBee, new int[] { 30, 54, 81, 99, 135 } }, - { NPCID.Bee, new int[] { 20, 24, 30, 36, 54 } }, - { NPCID.BeeSmall, new int[] { 15, 18, 24, 30, 45 } }, + { NPCID.Bee, new int[] { 20, 24, 48, 60, 72 } }, + { NPCID.BeeSmall, new int[] { 15, 18, 30, 44, 54 } }, { NPCID.SkeletronHead, new int[] { 35, // Same for all phases diff --git a/NPCs/CalamityGlobalAI.cs b/NPCs/CalamityGlobalAI.cs index 30422e9123..a427b18236 100644 --- a/NPCs/CalamityGlobalAI.cs +++ b/NPCs/CalamityGlobalAI.cs @@ -3551,6 +3551,7 @@ namespace CalamityMod.NPCs if (targetData.Type == NPCTargetType.Player) targetDead = Main.player[npc.target].dead; + bool deathModeVelocityBuff = true; float maxVelocity = 6f; float acceleration = 0.05f; if (npc.type == NPCID.EaterofSouls || npc.type == NPCID.Crimera) @@ -3619,48 +3620,59 @@ namespace CalamityMod.NPCs } else if (npc.type == NPCID.ServantofCthulhu) { - maxVelocity = 5f + npc.ai[2] * 3f; - acceleration = 0.03f + npc.ai[2] * 0.15f; + maxVelocity = 5f + npc.ai[2] * 2f; + acceleration = 0.03f + npc.ai[2] * 0.03f; } else if (npc.type == NPCID.Bee || npc.type == NPCID.BeeSmall) { - npc.ai[1] += 1f; - float originalFlyAwayTime = 60f; - float flyAwayTime = CalamityWorld.death ? 30f : 40f; - float originalFlyAwayVelocity = 6f; - float flyAwayDistance = originalFlyAwayTime * originalFlyAwayVelocity; - float flyAwayVelocity = flyAwayDistance / flyAwayTime; - float flyAwayAccel = (npc.ai[1] - flyAwayTime) / flyAwayTime; - if (flyAwayAccel > 1f) + bool notQueenBeeBee = npc.ai[3] == 0f; + if (notQueenBeeBee) { - flyAwayAccel = 1f; + npc.ai[1] += 1f; + float originalFlyAwayTime = 60f; + float flyAwayTime = CalamityWorld.death ? 30f : 40f; + float originalFlyAwayVelocity = 6f; + float flyAwayDistance = originalFlyAwayTime * originalFlyAwayVelocity; + float flyAwayVelocity = flyAwayDistance / flyAwayTime; + float flyAwayAccel = (npc.ai[1] - flyAwayTime) / flyAwayTime; + if (flyAwayAccel > 1f) + { + flyAwayAccel = 1f; + } + else + { + if (npc.velocity.X > flyAwayVelocity) + npc.velocity.X = flyAwayVelocity; + + if (npc.velocity.X < -flyAwayVelocity) + npc.velocity.X = -flyAwayVelocity; + + if (npc.velocity.Y > flyAwayVelocity) + npc.velocity.Y = flyAwayVelocity; + + if (npc.velocity.Y < -flyAwayVelocity) + npc.velocity.Y = -flyAwayVelocity; + } + + maxVelocity = 5f; + acceleration = 0.1f * flyAwayAccel; } else { - if (npc.velocity.X > flyAwayVelocity) - npc.velocity.X = flyAwayVelocity; - - if (npc.velocity.X < -flyAwayVelocity) - npc.velocity.X = -flyAwayVelocity; - - if (npc.velocity.Y > flyAwayVelocity) - npc.velocity.Y = flyAwayVelocity; - - if (npc.velocity.Y < -flyAwayVelocity) - npc.velocity.Y = -flyAwayVelocity; + deathModeVelocityBuff = false; + maxVelocity = 5f + npc.ai[2] * 2f; + acceleration = 0.1f + npc.ai[2] * 0.04f; } - - maxVelocity = 5f + npc.ai[2] * 3f; - acceleration = 0.1f + npc.ai[2] * 0.15f; - acceleration *= flyAwayAccel; } + maxVelocity *= 1.25f; acceleration *= 1.25f; - if (CalamityWorld.death) + if (CalamityWorld.death && deathModeVelocityBuff) { maxVelocity *= 1.25f; acceleration *= 1.25f; } + Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); float targetXDist = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); float targetYDist = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); @@ -3672,11 +3684,11 @@ namespace CalamityMod.NPCs targetYDist -= vector.Y; float targetDistance = (float)Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); float targetDistCheck = targetDistance; + bool flag = false; if (targetDistance > 600f) - { flag = true; - } + if (targetDistance == 0f) { targetXDist = npc.velocity.X; @@ -3688,42 +3700,37 @@ namespace CalamityMod.NPCs targetXDist *= targetDistance; targetYDist *= targetDistance; } + if (npc.type == NPCID.Hornet || npc.type == NPCID.MossHornet || (npc.type >= NPCID.HornetFatty && npc.type <= NPCID.HornetStingy) || npc.type == NPCID.EaterofSouls || npc.type == NPCID.Corruptor || npc.type == NPCID.Probe || npc.type == NPCID.Crimera || npc.type == NPCID.Moth || npc.type == NPCID.Bee || npc.type == NPCID.BeeSmall || npc.type == NPCID.BloodSquid) { if (targetDistCheck > 100f || npc.type == NPCID.Corruptor || npc.type == NPCID.Bee || npc.type == NPCID.BeeSmall || npc.type == NPCID.BloodSquid || npc.type == NPCID.Hornet || npc.type == NPCID.MossHornet || (npc.type >= NPCID.HornetFatty && npc.type <= NPCID.HornetStingy)) { npc.ai[0] += 1f; if (npc.ai[0] > 0f) - { npc.velocity.Y = npc.velocity.Y + 0.03f; - } else - { npc.velocity.Y = npc.velocity.Y - 0.03f; - } + if (npc.ai[0] < -100f || npc.ai[0] > 100f) - { npc.velocity.X = npc.velocity.X + 0.03f; - } else - { npc.velocity.X = npc.velocity.X - 0.03f; - } + if (npc.ai[0] > 200f) - { npc.ai[0] = -200f; - } } + if (targetDistCheck < 150f && (npc.type == NPCID.EaterofSouls || npc.type == NPCID.Corruptor || npc.type == NPCID.Crimera || npc.type == NPCID.BloodSquid)) { npc.velocity.X = npc.velocity.X + targetXDist * 0.009f; npc.velocity.Y = npc.velocity.Y + targetYDist * 0.009f; } + if (npc.type == NPCID.Bee || npc.type == NPCID.BeeSmall) { if (npc.ai[3] == 1f) { - float pushVelocity = 0.5f + npc.ai[2] * 0.25f; + float pushVelocity = 0.5f + npc.ai[2] * 0.2f; for (int i = 0; i < Main.maxNPCs; i++) { if (Main.npc[i].active) @@ -3748,42 +3755,37 @@ namespace CalamityMod.NPCs } } } + if (targetDead) { targetXDist = (float)npc.direction * maxVelocity / 2f; targetYDist = -maxVelocity / 2f; } + if (npc.velocity.X < targetXDist) { npc.velocity.X = npc.velocity.X + acceleration; if (npc.type != NPCID.Crimera && npc.type != NPCID.EaterofSouls && npc.type != NPCID.Corruptor && npc.type != NPCID.Probe && npc.type != NPCID.BloodSquid && npc.velocity.X < 0f && targetXDist > 0f) - { npc.velocity.X = npc.velocity.X + acceleration; - } } else if (npc.velocity.X > targetXDist) { npc.velocity.X = npc.velocity.X - acceleration; if (npc.type != NPCID.Crimera && npc.type != NPCID.EaterofSouls && npc.type != NPCID.Corruptor && npc.type != NPCID.Probe && npc.type != NPCID.BloodSquid && npc.velocity.X > 0f && targetXDist < 0f) - { npc.velocity.X = npc.velocity.X - acceleration; - } } + if (npc.velocity.Y < targetYDist) { npc.velocity.Y = npc.velocity.Y + acceleration; if (npc.type != NPCID.Crimera && npc.type != NPCID.EaterofSouls && npc.type != NPCID.Corruptor && npc.type != NPCID.Probe && npc.type != NPCID.BloodSquid && npc.velocity.Y < 0f && targetYDist > 0f) - { npc.velocity.Y = npc.velocity.Y + acceleration; - } } else if (npc.velocity.Y > targetYDist) { npc.velocity.Y = npc.velocity.Y - acceleration; if (npc.type != NPCID.Crimera && npc.type != NPCID.EaterofSouls && npc.type != NPCID.Corruptor && npc.type != NPCID.Probe && npc.type != NPCID.BloodSquid && npc.velocity.Y > 0f && targetYDist < 0f) - { npc.velocity.Y = npc.velocity.Y - acceleration; - } } if (npc.type == NPCID.ServantofCthulhu) @@ -3841,19 +3843,20 @@ namespace CalamityMod.NPCs Projectile.NewProjectile(npc.GetSource_FromAI(), vector.X, vector.Y, targetXDist, targetYDist, projType, projDamage, 0f, Main.myPlayer, 0f, 0f); } } + int npcXPos = (int)npc.position.X + npc.width / 2; int npcTileY = (int)npc.position.Y + npc.height / 2; int npcTileX = npcXPos / 16; npcTileY /= 16; if (!WorldGen.SolidTile(npcTileX, npcTileY)) - { Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.3f, 0.1f, 0.05f); - } + if (targetXDist > 0f) { npc.spriteDirection = 1; npc.rotation = (float)Math.Atan2((double)targetYDist, (double)targetXDist); } + if (targetXDist < 0f) { npc.spriteDirection = -1; @@ -3867,52 +3870,41 @@ namespace CalamityMod.NPCs else if (npc.type == NPCID.Moth || npc.type == NPCID.Hornet || npc.type == NPCID.MossHornet || (npc.type >= NPCID.HornetFatty && npc.type <= NPCID.HornetStingy)) { if (npc.velocity.X > 0f) - { npc.spriteDirection = 1; - } if (npc.velocity.X < 0f) - { npc.spriteDirection = -1; - } + npc.rotation = npc.velocity.X * 0.1f; } else - { npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - MathHelper.PiOver2; - } + if (npc.type == NPCID.Hornet || npc.type == NPCID.MossHornet || (npc.type >= NPCID.HornetFatty && npc.type <= NPCID.HornetStingy) || npc.type == NPCID.EaterofSouls || npc.type == NPCID.MeteorHead || npc.type == NPCID.Corruptor || npc.type == NPCID.Probe || npc.type == NPCID.Crimera || npc.type == NPCID.Moth || npc.type == NPCID.Bee || npc.type == NPCID.BeeSmall || npc.type == NPCID.BloodSquid) { float reboundSpeed = 0.7f; if (npc.type == NPCID.EaterofSouls || npc.type == NPCID.Crimera) - { reboundSpeed = 0.4f; - } + if (npc.collideX) { npc.netUpdate = true; npc.velocity.X = npc.oldVelocity.X * -reboundSpeed; if (npc.direction == -1 && npc.velocity.X > 0f && npc.velocity.X < 2f) - { npc.velocity.X = 2f; - } if (npc.direction == 1 && npc.velocity.X < 0f && npc.velocity.X > -2f) - { npc.velocity.X = -2f; - } } + if (npc.collideY) { npc.netUpdate = true; npc.velocity.Y = npc.oldVelocity.Y * -reboundSpeed; if (npc.velocity.Y > 0f && (double)npc.velocity.Y < 1.5) - { npc.velocity.Y = 2f; - } if (npc.velocity.Y < 0f && (double)npc.velocity.Y > -1.5) - { npc.velocity.Y = -2f; - } } + if (npc.type == NPCID.BloodSquid) { int bloodDust = Dust.NewDust(npc.position, npc.width, npc.height, 5, npc.velocity.X * 0.2f, npc.velocity.Y * 0.2f, 100); @@ -3930,9 +3922,8 @@ namespace CalamityMod.NPCs { int dustType = 18; if (npc.type == NPCID.Crimera) - { dustType = 5; - } + int idleDust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + (float)npc.height * 0.25f), npc.width, (int)((float)npc.height * 0.5f), dustType, npc.velocity.X, 2f, 75, npc.color, npc.scale); Dust dust = Main.dust[idleDust]; dust.velocity.X *= 0.5f; diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 9cdd691b08..1d451bf9f7 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -1410,7 +1410,7 @@ namespace CalamityMod.NPCs } else if ((npc.type == NPCID.Bee || npc.type == NPCID.BeeSmall) && CalamityPlayer.areThereAnyDamnBosses) { - npc.lifeMax = (int)(npc.lifeMax * 2.5); + npc.lifeMax = (int)(npc.lifeMax * 1.5); npc.scale *= 1.25f; } else if (npc.type == NPCID.BrainofCthulhu) @@ -5822,33 +5822,65 @@ namespace CalamityMod.NPCs currentColor.G = (byte)((float)(int)currentColor.G * opacity); currentColor.B = (byte)((float)(int)currentColor.B * opacity); currentColor.A = (byte)((float)(int)currentColor.A * opacity); - for (int i = 0; i < 4; i++) + int totalAfterimages = (CalamityWorld.death || BossRushEvent.BossRushActive) ? 12 : 4; + for (int i = 0; i < totalAfterimages; i++) { Vector2 position = npc.position; float distanceFromTargetX = Math.Abs(npc.Center.X - Main.player[Main.myPlayer].Center.X); float distanceFromTargetY = Math.Abs(npc.Center.Y - Main.player[Main.myPlayer].Center.Y); + if (i > 3) + { + currentColor *= 0.5f; + distanceFromTargetX *= 0.5f; + distanceFromTargetY *= 0.5f; + } + switch (i) { case 0: + case 4: position.X = Main.player[Main.myPlayer].Center.X - distanceFromTargetX; position.Y = Main.player[Main.myPlayer].Center.Y; break; case 1: + case 5: position.Y = Main.player[Main.myPlayer].Center.Y - distanceFromTargetY; position.X = Main.player[Main.myPlayer].Center.X; break; case 2: + case 6: position.X = Main.player[Main.myPlayer].Center.X + distanceFromTargetX; position.Y = Main.player[Main.myPlayer].Center.Y; break; case 3: + case 7: position.Y = Main.player[Main.myPlayer].Center.Y + distanceFromTargetY; position.X = Main.player[Main.myPlayer].Center.X; break; + case 8: + position.X = Main.player[Main.myPlayer].Center.X - distanceFromTargetX; + position.Y = Main.player[Main.myPlayer].Center.Y - distanceFromTargetY; + break; + + case 9: + position.X = Main.player[Main.myPlayer].Center.X + distanceFromTargetX; + position.Y = Main.player[Main.myPlayer].Center.Y - distanceFromTargetY; + break; + + case 10: + position.X = Main.player[Main.myPlayer].Center.X + distanceFromTargetX; + position.Y = Main.player[Main.myPlayer].Center.Y + distanceFromTargetY; + break; + + case 11: + position.X = Main.player[Main.myPlayer].Center.X - distanceFromTargetX; + position.Y = Main.player[Main.myPlayer].Center.Y + distanceFromTargetY; + break; + default: break; } diff --git a/NPCs/VanillaNPCOverrides/Bosses/BrainOfCthulhuAI.cs b/NPCs/VanillaNPCOverrides/Bosses/BrainOfCthulhuAI.cs index daeadedfec..2fac9045f5 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/BrainOfCthulhuAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/BrainOfCthulhuAI.cs @@ -164,7 +164,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses chargeVelocity *= 1.2f; // KnockBack - float baseKnockBackResist = death ? 0.15f : 0.3f; + float baseKnockBackResist = death ? 0.1f : 0.3f; if (!phase3) npc.knockBackResist = GetCrimsonBossKnockBack(npc, CalamityGlobalNPC.GetActivePlayerCount(), lifeRatio, baseKnockBackResist); else @@ -691,13 +691,10 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses phase1TeleportTileY -= Main.rand.Next(min, max); if (!WorldGen.SolidTile(phase1TeleportTileX, phase1TeleportTileY) && Collision.CanHit(new Vector2(phase1TeleportTileX * 16, phase1TeleportTileY * 16), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { break; - } + if (phase1TeleportTries > 100) - { goto Block; - } } npc.ai[0] = 1f; npc.ai[1] = phase1TeleportTileX; diff --git a/NPCs/VanillaNPCOverrides/Bosses/QueenBeeAI.cs b/NPCs/VanillaNPCOverrides/Bosses/QueenBeeAI.cs index 80dbf4c190..12328000e0 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/QueenBeeAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/QueenBeeAI.cs @@ -39,7 +39,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses enrage = false; float maxEnrageScale = 2f; - float enrageScale = death ? 0.25f : 0f; + float enrageScale = death ? 0.5f : 0f; if (((npc.position.Y / 16f) < Main.worldSurface && enrage) || bossRush) { npc.Calamity().CurrentlyEnraged = !bossRush; @@ -64,7 +64,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses float lifeRatio = npc.life / (float)npc.lifeMax; // Bee spawn limit - int beeLimit = 20; + int beeLimit = 15; // Queen Bee Bee count int totalBees = 0; @@ -189,7 +189,12 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.TargetClosest(); npc.ai[0] = phase; npc.ai[1] = 0f; + + // Movement direction for the stinger arcs npc.ai[2] = (phase == 5 && phase5) ? (Main.rand.NextBool() ? 1f : -1f) : phase == 5 ? 1f : 0f; + + // Velocity for the charges + npc.ai[3] = phase == 0 ? ((phase6 ? 25f : phase5 ? 14f : phase4 ? 25f : phase2 ? 20f : 15f) + 6f * enrageScale) : 0f; } } @@ -202,6 +207,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Number of charges int chargeAmt = (int)Math.Ceiling((phase6 ? 2f : phase5 ? 4f : phase4 ? 3f : 2f) + enrageScale); + if (death) + chargeAmt = phase6 ? 1 : phase5 ? 3 : phase4 ? 2 : 1; // Switch to a random phase if chargeAmt has been exceeded if (npc.ai[1] > (2 * chargeAmt) && npc.ai[1] % 2f == 0f) @@ -214,7 +221,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } // Charge velocity - float speed = (phase6 ? 30f : phase5 ? 14f : phase4 ? 25f : phase2 ? 20f : 15f) + 8f * enrageScale; + float velocity = npc.ai[3]; // Line up and initiate charge if (npc.ai[1] % 2f == 0f) @@ -224,7 +231,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Initiate charge float chargeDistanceY = phase6 ? 100f : phase4 ? 50f : 20f; - chargeDistanceY += 50f * enrageScale; + chargeDistanceY += 100f * enrageScale; if (death) chargeDistanceY += MathHelper.Lerp(0f, 100f, 1f - lifeRatio); @@ -245,7 +252,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses float targetXDist = Main.player[npc.target].Center.X - beeLocation.X; float targetYDist = Main.player[npc.target].Center.Y - beeLocation.Y; float targetDistance = (float)Math.Sqrt(targetXDist * targetXDist + targetYDist * targetYDist); - targetDistance = speed / targetDistance; + targetDistance = velocity / targetDistance; npc.velocity.X = targetXDist * targetDistance; npc.velocity.Y = targetYDist * targetDistance; @@ -287,7 +294,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.velocity.Y > chargeVelocity) npc.velocity.Y = chargeVelocity; - if (distanceFromTargetX > chargeDistanceX + 100f) + if (distanceFromTargetX > chargeDistanceX + 120f) npc.velocity.X += chargeAcceleration * 2f * npc.direction; else if (distanceFromTargetX < chargeDistanceX + 20f) npc.velocity.X -= chargeAcceleration * 2f * npc.direction; @@ -347,19 +354,26 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.ai[2] != 1f) { // Velocity fix if Queen Bee is slowed - if (npc.velocity.Length() < speed) - npc.velocity.X = speed * npc.direction; + if (npc.velocity.Length() < velocity) + npc.velocity.X = velocity * npc.direction; + + float accelerateGateValue = phase6 ? 30f : phase5 ? 10f : 90f; + if (enrageScale > 0f) + accelerateGateValue *= 0.5f; calamityGlobalNPC.newAI[0] += 1f; - if (calamityGlobalNPC.newAI[0] > (phase5 ? 9f : 90f)) + if (calamityGlobalNPC.newAI[0] > accelerateGateValue) { npc.SyncExtraAI(); - npc.velocity.X *= 1.01f; + float velocityXLimit = velocity * 2f; + if (Math.Abs(npc.velocity.X) < velocityXLimit) + npc.velocity.X *= 1.01f; } // Spawn bees - bool spawnBee = phase4 && calamityGlobalNPC.newAI[0] % 20f == 0f; - if (Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && spawnBee) + float beeSpawnGateValue = 20f; + bool spawnBee = phase4 && calamityGlobalNPC.newAI[0] % beeSpawnGateValue == 0f && Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); + if (spawnBee) { SoundEngine.PlaySound(SoundID.NPCHit1, npc.Center); @@ -384,7 +398,6 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { Main.npc[spawn].ai[2] = enrageScale; Main.npc[spawn].ai[3] = 1f; - Main.npc[spawn].localAI[0] = 60f; } Main.npc[spawn].netUpdate = true; } @@ -537,7 +550,6 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { Main.npc[spawn].ai[2] = enrageScale; Main.npc[spawn].ai[3] = 1f; - Main.npc[spawn].localAI[0] = 60f; } Main.npc[spawn].netUpdate = true; } @@ -600,7 +612,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses SoundEngine.PlaySound(SoundID.Item17, stingerSpawnLocation); if (Main.netMode != NetmodeID.MultiplayerClient) { - float stingerSpeed = (phase3 ? 6f : 5f) + 2f * enrageScale; + float stingerSpeed = (phase3 ? 6f : 5f) + enrageScale; float stingerTargetX = Main.player[npc.target].Center.X - stingerSpawnLocation.X; float stingerTargetY = Main.player[npc.target].Center.Y - stingerSpawnLocation.Y; float stingerTargetDist = (float)Math.Sqrt(stingerTargetX * stingerTargetX + stingerTargetY * stingerTargetY); @@ -611,7 +623,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses int type = Main.zenithWorld ? (phase3 ? ModContent.ProjectileType() : ProjectileID.FlamingWood) : ProjectileID.QueenBeeStinger; int projectile = Projectile.NewProjectile(npc.GetSource_FromAI(), stingerSpawnLocation, stingerVelocity, type, Main.zenithWorld ? 25 : npc.GetProjectileDamage(type), 0f, Main.myPlayer, 0f, (Main.zenithWorld && phase3) ? Main.player[npc.target].position.Y : 0f); - Main.projectile[projectile].timeLeft = 600; + Main.projectile[projectile].timeLeft = 1200; Main.projectile[projectile].extraUpdates = 1; if (phase2) @@ -619,8 +631,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses int numExtraStingers = death ? (phase6 ? 4 : 2) : (phase6 ? 2 : 1); for (int i = 0; i < numExtraStingers; i++) { - projectile = Projectile.NewProjectile(npc.GetSource_FromAI(), stingerSpawnLocation + Main.rand.NextVector2CircularEdge(16f, 16f) * (i + 1), stingerVelocity * (0.75f * (i * 0.2f + 1)), type, Main.zenithWorld ? 25 : npc.GetProjectileDamage(type), 0f, Main.myPlayer, 0f, (Main.zenithWorld && phase3) ? Main.player[npc.target].position.Y : 0f); - Main.projectile[projectile].timeLeft = 600; + projectile = Projectile.NewProjectile(npc.GetSource_FromAI(), stingerSpawnLocation + Main.rand.NextVector2CircularEdge(16f, 16f) * (i + 1), stingerVelocity * MathHelper.Lerp(0.75f, 1f, i / (float)numExtraStingers), type, Main.zenithWorld ? 25 : npc.GetProjectileDamage(type), 0f, Main.myPlayer, 0f, (Main.zenithWorld && phase3) ? Main.player[npc.target].position.Y : 0f); + Main.projectile[projectile].timeLeft = 1200; Main.projectile[projectile].extraUpdates = 1; } } @@ -685,15 +697,21 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (enrageScale > 0f) stingerAttackAccel = MathHelper.Lerp(phase6 ? 0.9f : 0.7f, phase6 ? 2.4f : 1.8f, enrageScale / maxEnrageScale); - float numStingerArcs = phase6 ? 3f : phase5 ? 2f : 1f; + int numStingerArcs = phase6 ? 3 : phase5 ? 2 : 1; + if (death) + numStingerArcs++; + float phaseLimit = phase6 ? 180f : phase5 ? 150f : 120f; - float stingerAttackTimer = phaseLimit / (numStingerArcs + 1); + if (death) + phaseLimit *= 1.5f; + + float stingerAttackTimer = (float)Math.Ceiling(phaseLimit / (numStingerArcs + 1)); float maxDistance = 480f; float xLocationScale = MathHelper.Lerp(-maxDistance, maxDistance, npc.ai[1] / phaseLimit) * npc.ai[2]; Vector2 stingerSpawnLocation = new Vector2(npc.Center.X + (Main.rand.Next(20) * npc.direction), npc.position.Y + npc.height * 0.8f); bool canHitTarget = Collision.CanHit(new Vector2(stingerSpawnLocation.X, stingerSpawnLocation.Y - 30f), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); - Vector2 hoverDestination = Main.player[npc.target].Center + Vector2.UnitX * xLocationScale * 1.25f - Vector2.UnitY * maxDistance; + Vector2 hoverDestination = Main.player[npc.target].Center + Vector2.UnitX * xLocationScale * (death ? 1.5f : 1.25f) - Vector2.UnitY * maxDistance; Vector2 idealVelocity = npc.SafeDirectionTo(hoverDestination) * stingerAttackSpeed; // Fire stingers @@ -706,7 +724,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses SoundEngine.PlaySound(SoundID.Item17, stingerSpawnLocation); if (Main.netMode != NetmodeID.MultiplayerClient) { - float stingerSpeed = (phase6 ? 5f : 4f) + 2f * enrageScale; + float stingerSpeed = (phase6 ? 5f : 4f) + enrageScale; Vector2 projectileVelocity = Vector2.Normalize(Main.player[npc.target].Center - npc.Center) * stingerSpeed; int type = Main.zenithWorld ? ModContent.ProjectileType() : ProjectileID.QueenBeeStinger; int numProj = phase6 ? 5 : phase5 ? 10 : 15; @@ -716,7 +734,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); int projectile = Projectile.NewProjectile(npc.GetSource_FromAI(), stingerSpawnLocation + Vector2.Normalize(perturbedSpeed) * 10f, perturbedSpeed, type, Main.zenithWorld ? 25 : npc.GetProjectileDamage(type), 0f, Main.myPlayer, 0f, Main.player[npc.target].position.Y); - Main.projectile[projectile].timeLeft = 600; + Main.projectile[projectile].timeLeft = 1200; Main.projectile[projectile].extraUpdates = 1; if (!Main.zenithWorld) diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index c918b56bd9..69e4ca6756 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -3155,7 +3155,6 @@ namespace CalamityMod.Projectiles Main.npc[beeSpawn].velocity.X = (float)Main.rand.Next(-200, 201) * 0.002f; Main.npc[beeSpawn].velocity.Y = (float)Main.rand.Next(-200, 201) * 0.002f; Main.npc[beeSpawn].ai[3] = 1f; - Main.npc[beeSpawn].localAI[0] = 60f; Main.npc[beeSpawn].netUpdate = true; } }