Pārlūkot izejas kodu

【优化】MMO-19371安全区域检测优化

meijun 3 gadi atpakaļ
vecāks
revīzija
b359d2dd0f
1 mainītis faili ar 13 papildinājumiem un 20 dzēšanām
  1. 13 20
      XmdsCommonServer/Plugin/Scene/XmdsServerScene.cs

+ 13 - 20
XmdsCommonServer/Plugin/Scene/XmdsServerScene.cs

@@ -200,29 +200,22 @@ namespace XmdsCommonServer.Plugin.Scene
                 return false;
             }
 
-            #region 安全区域检测. 宠物不会是目标
-            if (expectTarget == SkillTemplate.CastTarget.Enemy)
-            {
-                XmdsVirtual dpPlayer = dp as XmdsVirtual_Player;
-                if (dpPlayer != null)
-                {
-                    XmdsVirtual spPlayer = sp as XmdsVirtual_Player;
-                    if (spPlayer == null && sp is XmdsVirtual_Pet)
-                    {
-                        spPlayer = (sp as XmdsVirtual_Pet).GetMaster();
-                    }
-                    if (spPlayer != null && (spPlayer.IsInSafeArea || dpPlayer.IsInSafeArea))
-                    {
-                        return false;
-                    }
-                }
-            }
 
-            #endregion
 
-            #region 中立单位检测.
+			#region 安全区域检测. 宠物不会是目标
+			if (expectTarget == SkillTemplate.CastTarget.Enemy && target.IsPlayerUnit && src.IsPlayerUnit)
+			{
+				if (target.Virtual.IsInSafeArea() || src.Virtual.IsInSafeArea())
+				{
+					return false;
+				}
+			}
+
+			#endregion
+
+			#region 中立单位检测.
 
-            if (target.Force == 0)  //0代表绝对中立.不能被攻击.
+			if (target.Force == 0)  //0代表绝对中立.不能被攻击.
             {
                 return false;
             }