From 4b1bbfcec8cc290e0b9fdba511651ac977ebdf11 Mon Sep 17 00:00:00 2001 From: mountaindrew10 Date: Mon, 22 Apr 2024 02:33:32 -0500 Subject: [PATCH] Yharon always tries to teleport a safe distance away before doing the bullet hells. --- NPCs/Yharon/Yharon.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/NPCs/Yharon/Yharon.cs b/NPCs/Yharon/Yharon.cs index 7387859b80..f9f157f01f 100644 --- a/NPCs/Yharon/Yharon.cs +++ b/NPCs/Yharon/Yharon.cs @@ -923,7 +923,10 @@ namespace CalamityMod.NPCs.Yharon if (Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 center = player.Center + new Vector2(0f, -540f); + float bulletHellTeleportLocationDistance = 540f; + Vector2 defaultTeleportLocation = new Vector2(0f, -bulletHellTeleportLocationDistance); + Vector2 teleportLocation = -(player.velocity.SafeNormalize(Vector2.Zero) * bulletHellTeleportLocationDistance); + Vector2 center = player.Center + (teleportLocation == Vector2.Zero ? defaultTeleportLocation : teleportLocation); NPC.Center = center; int type = ModContent.ProjectileType(); @@ -1297,7 +1300,10 @@ namespace CalamityMod.NPCs.Yharon if (Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 center = player.Center + new Vector2(0f, -540f); + float bulletHellTeleportLocationDistance = 540f; + Vector2 defaultTeleportLocation = new Vector2(0f, -bulletHellTeleportLocationDistance); + Vector2 teleportLocation = -(player.velocity.SafeNormalize(Vector2.Zero) * bulletHellTeleportLocationDistance); + Vector2 center = player.Center + (teleportLocation == Vector2.Zero ? defaultTeleportLocation : teleportLocation); NPC.Center = center; int type = ModContent.ProjectileType(); @@ -2042,7 +2048,10 @@ namespace CalamityMod.NPCs.Yharon NPC.SpawnOnPlayer(NPC.FindClosestPlayer(), ModContent.NPCType()); } - Vector2 center = targetData.Center + new Vector2(0f, -540f); + float bulletHellTeleportLocationDistance = 540f; + Vector2 defaultTeleportLocation = new Vector2(0f, -bulletHellTeleportLocationDistance); + Vector2 teleportLocation = -(targetData.velocity.SafeNormalize(Vector2.Zero) * bulletHellTeleportLocationDistance); + Vector2 center = targetData.Center + (teleportLocation == Vector2.Zero ? defaultTeleportLocation : teleportLocation); NPC.Center = center; int type = ModContent.ProjectileType();