Browse Source

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

meijun 3 years ago
parent
commit
b359d2dd0f
1 changed files with 13 additions and 20 deletions
  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;
                 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;
                 return false;
             }
             }