diff --git a/NPCs/CalamityGlobalAI.cs b/NPCs/CalamityGlobalAI.cs index 509f33af36..13bbdbaa26 100644 --- a/NPCs/CalamityGlobalAI.cs +++ b/NPCs/CalamityGlobalAI.cs @@ -9226,7 +9226,7 @@ namespace CalamityMod.NPCs npc.localAI[0] -= tileEnrageMult; if (npc.localAI[0] <= 0f) { - npc.localAI[0] = Main.rand.Next(120, 480); + npc.localAI[0] = Main.rand.Next(120, 481); npc.ai[0] = Main.rand.Next(-100, 101); npc.ai[1] = Main.rand.Next(-100, 101); npc.netUpdate = true; diff --git a/NPCs/HiveMind/DarkHeart.cs b/NPCs/HiveMind/DarkHeart.cs index 0f936cba83..ac03bf966c 100644 --- a/NPCs/HiveMind/DarkHeart.cs +++ b/NPCs/HiveMind/DarkHeart.cs @@ -113,7 +113,7 @@ namespace CalamityMod.NPCs.HiveMind int num1169 = (int)(npc.position.X + 10f + (float)Main.rand.Next(npc.width - 20)); int num1170 = (int)(npc.position.Y + (float)npc.height + 4f); int num184 = Main.expertMode ? 14 : 18; - Projectile.NewProjectile((float)num1169, (float)num1170, 0f, 5f, ModContent.ProjectileType(), num184, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile((float)num1169, (float)num1170, 0f, 4f, ModContent.ProjectileType(), num184, 0f, Main.myPlayer, 0f, 0f); } } } diff --git a/NPCs/HiveMind/HiveBlob.cs b/NPCs/HiveMind/HiveBlob.cs index 6b2cd83b00..33f1b07baa 100644 --- a/NPCs/HiveMind/HiveBlob.cs +++ b/NPCs/HiveMind/HiveBlob.cs @@ -13,7 +13,6 @@ namespace CalamityMod.NPCs.HiveMind public override void SetStaticDefaults() { DisplayName.SetDefault("Hive Blob"); - //Main.npcFrameCount[npc.type] = 4; } public override void SetDefaults() @@ -23,12 +22,13 @@ namespace CalamityMod.NPCs.HiveMind npc.damage = 0; npc.width = 25; npc.height = 25; - npc.lifeMax = 75; + npc.lifeMax = 100; if (CalamityWorld.bossRushActive) { npc.lifeMax = 13000; } - aiType = -1; + npc.knockBackResist = 0f; + aiType = -1; npc.noGravity = true; npc.noTileCollide = true; npc.canGhostHeal = false; @@ -39,68 +39,49 @@ namespace CalamityMod.NPCs.HiveMind public override void AI() { - bool expertMode = Main.expertMode; - bool revenge = CalamityWorld.revenge; - if (CalamityGlobalNPC.hiveMind < 0 || !Main.npc[CalamityGlobalNPC.hiveMind].active) - { - npc.active = false; - npc.netUpdate = true; - return; - } - int num750 = CalamityGlobalNPC.hiveMind; - if (npc.ai[3] > 0f) - { + bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; + bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; + bool death = CalamityWorld.death || CalamityWorld.bossRushActive; + + int num750 = CalamityGlobalNPC.hiveMind; + if (num750 < 0 || !Main.npc[num750].active) + { + npc.active = false; + npc.netUpdate = true; + return; + } + + if (npc.ai[3] > 0f) num750 = (int)npc.ai[3] - 1; - } + if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.localAI[0] -= 1f; - if (npc.localAI[0] <= 0f) + npc.localAI[0] -= 1f; + if (npc.localAI[0] <= 0f) { - npc.localAI[0] = (float)Main.rand.Next(120, 480); - npc.ai[0] = (float)Main.rand.Next(-100, 101); - npc.ai[1] = (float)Main.rand.Next(-100, 101); + npc.localAI[0] = Main.rand.Next(180, 361); + npc.ai[0] = Main.rand.Next(-100, 101); + npc.ai[1] = Main.rand.Next(-100, 101); npc.netUpdate = true; } } + npc.TargetClosest(true); - float num751 = 0.01f; - float num752 = 400f; - if ((double)Main.npc[CalamityGlobalNPC.hiveMind].life < (double)Main.npc[CalamityGlobalNPC.hiveMind].lifeMax * 0.5) - { - num752 += 60f; - } - if ((double)Main.npc[CalamityGlobalNPC.hiveMind].life < (double)Main.npc[CalamityGlobalNPC.hiveMind].lifeMax * 0.15) - { - num752 += 120f; - } - if (expertMode) - { - float num753 = 1f - (float)npc.life / (float)npc.lifeMax; - num752 += num753 * 100f; - num751 += 0.02f; - } - if (revenge) - { - num751 += 0.1f; - } - if (!Main.npc[num750].active || CalamityGlobalNPC.hiveMind < 0) - { - npc.active = false; - return; - } + + float num751 = death ? 0.8f : revenge ? 0.7f : expertMode ? 0.6f : 0.5f; + float num752 = 128f; Vector2 vector22 = new Vector2(npc.ai[0] * 16f + 8f, npc.ai[1] * 16f + 8f); - float num189 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - (float)(npc.width / 2) - vector22.X; - float num190 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - (float)(npc.height / 2) - vector22.Y; - float num191 = (float)Math.Sqrt((double)(num189 * num189 + num190 * num190)); - float num754 = Main.npc[num750].position.X + (float)(Main.npc[num750].width / 2); - float num755 = Main.npc[num750].position.Y + (float)(Main.npc[num750].height / 2); + float num189 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - (npc.width / 2) - vector22.X; + float num190 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - (npc.height / 2) - vector22.Y; + float num191 = (float)Math.Sqrt(num189 * num189 + num190 * num190); + float num754 = Main.npc[num750].position.X + (Main.npc[num750].width / 2); + float num755 = Main.npc[num750].position.Y + (Main.npc[num750].height / 2); Vector2 vector93 = new Vector2(num754, num755); float num756 = num754 + npc.ai[0]; float num757 = num755 + npc.ai[1]; float num758 = num756 - vector93.X; float num759 = num757 - vector93.Y; - float num760 = (float)Math.Sqrt((double)(num758 * num758 + num759 * num759)); + float num760 = (float)Math.Sqrt(num758 * num758 + num759 * num759); num760 = num752 / num760; num758 *= num760; num759 *= num760; @@ -108,79 +89,59 @@ namespace CalamityMod.NPCs.HiveMind { npc.velocity.X = npc.velocity.X + num751; if (npc.velocity.X < 0f && num758 > 0f) - { - npc.velocity.X = npc.velocity.X * 0.9f; - } + npc.velocity.X = npc.velocity.X * 0.8f; } else if (npc.position.X > num754 + num758) { npc.velocity.X = npc.velocity.X - num751; if (npc.velocity.X > 0f && num758 < 0f) - { - npc.velocity.X = npc.velocity.X * 0.9f; - } + npc.velocity.X = npc.velocity.X * 0.8f; } if (npc.position.Y < num755 + num759) { npc.velocity.Y = npc.velocity.Y + num751; if (npc.velocity.Y < 0f && num759 > 0f) - { - npc.velocity.Y = npc.velocity.Y * 0.9f; - } + npc.velocity.Y = npc.velocity.Y * 0.8f; } else if (npc.position.Y > num755 + num759) { npc.velocity.Y = npc.velocity.Y - num751; if (npc.velocity.Y > 0f && num759 < 0f) - { - npc.velocity.Y = npc.velocity.Y * 0.9f; - } + npc.velocity.Y = npc.velocity.Y * 0.8f; } - if (npc.velocity.X > 4f) - { - npc.velocity.X = 4f; - } - if (npc.velocity.X < -4f) - { - npc.velocity.X = -4f; - } - if (npc.velocity.Y > 4f) - { - npc.velocity.Y = 4f; - } - if (npc.velocity.Y < -4f) - { - npc.velocity.Y = -4f; - } - if (Main.netMode != NetmodeID.MultiplayerClient) + + float velocityLimit = 8f; + if (npc.velocity.X > velocityLimit) + npc.velocity.X = velocityLimit; + if (npc.velocity.X < -velocityLimit) + npc.velocity.X = -velocityLimit; + if (npc.velocity.Y > velocityLimit) + npc.velocity.Y = velocityLimit; + if (npc.velocity.Y < -velocityLimit) + npc.velocity.Y = -velocityLimit; + + if (Main.netMode != NetmodeID.MultiplayerClient) { if (!Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { npc.localAI[1] = 180f; - } + npc.localAI[1] += 1f; - if (npc.localAI[1] >= 600f) + if (npc.localAI[1] >= 360f && Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 80f) { npc.localAI[1] = 0f; npc.TargetClosest(true); if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { - float num941 = revenge ? 6f : 5f; //speed - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - num941 = 7f; - } - Vector2 vector104 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); - float num942 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector104.X; - float num943 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector104.Y; - float num944 = (float)Math.Sqrt((double)(num942 * num942 + num943 * num943)); + float num941 = death ? 5f : revenge ? 4.5f : expertMode ? 4f : 3.5f; + Vector2 vector104 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + (npc.height / 2)); + float num942 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector104.X; + float num943 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector104.Y; + float num944 = (float)Math.Sqrt(num942 * num942 + num943 * num943); num944 = num941 / num944; num942 *= num944; num943 *= num944; int num945 = expertMode ? 12 : 15; int num946 = ModContent.ProjectileType(); - vector104.X += num942 * 5f; - vector104.Y += num943 * 5f; int num947 = Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, num946, num945, 0f, Main.myPlayer, 0f, 0f); npc.netUpdate = true; } @@ -193,14 +154,6 @@ namespace CalamityMod.NPCs.HiveMind return false; } - /*public override void FindFrame(int frameHeight) - { - npc.frameCounter += 0.1f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - }*/ - public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) diff --git a/NPCs/HiveMind/HiveBlob2.cs b/NPCs/HiveMind/HiveBlob2.cs index e475cb30fe..c807499aa6 100644 --- a/NPCs/HiveMind/HiveBlob2.cs +++ b/NPCs/HiveMind/HiveBlob2.cs @@ -13,7 +13,6 @@ namespace CalamityMod.NPCs.HiveMind public override void SetStaticDefaults() { DisplayName.SetDefault("Hive Blob"); - //Main.npcFrameCount[npc.type] = 4; } public override void SetDefaults() @@ -23,12 +22,13 @@ namespace CalamityMod.NPCs.HiveMind npc.damage = 0; npc.width = 25; npc.height = 25; - npc.lifeMax = 75; + npc.lifeMax = 150; if (CalamityWorld.bossRushActive) { npc.lifeMax = 13000; } - aiType = -1; + npc.knockBackResist = 0f; + aiType = -1; npc.noGravity = true; npc.noTileCollide = true; npc.canGhostHeal = false; @@ -39,68 +39,49 @@ namespace CalamityMod.NPCs.HiveMind public override void AI() { - bool expertMode = Main.expertMode; - bool revenge = CalamityWorld.revenge; - if (CalamityGlobalNPC.hiveMind < 0 || !Main.npc[CalamityGlobalNPC.hiveMind].active) - { - npc.active = false; - npc.netUpdate = true; - return; - } - int num750 = CalamityGlobalNPC.hiveMind; - if (npc.ai[3] > 0f) - { + bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; + bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; + bool death = CalamityWorld.death || CalamityWorld.bossRushActive; + + int num750 = CalamityGlobalNPC.hiveMind; + if (num750 < 0 || !Main.npc[num750].active) + { + npc.active = false; + npc.netUpdate = true; + return; + } + + if (npc.ai[3] > 0f) num750 = (int)npc.ai[3] - 1; - } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[0] -= 1f; - if (npc.localAI[0] <= 0f) - { - npc.localAI[0] = (float)Main.rand.Next(120, 480); - npc.ai[0] = (float)Main.rand.Next(-100, 101); - npc.ai[1] = (float)Main.rand.Next(-100, 101); - npc.netUpdate = true; - } - } - npc.TargetClosest(true); - float num751 = 0.01f; - float num752 = 300f; - if ((double)Main.npc[CalamityGlobalNPC.hiveMind].life < (double)Main.npc[CalamityGlobalNPC.hiveMind].lifeMax * 0.25) - { - num752 += 30f; - } - if ((double)Main.npc[CalamityGlobalNPC.hiveMind].life < (double)Main.npc[CalamityGlobalNPC.hiveMind].lifeMax * 0.1) - { - num752 += 60f; - } - if (expertMode) - { - float num753 = 1f - (float)npc.life / (float)npc.lifeMax; - num752 += num753 * 100f; - num751 += 0.02f; - } - if (revenge) - { - num751 += 0.1f; - } - if (!Main.npc[num750].active) - { - npc.active = false; - return; - } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[0] -= 1f; + if (npc.localAI[0] <= 0f) + { + npc.localAI[0] = Main.rand.Next(180, 361); + npc.ai[0] = Main.rand.Next(-100, 101); + npc.ai[1] = Main.rand.Next(-100, 101); + npc.netUpdate = true; + } + } + + npc.TargetClosest(true); + + float num751 = death ? 0.8f : revenge ? 0.7f : expertMode ? 0.6f : 0.5f; + float num752 = 96f; Vector2 vector22 = new Vector2(npc.ai[0] * 16f + 8f, npc.ai[1] * 16f + 8f); - float num189 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - (float)(npc.width / 2) - vector22.X; - float num190 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - (float)(npc.height / 2) - vector22.Y; - float num191 = (float)Math.Sqrt((double)(num189 * num189 + num190 * num190)); - float num754 = Main.npc[num750].position.X + (float)(Main.npc[num750].width / 2); - float num755 = Main.npc[num750].position.Y + (float)(Main.npc[num750].height / 2); + float num189 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - (npc.width / 2) - vector22.X; + float num190 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - (npc.height / 2) - vector22.Y; + float num191 = (float)Math.Sqrt(num189 * num189 + num190 * num190); + float num754 = Main.npc[num750].position.X + (Main.npc[num750].width / 2); + float num755 = Main.npc[num750].position.Y + (Main.npc[num750].height / 2); Vector2 vector93 = new Vector2(num754, num755); float num756 = num754 + npc.ai[0]; float num757 = num755 + npc.ai[1]; float num758 = num756 - vector93.X; float num759 = num757 - vector93.Y; - float num760 = (float)Math.Sqrt((double)(num758 * num758 + num759 * num759)); + float num760 = (float)Math.Sqrt(num758 * num758 + num759 * num759); num760 = num752 / num760; num758 *= num760; num759 *= num760; @@ -108,79 +89,59 @@ namespace CalamityMod.NPCs.HiveMind { npc.velocity.X = npc.velocity.X + num751; if (npc.velocity.X < 0f && num758 > 0f) - { - npc.velocity.X = npc.velocity.X * 0.9f; - } + npc.velocity.X = npc.velocity.X * 0.8f; } else if (npc.position.X > num754 + num758) { npc.velocity.X = npc.velocity.X - num751; if (npc.velocity.X > 0f && num758 < 0f) - { - npc.velocity.X = npc.velocity.X * 0.9f; - } + npc.velocity.X = npc.velocity.X * 0.8f; } if (npc.position.Y < num755 + num759) { npc.velocity.Y = npc.velocity.Y + num751; if (npc.velocity.Y < 0f && num759 > 0f) - { - npc.velocity.Y = npc.velocity.Y * 0.9f; - } + npc.velocity.Y = npc.velocity.Y * 0.8f; } else if (npc.position.Y > num755 + num759) { npc.velocity.Y = npc.velocity.Y - num751; if (npc.velocity.Y > 0f && num759 < 0f) - { - npc.velocity.Y = npc.velocity.Y * 0.9f; - } + npc.velocity.Y = npc.velocity.Y * 0.8f; } - if (npc.velocity.X > 4f) - { - npc.velocity.X = 4f; - } - if (npc.velocity.X < -4f) - { - npc.velocity.X = -4f; - } - if (npc.velocity.Y > 4f) - { - npc.velocity.Y = 4f; - } - if (npc.velocity.Y < -4f) - { - npc.velocity.Y = -4f; - } - if (Main.netMode != NetmodeID.MultiplayerClient) + + float velocityLimit = 8f; + if (npc.velocity.X > velocityLimit) + npc.velocity.X = velocityLimit; + if (npc.velocity.X < -velocityLimit) + npc.velocity.X = -velocityLimit; + if (npc.velocity.Y > velocityLimit) + npc.velocity.Y = velocityLimit; + if (npc.velocity.Y < -velocityLimit) + npc.velocity.Y = -velocityLimit; + + if (Main.netMode != NetmodeID.MultiplayerClient) { if (!Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { npc.localAI[1] = 180f; - } + npc.localAI[1] += 1f; - if (npc.localAI[1] >= 600f) + if (npc.localAI[1] >= 360f && Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 80f) { npc.localAI[1] = 0f; npc.TargetClosest(true); if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { - float num941 = revenge ? 6f : 5f; //speed - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - num941 = 7f; - } - Vector2 vector104 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); - float num942 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector104.X; - float num943 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector104.Y; - float num944 = (float)Math.Sqrt((double)(num942 * num942 + num943 * num943)); + float num941 = death ? 5f : revenge ? 4.5f : expertMode ? 4f : 3.5f; + Vector2 vector104 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + (npc.height / 2)); + float num942 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector104.X; + float num943 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector104.Y; + float num944 = (float)Math.Sqrt(num942 * num942 + num943 * num943); num944 = num941 / num944; num942 *= num944; num943 *= num944; int num945 = expertMode ? 12 : 15; int num946 = ModContent.ProjectileType(); - vector104.X += num942 * 5f; - vector104.Y += num943 * 5f; int num947 = Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, num946, num945, 0f, Main.myPlayer, 0f, 0f); npc.netUpdate = true; } @@ -193,14 +154,6 @@ namespace CalamityMod.NPCs.HiveMind return false; } - /*public override void FindFrame(int frameHeight) - { - npc.frameCounter += 0.1f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - }*/ - public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) diff --git a/NPCs/HiveMind/HiveMind.cs b/NPCs/HiveMind/HiveMind.cs index cc664e792e..30e245b064 100644 --- a/NPCs/HiveMind/HiveMind.cs +++ b/NPCs/HiveMind/HiveMind.cs @@ -10,7 +10,7 @@ namespace CalamityMod.NPCs.HiveMind [AutoloadBossHead] public class HiveMind : ModNPC { - int burrowTimer = 720; + int burrowTimer = 420; public override void SetStaticDefaults() { @@ -108,32 +108,27 @@ namespace CalamityMod.NPCs.HiveMind npc.noTileCollide = false; bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - CalamityGlobalNPC.hiveMind = npc.whoAmI; + bool death = CalamityWorld.death || CalamityWorld.bossRushActive; + CalamityGlobalNPC.hiveMind = npc.whoAmI; + if (Main.netMode != NetmodeID.MultiplayerClient) { - if (revenge) - { - npc.localAI[1] += 1f; - if (npc.localAI[1] >= 600f) - { - npc.localAI[1] = 0f; - NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType(), npc.whoAmI, 0f, 0f, 0f, 0f, 255); - } - } if (npc.localAI[0] == 0f) { npc.localAI[0] = 1f; - for (int num723 = 0; num723 < 5; num723++) + int maxBlobs = death ? 8 : revenge ? 7 : expertMode ? 6 : 5; + for (int i = 0; i < maxBlobs; i++) { - NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType(), npc.whoAmI, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType(), npc.whoAmI); } } } + bool flag100 = false; int num568 = 0; if (expertMode) { - for (int num569 = 0; num569 < 200; num569++) + for (int num569 = 0; num569 < Main.maxNPCs; num569++) { if (Main.npc[num569].active && Main.npc[num569].type == ModContent.NPCType()) { @@ -141,15 +136,13 @@ namespace CalamityMod.NPCs.HiveMind num568++; } } + npc.defense += num568 * 25; - } - if (expertMode) - { - if (!flag100) - { - npc.defense = 10; - } - } + + if (!flag100) + npc.defense = npc.defDefense; + } + if (npc.ai[3] == 0f && npc.life > 0) { npc.ai[3] = npc.lifeMax; @@ -162,19 +155,20 @@ namespace CalamityMod.NPCs.HiveMind if ((npc.life + num660) < npc.ai[3]) { npc.ai[3] = npc.life; - int num661 = Main.rand.Next(3, 6); - for (int num662 = 0; num662 < num661; num662++) + int maxSpawns = death ? 5 : revenge ? 4 : expertMode ? Main.rand.Next(3, 5) : Main.rand.Next(2, 4); + int maxDankSpawns = death ? Main.rand.Next(2, 4) : revenge ? 2 : expertMode ? Main.rand.Next(1, 3) : 1; + for (int num662 = 0; num662 < maxSpawns; num662++) { int x = (int)(npc.position.X + Main.rand.Next(npc.width - 32)); int y = (int)(npc.position.Y + Main.rand.Next(npc.height - 32)); - int num663 = ModContent.NPCType(); - if (Main.rand.NextBool(3) || npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) + int type = ModContent.NPCType(); + if (NPC.CountNPCS(ModContent.NPCType()) < maxDankSpawns || npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) { - num663 = ModContent.NPCType(); + type = ModContent.NPCType(); } - int num664 = NPC.NewNPC(x, y, num663, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[num664].SetDefaults(num663, -1f); - if (Main.netMode == NetmodeID.Server && num664 < 200) + int num664 = NPC.NewNPC(x, y, type); + Main.npc[num664].SetDefaults(type); + if (Main.netMode == NetmodeID.Server && num664 < Main.maxNPCs) { NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num664, 0f, 0f, 0f, 0, 0, 0); } @@ -183,10 +177,11 @@ namespace CalamityMod.NPCs.HiveMind } } } + burrowTimer--; if (burrowTimer < -120) { - burrowTimer = 600; + burrowTimer = death ? 240 : revenge ? 300 : expertMode ? 360 : 420; npc.scale = 1f; npc.alpha = 0; npc.dontTakeDamage = false; diff --git a/NPCs/HiveMind/HiveMindP2.cs b/NPCs/HiveMind/HiveMindP2.cs index a3e23a410b..cd62eab1f5 100644 --- a/NPCs/HiveMind/HiveMindP2.cs +++ b/NPCs/HiveMind/HiveMindP2.cs @@ -240,33 +240,40 @@ namespace CalamityMod.NPCs.HiveMind private void SpawnStuff() { - Player player = Main.player[npc.target]; - for (int i = 0; i < 5; i++) - { - int type = NPCID.EaterofSouls; - switch (Main.rand.Next(4)) - { - case 0: - type = NPCID.DevourerHead; - break; - case 1: - type = ModContent.NPCType(); - break; - case 2: - type = ModContent.NPCType(); - break; - case 3: - type = ModContent.NPCType(); - break; - } - if (!NPC.AnyNPCs(type)) - { - int spawn = NPC.NewNPC((int)npc.position.X + Main.rand.Next(npc.width), (int)npc.position.Y + Main.rand.Next(npc.height), type); - Main.npc[spawn].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f; - Main.npc[spawn].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; - return; - } - } + int maxSpawns = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 5 : CalamityWorld.revenge ? 4 : Main.expertMode ? Main.rand.Next(3, 5) : Main.rand.Next(2, 4); + for (int i = 0; i < maxSpawns; i++) + { + int type = NPCID.EaterofSouls; + int choice = -1; + do + { + choice++; + switch (choice) + { + case 0: + type = NPCID.EaterofSouls; + break; + case 1: + type = NPCID.DevourerHead; + break; + case 2: + type = ModContent.NPCType(); + break; + case 3: + type = ModContent.NPCType(); + break; + case 4: + type = ModContent.NPCType(); + break; + default: + break; + } + } + while (NPC.AnyNPCs(type) && choice < 5); + + if (choice < 5) + NPC.NewNPC((int)npc.position.X + Main.rand.Next(npc.width), (int)npc.position.Y + Main.rand.Next(npc.height), type); + } } private void ReelBack() @@ -327,7 +334,7 @@ namespace CalamityMod.NPCs.HiveMind if (nextState == 0) { npc.TargetClosest(true); - if ((CalamityWorld.revenge && (double)npc.life < (double)npc.lifeMax * 0.66) || CalamityWorld.death || CalamityWorld.bossRushActive) + if ((CalamityWorld.revenge && npc.life < npc.lifeMax * 0.66) || CalamityWorld.death || CalamityWorld.bossRushActive) { if (CalamityWorld.death || CalamityWorld.bossRushActive) { @@ -336,7 +343,7 @@ namespace CalamityMod.NPCs.HiveMind while (nextState == previousState); previousState = nextState; } - else if ((double)npc.life < (double)npc.lifeMax * 0.33) + else if (npc.life < npc.lifeMax * 0.33) { do nextState = Main.rand.Next(3, 6); @@ -473,7 +480,7 @@ namespace CalamityMod.NPCs.HiveMind npc.alpha = 255; npc.velocity = Vector2.Zero; dashStarted = false; - if ((CalamityWorld.revenge && (double)npc.life < (double)npc.lifeMax * 0.66) || CalamityWorld.death || CalamityWorld.bossRushActive) + if ((CalamityWorld.revenge && npc.life < npc.lifeMax * 0.66) || CalamityWorld.death || CalamityWorld.bossRushActive) { state = nextState; nextState = 0; @@ -554,13 +561,13 @@ namespace CalamityMod.NPCs.HiveMind { dashStarted = true; Main.PlaySound(SoundID.Roar, (int)npc.Center.X, (int)npc.Center.Y, 0); - npc.velocity.X = 3.14159265f * teleportRadius / arcTime; + npc.velocity.X = MathHelper.Pi * teleportRadius / arcTime; npc.velocity *= rotationDirection; npc.netUpdate = true; } else { - npc.velocity = npc.velocity.RotatedBy(3.14159265 / arcTime * -rotationDirection); + npc.velocity = npc.velocity.RotatedBy(MathHelper.Pi / arcTime * -rotationDirection); phase2timer++; if (phase2timer == (int)arcTime / 6) { @@ -574,7 +581,7 @@ namespace CalamityMod.NPCs.HiveMind { NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType()); } - } + } else if (!NPC.AnyNPCs(NPCID.EaterofSouls)) { NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.EaterofSouls); @@ -582,7 +589,7 @@ namespace CalamityMod.NPCs.HiveMind } if (npc.ai[0] == 6) { - npc.velocity = npc.velocity.RotatedBy(3.14159265 / arcTime * -rotationDirection); + npc.velocity = npc.velocity.RotatedBy(MathHelper.Pi / arcTime * -rotationDirection); SpawnStuff(); state = 6; npc.ai[0] = 0; @@ -686,7 +693,7 @@ namespace CalamityMod.NPCs.HiveMind } if (Main.netMode != NetmodeID.MultiplayerClient && Main.rand.NextBool(15) && NPC.CountNPCS(ModContent.NPCType()) < 2) { - Vector2 spawnAt = npc.Center + new Vector2(0f, (float)npc.height / 2f); + Vector2 spawnAt = npc.Center + new Vector2(0f, npc.height / 2f); NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y, ModContent.NPCType()); } if (npc.life <= 0) @@ -694,12 +701,12 @@ namespace CalamityMod.NPCs.HiveMind int goreAmount = 10; for (int i = 1; i <= goreAmount; i++) Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/HiveMindGores/HiveMindP2Gore" + i), 1f); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.position.X = npc.position.X + (npc.width / 2); + npc.position.Y = npc.position.Y + (npc.height / 2); npc.width = 200; npc.height = 150; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); + npc.position.X = npc.position.X - (npc.width / 2); + npc.position.Y = npc.position.Y - (npc.height / 2); for (int num621 = 0; num621 < 40; num621++) { int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 14, 0f, 0f, 100, default, 2f); @@ -707,7 +714,7 @@ namespace CalamityMod.NPCs.HiveMind if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } for (int num623 = 0; num623 < 70; num623++) diff --git a/Projectiles/Boss/ShadeNimbusHostile.cs b/Projectiles/Boss/ShadeNimbusHostile.cs index 99f97fd8b6..b299bc960e 100644 --- a/Projectiles/Boss/ShadeNimbusHostile.cs +++ b/Projectiles/Boss/ShadeNimbusHostile.cs @@ -45,12 +45,12 @@ namespace CalamityMod.Projectiles.Boss else { projectile.ai[0] += 1f; - if (projectile.ai[0] >= 30f) + if (projectile.ai[0] >= 45f) { projectile.ai[0] = 0f; int num414 = (int)(projectile.position.X + 14f + (float)Main.rand.Next(projectile.width - 28)); int num415 = (int)(projectile.position.Y + (float)projectile.height + 4f); - Projectile.NewProjectile((float)num414, (float)num415, 0f, 5f, ModContent.ProjectileType(), projectile.damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile((float)num414, (float)num415, 0f, 4f, ModContent.ProjectileType(), projectile.damage, 0f, Main.myPlayer, 0f, 0f); } } }