fix: Fixes turning to target on spellcast (#2107)

This commit is contained in:
Bohica 2025-02-03 17:38:07 -08:00 committed by GitHub
parent 2c806cb072
commit de12f8cb02
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -178,21 +178,26 @@ namespace Server.Spells
public static void Turn(Mobile from, IPoint3D to) public static void Turn(Mobile from, IPoint3D to)
{ {
if (from == null) if (from == null || to == null || from.Equals(to))
{ {
return; return;
} }
var root = (to as Item)?.RootParent; if (to is Item item)
if (from != root)
{ {
to = root; var root = item.RootParent;
if (root != null)
{
if (from == root)
{
return;
}
to = root;
}
} }
if (!from.Equals(to)) from.Direction = from.GetDirectionTo(to);
{
from.Direction = from.GetDirectionTo(to);
}
} }
public static bool CheckCombat(Mobile m) public static bool CheckCombat(Mobile m)