diff --git a/DataStructures/NPCStats.cs b/DataStructures/NPCStats.cs index 0e8cabf248..aff4cd6275 100644 --- a/DataStructures/NPCStats.cs +++ b/DataStructures/NPCStats.cs @@ -323,7 +323,7 @@ namespace CalamityMod { NPCID.VileSpitEaterOfWorlds, new int[] { -1, 64, 64, 64, 96 } }, { NPCID.BrainofCthulhu, new int[] { 30, 54, 81, 99, 135 } }, - { NPCID.Creeper, new int[] { 20, 36, 54, 72, 90 } }, + { NPCID.Creeper, new int[] { 20, 36, 66, 80, 108 } }, { ModContent.NPCType(), new int[] { 35, 63, 81, 90, 135 } }, { ModContent.NPCType(), new int[] { 25, 50, 62, 68, 90 } }, @@ -565,6 +565,7 @@ namespace CalamityMod { new Tuple(NPCID.EaterofWorldsHead, ProjectileID.CursedFlameHostile), new int[] { 0, 0, 60, 68, 90 } }, { new Tuple(NPCID.EaterofWorldsHead, ModContent.ProjectileType()), new int[] { 0, 0, 0, 48, 66 } }, + { new Tuple(NPCID.BrainofCthulhu, ProjectileID.BloodNautilusShot), new int[] { 0, 0, 68, 76, 102 } }, { new Tuple(NPCID.BrainofCthulhu, ProjectileID.BloodShot), new int[] { 0, 0, 60, 68, 90 } }, { new Tuple(NPCID.Creeper, ProjectileID.BloodShot), new int[] { 0, 0, 60, 68, 90 } }, diff --git a/NPCs/VanillaNPCOverrides/Bosses/BrainOfCthulhuAI.cs b/NPCs/VanillaNPCOverrides/Bosses/BrainOfCthulhuAI.cs index 72814eb26d..07890eb21b 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/BrainOfCthulhuAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/BrainOfCthulhuAI.cs @@ -303,11 +303,15 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.ai[2] >= timer) { // Shoot projectiles from 4 directions, alternating between diagonal and cardinal - float bloodShotVelocity = death ? 7f : 6f; + float bloodShotVelocity = (death ? 7.5f : 6f) + enrageScale; + + // Scale projectile velocity + float phase7ProjectileVelocityMult = 1.2f; + float phase6ProjectileVelocityMult = 1.1f; if (phase7) - bloodShotVelocity *= 1.2f; + bloodShotVelocity *= phase7ProjectileVelocityMult; else if (phase6) - bloodShotVelocity *= 1.1f; + bloodShotVelocity *= phase6ProjectileVelocityMult; if (phase4) { @@ -369,9 +373,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } Vector2 projectileVelocity = (Main.player[npc.target].Center - position).SafeNormalize(Vector2.UnitY) * bloodShotVelocity; - Vector2 projectileSpawnCenter = position + projectileVelocity; float minFiringDistance = 560f; // 35 tile distance - if (Vector2.Distance(projectileSpawnCenter, Main.player[npc.target].Center) > minFiringDistance) // The projectiles can only be fired if the target is more than 15 tiles away from the firing position + bool firedFromRealBrain = Vector2.Distance(position, npc.Center) < 8f; + if (Vector2.Distance(position, Main.player[npc.target].Center) > minFiringDistance && !firedFromRealBrain) // The projectiles can only be fired if the target is more than 15 tiles away from the firing position { bool canHit = Collision.CanHitLine(position, 1, 1, Main.player[npc.target].Center, 1, 1); if (Main.netMode != NetmodeID.MultiplayerClient) @@ -404,26 +408,39 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } } } - else + + Vector2 projectileVelocity2 = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * bloodShotVelocity; + bool canHit2 = Collision.CanHitLine(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1); + if (Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 projectileVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * bloodShotVelocity; - Vector2 projectileSpawnCenter = npc.Center + projectileVelocity; - bool canHit = Collision.CanHitLine(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1); - if (Main.netMode != NetmodeID.MultiplayerClient) + int type = ProjectileID.BloodNautilusShot; + int damage = npc.GetProjectileDamage(type); + int numProj = death ? 9 : 7; + int spread = death ? 45 : 40; + if (phase7) { - int type = ProjectileID.BloodShot; - int damage = npc.GetProjectileDamage(type); - int numProj = death ? 9 : 7; - int spread = death ? 45 : 40; - float rotation = MathHelper.ToRadians(spread); - for (int i = 0; i < numProj; i++) - { - Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 10f, perturbedSpeed, type, damage, 0f, Main.myPlayer); - Main.projectile[proj].timeLeft = 600; - if (!canHit) - Main.projectile[proj].tileCollide = false; - } + numProj = death ? 3 : 1; + spread = death ? 10 : 5; + } + else if (phase5) + { + numProj = death ? 4 : 2; + spread = death ? 15 : 10; + } + else if (phase4) + { + numProj = death ? 5 : 3; + spread = death ? 15 : 10; + } + + float rotation = MathHelper.ToRadians(spread); + for (int i = 0; i < numProj; i++) + { + Vector2 perturbedSpeed = projectileVelocity2.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 10f, perturbedSpeed, type, damage, 0f, Main.myPlayer); + Main.projectile[proj].timeLeft = 600; + if (!canHit2) + Main.projectile[proj].tileCollide = false; } } diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index fa29ac57fb..73e3338196 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -415,25 +415,22 @@ namespace CalamityMod.Projectiles { SoundEngine.PlaySound(SoundID.Item17, projectile.Center); projectile.localAI[0] = 1f; - for (int num159 = 0; num159 < 8; num159++) + for (int i = 0; i < 8; i++) { - Dust obj9 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 5, projectile.velocity.X, projectile.velocity.Y, 100)]; - obj9.velocity = (Main.rand.NextFloatDirection() * (float)Math.PI).ToRotationVector2() * 2f + projectile.velocity.SafeNormalize(Vector2.Zero) * 3f; - obj9.scale = 1.5f; - obj9.fadeIn = 1.7f; - obj9.position = projectile.Center; + Dust blood1 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 5, projectile.velocity.X, projectile.velocity.Y, 100)]; + blood1.velocity = (Main.rand.NextFloatDirection() * (float)Math.PI).ToRotationVector2() * 2f + projectile.velocity.SafeNormalize(Vector2.Zero) * 3f; + blood1.scale = 1.5f; + blood1.fadeIn = 1.7f; + blood1.position = projectile.Center; } } projectile.alpha = 0; - for (int num160 = 0; num160 < 2; num160++) - { - Dust obj10 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 5, projectile.velocity.X, projectile.velocity.Y, 100)]; - obj10.velocity = obj10.velocity / 4f + projectile.velocity / 2f; - obj10.scale = 1.2f; - obj10.position = projectile.Center + Main.rand.NextFloat() * projectile.velocity * 2f; - } + Dust blood2 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 5, projectile.velocity.X, projectile.velocity.Y, 100)]; + blood2.velocity = blood2.velocity / 4f + projectile.velocity / 2f; + blood2.scale = 1.2f; + blood2.position = projectile.Center + Main.rand.NextFloat() * projectile.velocity * 2f; projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; @@ -446,7 +443,7 @@ namespace CalamityMod.Projectiles { SoundEngine.PlaySound(SoundID.Item171, projectile.Center); projectile.localAI[0] = 1f; - for (int num160 = 0; num160 < 8; num160++) + for (int i = 0; i < 8; i++) { Dust blood1 = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, 5, projectile.velocity.X, projectile.velocity.Y, 100); blood1.velocity = (Main.rand.NextFloatDirection() * MathHelper.Pi).ToRotationVector2() * 2f + projectile.velocity.SafeNormalize(Vector2.Zero) * 2f; @@ -458,22 +455,19 @@ namespace CalamityMod.Projectiles projectile.alpha = 0; - for (int num161 = 0; num161 < 2; num161++) - { - Dust blood2 = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, 5, projectile.velocity.X, projectile.velocity.Y, 100); - blood2.velocity = blood2.velocity / 4f + projectile.velocity / 2f; - blood2.scale = 1.2f; - blood2.position = projectile.Center + Main.rand.NextFloat() * projectile.velocity * 2f; - } + Dust blood2 = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, 5, projectile.velocity.X, projectile.velocity.Y, 100); + blood2.velocity = blood2.velocity / 4f + projectile.velocity / 2f; + blood2.scale = 1.2f; + blood2.position = projectile.Center + Main.rand.NextFloat() * projectile.velocity * 2f; - for (int num162 = 1; num162 < projectile.oldPos.Length && !(projectile.oldPos[num162] == Vector2.Zero); num162++) + for (int j = 1; j < projectile.oldPos.Length && !(projectile.oldPos[j] == Vector2.Zero); j++) { - if (Main.rand.Next(3) == 0) + if (Main.rand.NextBool(3)) { - Dust blood3 = Dust.NewDustDirect(projectile.oldPos[num162], projectile.width, projectile.height, 5, projectile.velocity.X, projectile.velocity.Y, 100); + Dust blood3 = Dust.NewDustDirect(projectile.oldPos[j], projectile.width, projectile.height, 5, projectile.velocity.X, projectile.velocity.Y, 100); blood3.velocity = blood3.velocity / 4f + projectile.velocity / 2f; blood3.scale = 1.2f; - blood3.position = projectile.oldPos[num162] + projectile.Size / 2f + Main.rand.NextFloat() * projectile.velocity * 2f; + blood3.position = projectile.oldPos[j] + projectile.Size / 2f + Main.rand.NextFloat() * projectile.velocity * 2f; } } @@ -582,7 +576,7 @@ namespace CalamityMod.Projectiles { float maxSpeed = 12f; int accelerationTime = 30; - + if (projectile.localAI[0] > 0f) projectile.localAI[0]--;