From db7d27830266ab2ad943607195b7711d959bce87 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期一, 18 九月 2023 14:39:52 +0800
Subject: [PATCH] 9887 【主干】【骨折1、2】【小7】【1元】【BT10】本服与跨服竞技场PK公式优化(优化PVP木桩时某些PVP技能有效)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveBuffEffMng.py         |   26 +++++++++-----------------
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCAI/AIType_222.py            |    4 +---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/AttackCommon.py |   14 +++++++++++++-
 3 files changed, 23 insertions(+), 21 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 e96733f..097dbbe 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
@@ -453,18 +453,30 @@
     return ChConfig.Def_BattleRelationType_PVE
 
 # 判断PK关系是否可攻击 Def_BattleRelationType_CommNoBoss也可攻击 只是攻击无效果
-def CheckBattleRelationType(skillBattleType, battleRelationType):
+def CheckBattleRelationType(attacker, defender, curSkill, battleRelationType):
+    skillBattleType = SkillCommon.GetSkillBattleType(curSkill)
     if skillBattleType in [ChConfig.Def_BattleRelationType_Comm, ChConfig.Def_BattleRelationType_CommNoBoss]:
         return True
     
     #if battleRelationType in [ChConfig.Def_BattleRelationType_Comm, ChConfig.Def_BattleRelationType_CommNoBoss]:
     #    return True
     
+    # 当非PVP关系时,特殊PVP技能
+    if battleRelationType != ChConfig.Def_BattleRelationType_PVP:
+        if curSkill.GetSkillType() in [ChConfig.Def_SkillType_Atk, ChConfig.Def_SkillType_Passive] \
+            and SkillCommon.GetSkillBattleType(curSkill) == ChConfig.Def_BattleRelationType_PVP:
+            if attacker.GetGameObjType() == IPY_GameWorld.gotPlayer and IsPVPNPC(defender):
+                #GameWorld.DebugLog("---特殊PVP关系 atkID=%s vs defID=%s, skillID=%s" % (attacker.GetID(), defender.GetID(), curSkill.GetSkillID()))
+                return True
+            
     if skillBattleType != battleRelationType:
         # PK模式的判定
         return False
     return True
 
+def IsPVPNPC(obj):
+    return obj.GetGameObjType() == IPY_GameWorld.gotNPC and obj.GetType() in [ChConfig.ntPriWoodPilePVP]
+
 ## 获取攻击类型
 #  @param attack 攻击方对象
 #  @param attackUseSkill 攻击方使用的技能
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCAI/AIType_222.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCAI/AIType_222.py
index d9ae837..a42126d 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCAI/AIType_222.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCAI/AIType_222.py
@@ -105,9 +105,7 @@
         return True
     
     battleRelationType = AttackCommon.GetBattleRelationType(curNPC, curObj)
-    
-    skillBattleType = SkillCommon.GetSkillBattleType(curSkill)
-    if not AttackCommon.CheckBattleRelationType(skillBattleType, battleRelationType):
+    if not AttackCommon.CheckBattleRelationType(curNPC, curObj, curSkill, battleRelationType):
         # PK模式的判定
         return False
     
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveBuffEffMng.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveBuffEffMng.py
index 64f295e..598b4b1 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveBuffEffMng.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveBuffEffMng.py
@@ -1067,8 +1067,7 @@
         if SkillCommon.RefreshSkillRemainTime(curSkill, tick):
             continue
         
-        skillBattleType = SkillCommon.GetSkillBattleType(curSkill)
-        if not AttackCommon.CheckBattleRelationType(skillBattleType, battleRelationType):
+        if not AttackCommon.CheckBattleRelationType(attacker, defender, curSkill, battleRelationType):
             # PK模式的判定
             continue
         
@@ -1206,8 +1205,7 @@
             continue
         result = True   # 代表有效触发,但不关系触发结果
         
-        skillBattleType = SkillCommon.GetSkillBattleType(curSkill)
-        if not AttackCommon.CheckBattleRelationType(skillBattleType, battleRelationType):
+        if not AttackCommon.CheckBattleRelationType(attacker, defender, curSkill, battleRelationType):
             # PK模式的判定
             continue
         
@@ -1307,8 +1305,7 @@
         effect = SkillCommon.GetSkillEffectByEffectID(curSkill, effectID)
         if not effect:
             continue
-        skillBattleType = SkillCommon.GetSkillBattleType(curSkill)
-        if not AttackCommon.CheckBattleRelationType(skillBattleType, battleRelationType):
+        if not AttackCommon.CheckBattleRelationType(attacker, defender, curSkill, battleRelationType):
             continue
         
         pyName = "PassiveSkill_%s" % effectID
@@ -1369,8 +1366,7 @@
         effect = SkillCommon.GetSkillEffectByEffectID(curSkill, effectID)
         if not effect:
             continue
-        skillBattleType = SkillCommon.GetSkillBattleType(curSkill)
-        if not AttackCommon.CheckBattleRelationType(skillBattleType, battleRelationType):
+        if not AttackCommon.CheckBattleRelationType(attacker, defender, curSkill, battleRelationType):
             continue
         
         pyName = "PassiveSkill_%s" % effectID
@@ -1419,8 +1415,7 @@
             continue
         if SkillCommon.RefreshSkillRemainTime(curSkill, tick):
             continue
-        skillBattleType = SkillCommon.GetSkillBattleType(curSkill)
-        if not AttackCommon.CheckBattleRelationType(skillBattleType, battleRelationType):
+        if not AttackCommon.CheckBattleRelationType(attacker, defender, curSkill, battleRelationType):
             # PK模式的判定
             continue
             
@@ -1453,8 +1448,7 @@
     
     # 当前战斗关系 pvp pve
     battleRelationType = AttackCommon.GetBattleRelationType(attacker, defender)
-    skillBattleType = SkillCommon.GetSkillBattleType(tagSkill)
-    if not AttackCommon.CheckBattleRelationType(skillBattleType, battleRelationType):
+    if not AttackCommon.CheckBattleRelationType(attacker, defender, tagSkill, battleRelationType):
         return
 
     
@@ -1554,9 +1548,8 @@
             skillData = callFunc(passiveEffect)
             if not skillData:
                 continue
-
-            skillBattleType = SkillCommon.GetSkillBattleType(skillData)
-            if not AttackCommon.CheckBattleRelationType(skillBattleType, battleRelationType):
+            
+            if not AttackCommon.CheckBattleRelationType(attacker, defender, skillData, battleRelationType):
                 # PK模式的判定
                 continue
             
@@ -1597,8 +1590,7 @@
     
     # 当前战斗关系 pvp pve
     battleRelationType = AttackCommon.GetBattleRelationType(attacker, defender)
-    skillBattleType = SkillCommon.GetSkillBattleType(useSkill)
-    if not AttackCommon.CheckBattleRelationType(skillBattleType, battleRelationType):
+    if not AttackCommon.CheckBattleRelationType(attacker, defender, useSkill, battleRelationType):
         return 0
     
     useSkillID = useSkill.GetSkillID() if useSkill else 0

--
Gitblit v1.8.0