From f15a181fbf2b61631b51e5e3a431c7cff6b15029 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期四, 17 九月 2020 11:27:48 +0800
Subject: [PATCH] 8483 【后端】【主干】【changwei】【bt】协助方和被协助方任何模式不会互相造成伤害

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCHurtManager.py              |   22 ++++++++++++++++++++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/AttackCommon.py |    4 ++++
 2 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/AttackCommon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/AttackCommon.py
index 72a5b60..10ef793 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/AttackCommon.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/AttackCommon.py
@@ -2785,6 +2785,10 @@
     elif curPlayerAttackMode == IPY_GameWorld.amAll:
         pass
     
+    # 协助关系不可攻击
+    if NPCHurtManager.IsAssistRelation(curPlayer, tagPlayer):
+        return ChConfig.Type_Relation_Friend, ChConfig.Def_PASysMessage_NotAttackTeam
+        
     # 以下为所属区域的一些特殊处理
     #普通区
     if curPlayerAreaType == IPY_GameWorld.gatNormal:
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCHurtManager.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCHurtManager.py
index 9eae451..f4b8f72 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCHurtManager.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCHurtManager.py
@@ -267,6 +267,19 @@
         ## 是否助战伤血玩家
         return playerID in self.__assistPlayerIDDict
     
+    def __IsAssistRelation(self, playerID, assistPlayerID):
+        ## 是否存在协助关系
+        if assistPlayerID not in self.__assistPlayerIDDict:
+            return False
+        return self.__assistPlayerIDDict[assistPlayerID] == playerID
+    def IsAssistRelation(self, playerID, tagPlayerID):
+        ## 玩家双方是否协助关系
+        if self.__IsAssistRelation(playerID, tagPlayerID):
+            return True
+        if self.__IsAssistRelation(tagPlayerID, playerID):
+            return True
+        return False
+    
     def OnHurtPlayerEnterTeam(self, playerID, playerName, befTeamID, newTeam, tick):
         ''' 伤血玩家加入队伍
                                 个人伤害并入队伍伤害,个人所有协助玩家伤害重新统计,表现在协助伤害排行榜,协助玩家之后的伤害计入队伍伤害
@@ -1037,6 +1050,15 @@
         return False
     return defendHurtList.IsAssistPlayer(playerID)
 
+def IsAssistRelation(curPlayer, tagPlayer):
+    ## 双方是否协助关系
+    playerID = curPlayer.GetPlayerID()
+    tagPlayerID = tagPlayer.GetPlayerID()
+    for hurtList in PyGameData.g_npcHurtDict.values():
+        if hurtList.IsAssistRelation(playerID, tagPlayerID):
+            return True
+    return False
+
 def CheckPlayerCanAttackFBNPC(curPlayer, curNPC, mapID, isNotify=False):
     ## 检查玩家可否攻击有副本次数的NPC
     enterCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_EnterFbCntDay % mapID)

--
Gitblit v1.8.0