From 8bf2e133de607c17a898bec2264f55aa463a3fa7 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期五, 10 五月 2019 16:37:12 +0800
Subject: [PATCH] 6603 【后端】【2.0】增加新版的sp和被动技能 - 4012状态判定增加 查找是否释放者

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveBuffEffMng.py             |    2 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/PrintNPCInfo.py            |    3 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/GameBuffs/BuffProcess_1033.py    |   29 ---------
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveBuff/PassiveBuff_4505.py  |   32 ++++++++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameObj.py                             |   42 +++++++++++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/GameBuffs/Buff_4012.py           |    2 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveBuff/PassiveSkill_4003.py |   22 ++++---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveBuff/PassiveSkill_4015.py |    8 ++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py                            |    5 +
 9 files changed, 100 insertions(+), 45 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
index 19bf715..fa4bf21 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -584,7 +584,7 @@
 Def_Skill_Effect_ProcessAttack = 1314  # 间隔性攻击,A值为攻击次数,B值为是否广播客户端
 Def_Skill_Effect_BuffTick = 9999    #BUFF的时间处理间隔
 Def_Skill_Effect_BurnToAddHP = 1091    #buff中灼烧伤害转化吸血给 放灼烧者
-Def_Skill_Effect_ProBloodPer = 4505    #buff中中毒伤害百分比增加(给受害者的buff)
+
 
 #写死的技能效果ID------------NPC专用
 Def_Skill_Effect_AttackMove = 2100    # NPC位移战斗
@@ -1324,6 +1324,9 @@
                            Def_SkillType_Aura         ,  #光环技能  10
                            Def_SkillType_Summon       ,  #召唤  13
                            ]
+    
+# 玩家独有的,NPC没有这些接口
+Def_BuffType_OnlyPlayer = [IPY_GameWorld.bfIncBuff, IPY_GameWorld.btPassiveBuf, IPY_GameWorld.bfEquipBuff, IPY_GameWorld.bfMapBuff]
       
 # Buff层级增减定义
 Def_BuffLayer_Add = 0   # 每次触发层级递增
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/PrintNPCInfo.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/PrintNPCInfo.py
index 10c33ba..647b353 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/PrintNPCInfo.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/PrintNPCInfo.py
@@ -24,6 +24,7 @@
 import GMCommon
 import FamilyRobBoss
 import ShareDefine
+import ChConfig
 
 import random
 #---------------------------------------------------------------------
@@ -69,7 +70,7 @@
 
 def PrintNPCBuff(curPlayer, curNPC):
     for buffType in range(IPY_GameWorld.bfBuff, IPY_GameWorld.btBufMax):
-        if buffType in [IPY_GameWorld.bfIncBuff, IPY_GameWorld.btPassiveBuf, IPY_GameWorld.bfEquipBuff, IPY_GameWorld.bfMapBuff]:
+        if buffType in ChConfig.Def_BuffType_OnlyPlayer:
             continue
         PrintBuffState(curPlayer, curNPC, buffType)
     return
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameObj.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameObj.py
index 0439145..cddd6b8 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameObj.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameObj.py
@@ -16,6 +16,7 @@
 import ChConfig
 import IPY_GameWorld
 import IpyGameDataPY
+import SkillCommon
 
 # 关于血量的函数这里只包装最简单的超DWORD处理
 
@@ -92,12 +93,51 @@
 # #  目前当目标身上多个buff都有同一效果时(如定身),在一个buff消失时会解除该状态
 # #  故该状态标记仅为一个非精确的标记,应用中请注意!!!(当且仅当多个buff有同一个效果时会提前结束该状态)
 #===============================================================================
-def GetPyPlayerState(gameObj, pyState):
+def GetPyPlayerState(gameObj, pyState, ownerID = 0, ownerType = 0):
     curState = gameObj.GetDictByKey(ChConfig.Def_PlayerKey_CurState)
     
     state = curState & pow(2, pyState) 
+    
+    if state and ownerID:
+        # 进一步判断是否释放者
+        return True if IsInStateEffectByOwner(gameObj, ChConfig.Def_Skill_Effect_BuffState, pyState, ownerID, ownerType) else False
     return state
 
+# 大于等于2个状态 则不清理状态
+def IsInStateEffectByOwner(curObj, effectID, stateType, ownerID, ownerType):
+    
+    for buffType in xrange(IPY_GameWorld.bfBuff, IPY_GameWorld.btBufMax):
+        if buffType in ChConfig.Def_BuffType_OnlyPlayer:
+            continue
+        
+        buffTuple = SkillCommon.GetBuffManagerByBuffType(curObj, buffType)
+        #通过类型获取目标的buff管理器为空,则跳出
+        if buffTuple == ():
+            continue
+    
+        buffManager = buffTuple[0]
+        
+        for i in range(buffManager.GetEffectCount()):
+            effect = buffManager.GetEffect(i)
+            if not effect:
+                continue
+            
+            if effect.GetEffectID() != effectID:
+                continue
+            
+            if effect.GetEffectValue(0) != stateType:
+                continue
+            
+            if buffManager.GetEffectOwnerID() != ownerID:
+                continue
+            
+            if buffManager.GetEffectOwnerType() != ownerType:
+                continue
+            
+            return True
+    return False
+
+
 def ClearPyPlayerState(gameObj):
     gameObj.SetDict(ChConfig.Def_PlayerKey_CurState, 0)
     return
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/GameBuffs/BuffProcess_1033.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/GameBuffs/BuffProcess_1033.py
index 18ebcb4..d22dcbc 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/GameBuffs/BuffProcess_1033.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/GameBuffs/BuffProcess_1033.py
@@ -40,9 +40,6 @@
     layer = max(curBuff.GetLayer(), 1)
     #单次伤害, 毒有层级的情况
     singleDecHP = curBuff.GetValue()*layer
-    #hurtPer = FindBuffPer(defender, curBuff)    # 找到另外一个buff对中毒的伤害加成
-    
-    #singleDecHP = int((hurtPer + ChConfig.Def_MaxRateValue)*1.0/ChConfig.Def_MaxRateValue*singleDecHP)
     #GameWorld.DebugLog("1033---------%s-%s-%s-%s"%(curBuff.GetValue(), layer, hurtPer, singleDecHP ) )
     #buff拥有者
     buffOwner = SkillCommon.GetBuffOwner(curBuff)
@@ -120,32 +117,6 @@
     return
 
 
-
-# 找到对应加成伤害的毒
-def FindBuffPer(curObj, curBuff):
-    ownerID = curBuff.GetOwnerID()
-    ownerType = curBuff.GetOwnerType()
-    
-    if not ownerType:
-        return 0
-    
-    buffManager = curObj.GetDeBuffState()
-    curEffect, plusValue, skillID = BuffSkill.FindBuffEffectByOwnertID(buffManager, ChConfig.Def_Skill_Effect_ProBloodPer, ownerID, ownerType)
-    if not curEffect:
-        return 0
-    
-    # buff相同归属者的指定buff才有伤害加成
-    for i in range(buffManager.GetBuffCount()):
-        findBuff = buffManager.GetBuff(i)
-        if findBuff.GetBuffID() != skillID:
-            continue
-        if findBuff.GetOwnerID() != ownerID:
-            continue
-        
-        if curEffect.GetEffectValue(1) == curBuff.GetBuffID():
-            return curEffect.GetEffectValue(0)
-
-    return 0
 
     
 
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/GameBuffs/Buff_4012.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/GameBuffs/Buff_4012.py
index d3f76e7..81fe579 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/GameBuffs/Buff_4012.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/GameBuffs/Buff_4012.py
@@ -66,7 +66,7 @@
 def CanDelStateEffect(curObj, effectID, stateType):
     cnt = 0
     for buffType in xrange(IPY_GameWorld.bfBuff, IPY_GameWorld.btBufMax):
-        if buffType in [IPY_GameWorld.bfIncBuff, IPY_GameWorld.btPassiveBuf, IPY_GameWorld.bfEquipBuff, IPY_GameWorld.bfMapBuff]:
+        if buffType in ChConfig.Def_BuffType_OnlyPlayer:
             continue
         
         buffTuple = SkillCommon.GetBuffManagerByBuffType(curObj, buffType)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveBuff/PassiveBuff_4505.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveBuff/PassiveBuff_4505.py
new file mode 100644
index 0000000..ee5cf49
--- /dev/null
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveBuff/PassiveBuff_4505.py
@@ -0,0 +1,32 @@
+#!/usr/bin/python
+# -*- coding: GBK -*-
+#
+##@package
+#
+# @todo: buff中攻击处于XX状态的目标附加技能伤害
+#
+# @author: Alee
+# @date 2019-5-10 下午03:56:42
+# @version 1.0
+#
+# @note: 
+#
+#---------------------------------------------------------------------
+
+import ChConfig
+import GameObj
+
+def CheckCanHappen(attacker, defender, passiveEffect, skillID, **skillkwargs):
+    
+    ownerID, ownerType = 0, 0
+    if passiveEffect.GetEffectValue(2):
+        ownerID, ownerType = attacker.GetID(), attacker.GetGameObjType()
+    
+    if not GameObj.GetPyPlayerState(defender, passiveEffect.GetEffectValue(1), ownerID, ownerType):
+        return False
+        
+    return True
+
+
+def GetValue(attacker, defender, passiveEffect):
+    return passiveEffect.GetEffectValue(0)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveBuff/PassiveSkill_4003.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveBuff/PassiveSkill_4003.py
index 23e9bfa..fc72112 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveBuff/PassiveSkill_4003.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveBuff/PassiveSkill_4003.py
@@ -1,10 +1,12 @@
 #!/usr/bin/python
 # -*- coding: GBK -*-
 #
-# @todo: 
+##@package
+#
+# @todo: 攻击处于XX状态下的目标后触发被动技能
 #
 # @author: Alee
-# @date 2018-1-9 下午09:39:37
+# @date 2019-5-10 下午03:44:42
 # @version 1.0
 #
 # @note: 
@@ -16,17 +18,17 @@
 import GameObj
 import PlayerControl
 
-# 目标某个状态时触发
+
 def CheckCanHappen(attacker, defender, effect, curSkill):
     if not defender:
         return False
     
-    if GameObj.GetPyPlayerState(defender, effect.GetEffectValue(1)):#ChConfig.Def_PlayerState_Stun):
-        #GameWorld.DebugLog("状态触发----%s"%effect.GetEffectValue(1))
-        return True
     
-    return False
+    ownerID, ownerType = 0, 0
+    if effect.GetEffectValue(1):
+        ownerID, ownerType = attacker.GetID(), attacker.GetGameObjType()
     
-# 增加伤害值
-def GetValue(attacker, defender, effect):
-    return effect.GetEffectValue(0)
+    if not GameObj.GetPyPlayerState(defender, effect.GetEffectValue(0), ownerID, ownerType):
+        return False
+
+    return True
\ No newline at end of file
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveBuff/PassiveSkill_4015.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveBuff/PassiveSkill_4015.py
index 3750e99..77da405 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveBuff/PassiveSkill_4015.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveBuff/PassiveSkill_4015.py
@@ -21,8 +21,12 @@
     if not defender:
         return False
     
-    if GameObj.GetPyPlayerState(defender, effect.GetEffectValue(1)):#ChConfig.Def_PlayerState_Stun):
-        GameWorld.DebugLog("状态触发----%s"%effect.GetEffectValue(1))
+    ownerID, ownerType = 0, 0
+    if effect.GetEffectValue(2):
+        ownerID, ownerType = attacker.GetID(), attacker.GetGameObjType()
+        
+    if GameObj.GetPyPlayerState(defender, effect.GetEffectValue(1), ownerID, ownerType):#ChConfig.Def_PlayerState_Stun):
+        #GameWorld.DebugLog("状态触发----%s"%effect.GetEffectValue(1))
         return True
     
     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 985bfd7..47def0e 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveBuffEffMng.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveBuffEffMng.py
@@ -284,6 +284,7 @@
              
              4000:ChConfig.TriggerType_BuffState,   # 进入4012的某个状态触发技能 2
              4001:ChConfig.TriggerType_TagBuffState,   # 目标进入4012的某个状态触发技能 2
+             4003:ChConfig.TriggerType_AttackOver,  # 攻击(对敌技能)后被动技能被触发 4
              4004:ChConfig.TriggerType_AttackOver,  # 攻击(对敌技能)后被动技能被触发 4
              4005:ChConfig.TriggerType_AttackAddSkillPer,  # 所有攻击伤害(SkillPer)增加,含普攻,计算时 5
              4006:ChConfig.TriggerType_SuperHit, # 暴击时 触发技能6,
@@ -400,6 +401,7 @@
              4502:ChConfig.TriggerType_BeAttackOver, # BUFF类:被攻击触发技能
              4503:ChConfig.TriggerType_AttackOver, # BUFF类:攻击触发新技能
              4504:ChConfig.TriggerType_BounceHP,  # BUFF类: 反弹伤害固定值
+             4505:ChConfig.TriggerType_AttackAddSkillPer, # BUFF类:提高主动技能的技能伤害
              4506:ChConfig.TriggerType_BeAttackOver, # BUFF类:被攻击触发技能  只刷新属性 不触发技能
              4507:ChConfig.TriggerType_Buff_AddSuperHitRate, # BUFF类:增加暴击率
              4508:ChConfig.TriggerType_Buff_AttackSubLayer,  # BUFF类:攻击减buff层,0消失

--
Gitblit v1.8.0