fix: Fixes turning to target on spellcast (#2107)
This commit is contained in:
parent
2c806cb072
commit
de12f8cb02
1 changed files with 13 additions and 8 deletions
|
|
@ -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)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue