From de12f8cb02f9e8939a4ffd9bfe46cb26701ae4ed Mon Sep 17 00:00:00 2001 From: Bohica <53943479+Bohicatv@users.noreply.github.com> Date: Mon, 3 Feb 2025 17:38:07 -0800 Subject: [PATCH] fix: Fixes turning to target on spellcast (#2107) --- Projects/UOContent/Spells/Base/SpellHelper.cs | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/Projects/UOContent/Spells/Base/SpellHelper.cs b/Projects/UOContent/Spells/Base/SpellHelper.cs index 396e64fdbc..82de9a522e 100644 --- a/Projects/UOContent/Spells/Base/SpellHelper.cs +++ b/Projects/UOContent/Spells/Base/SpellHelper.cs @@ -178,21 +178,26 @@ public static bool CheckMulti(Point3D p, Map map, bool houses = true, int housin public static void Turn(Mobile from, IPoint3D to) { - if (from == null) + if (from == null || to == null || from.Equals(to)) { return; } - var root = (to as Item)?.RootParent; - if (from != root) + if (to is Item item) { - to = root; - } + var root = item.RootParent; + if (root != null) + { + if (from == root) + { + return; + } - if (!from.Equals(to)) - { - from.Direction = from.GetDirectionTo(to); + to = root; + } } + + from.Direction = from.GetDirectionTo(to); } public static bool CheckCombat(Mobile m)