From f922d6eb2799077973c543151a0533318a964483 Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Tue, 3 Mar 2020 16:14:16 -0600 Subject: [PATCH] Fixed Death Mode Bat AI issue, Brimmy telegraph laser goes through tiles if she can't see her target. --- NPCs/CalamityAI.cs | 4 ++-- NPCs/CalamityGlobalAI.cs | 9 +++++---- NPCs/CalamityGlobalNPC.cs | 2 +- Projectiles/Boss/BrimstoneTargetRay.cs | 2 ++ Projectiles/Magic/SparkInfernal.cs | 1 + 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index ae24602deb..62a5b53f4e 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -1127,7 +1127,7 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.MultiplayerClient) { if (npc.ai[1] < 150f) - Projectile.NewProjectile(vector93.X, vector93.Y, num743, num744, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(vector93.X, vector93.Y, num743, num744, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, (float)npc.whoAmI); else { if (npc.ai[1] == 150f) @@ -1135,7 +1135,7 @@ namespace CalamityMod.NPCs npc.localAI[0] = num743; npc.localAI[1] = num744; } - Projectile.NewProjectile(vector93.X, vector93.Y, npc.localAI[0], npc.localAI[1], ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(vector93.X, vector93.Y, npc.localAI[0], npc.localAI[1], ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, (float)npc.whoAmI); } } } diff --git a/NPCs/CalamityGlobalAI.cs b/NPCs/CalamityGlobalAI.cs index c8de3afca5..6c0a489521 100644 --- a/NPCs/CalamityGlobalAI.cs +++ b/NPCs/CalamityGlobalAI.cs @@ -15796,7 +15796,7 @@ namespace CalamityMod.NPCs float xAccel = 0.1f, float xAccelBoost1 = 0.06f, float xAccelBoost2 = 0.25f, float yAccel = 0.12f, float yAccelBoost1 = 0.07f, float yAccelBoost2 = 0.2f) { - if (npc.direction == -1 && npc.velocity.X > -maxXSpeed && npc.position.X > Main.player[npc.target].Center.X) + if (npc.direction == -1 && npc.velocity.X > -maxXSpeed) { npc.velocity.X -= xAccel; if (npc.velocity.X > maxXSpeed) @@ -15812,7 +15812,7 @@ namespace CalamityMod.NPCs npc.velocity.X = -maxXSpeed; } } - else if (npc.direction == 1 && npc.velocity.X < maxXSpeed && npc.Center.X < Main.player[npc.target].position.X) + else if (npc.direction == 1 && npc.velocity.X < maxXSpeed) { npc.velocity.X += xAccel; if (npc.velocity.X < -maxXSpeed) @@ -15828,7 +15828,7 @@ namespace CalamityMod.NPCs npc.velocity.X = maxXSpeed; } } - if (npc.directionY == -1 && npc.velocity.Y > -maxYSpeed && npc.position.Y > Main.player[npc.target].Center.Y) + if (npc.directionY == -1 && npc.velocity.Y > -maxYSpeed) { npc.velocity.Y -= yAccel; if (npc.velocity.Y > maxYSpeed) @@ -15844,7 +15844,7 @@ namespace CalamityMod.NPCs npc.velocity.Y = -maxYSpeed; } } - else if (npc.directionY == 1 && npc.velocity.Y < maxYSpeed && npc.Center.X < Main.player[npc.target].position.Y) + else if (npc.directionY == 1 && npc.velocity.Y < maxYSpeed) { npc.velocity.Y += yAccel; if (npc.velocity.Y < -maxYSpeed) @@ -15861,6 +15861,7 @@ namespace CalamityMod.NPCs } } } + public static bool BuffedDemonEyeAI(NPC npc, Mod mod) { // Subtypes of enemies with this AI. Made for programmer convenience. diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 569c17931d..5dae1802ad 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -958,7 +958,7 @@ namespace CalamityMod.NPCs } //Reduce damage in Death Mode by the Beach - if (CalamityWorld.death && !CalamityPlayer.areThereAnyDamnBosses && player.ZoneBeach && !modPlayer.ZoneSulphur) + if (CalamityWorld.death && !CalamityPlayer.areThereAnyDamnBosses) { if (npc.type == NPCID.Sharkron) { diff --git a/Projectiles/Boss/BrimstoneTargetRay.cs b/Projectiles/Boss/BrimstoneTargetRay.cs index b4bc4d998b..a5f578d30d 100644 --- a/Projectiles/Boss/BrimstoneTargetRay.cs +++ b/Projectiles/Boss/BrimstoneTargetRay.cs @@ -24,6 +24,8 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + projectile.tileCollide = Collision.CanHitLine(Main.npc[(int)projectile.ai[1]].Center, 1, 1, Main.player[Main.npc[(int)projectile.ai[1]].target].Center, 1, 1); + if (Main.rand.NextBool(2)) { Vector2 vector33 = projectile.position; diff --git a/Projectiles/Magic/SparkInfernal.cs b/Projectiles/Magic/SparkInfernal.cs index 35ff0760a5..4d3cb2f059 100644 --- a/Projectiles/Magic/SparkInfernal.cs +++ b/Projectiles/Magic/SparkInfernal.cs @@ -28,6 +28,7 @@ namespace CalamityMod.Projectiles.Magic public override void Kill(int timeLeft) { + Player player = Main.player[projectile.owner]; Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(TheWand.BaseDamage * (player.allDamage + player.magicDamage - 1f)), projectile.knockBack, projectile.owner, 0f, 0f); }