Skip to content

Commit

Permalink
fix: Fixes turning to target on spellcast (#2107)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bohicatv authored Feb 4, 2025
1 parent 2c806cb commit de12f8c
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions Projects/UOContent/Spells/Base/SpellHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit de12f8c

Please sign in to comment.