From 41057fec56d9aac981044aead9a74aac4b09ba4f Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期一, 09 十一月 2020 17:43:55 +0800
Subject: [PATCH] 8596 【港台】【后端】每日分享好礼;8599 【港台】【后端】好评有礼;

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameObj.py |   69 +++++++++++++++++++++++++++++++---
 1 files changed, 63 insertions(+), 6 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameObj.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameObj.py
index 61e27f2..c67d95b 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameObj.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameObj.py
@@ -15,6 +15,8 @@
 import ShareDefine
 import ChConfig
 import IPY_GameWorld
+import IpyGameDataPY
+import SkillCommon
 
 # 关于血量的函数这里只包装最简单的超DWORD处理
 
@@ -47,9 +49,11 @@
     if gameObj.GetGameObjType() == IPY_GameWorld.gotPlayer:
         gameObj.SetHP(value, isNotify)
     else:
-        if gameObj.GetType() == ChConfig.ntMonsterTime and not isByTime and value not in [GetMaxHP(gameObj), 0]:
-            #GameWorld.DebugLog("不能设置按时间掉血的怪物血量! id=%s,npciD=%s,value=%s,isByTime=%s" % (gameObj.GetID(), gameObj.GetNPCID(), value, isByTime))
-            return
+        if gameObj.GetGameObjType() == IPY_GameWorld.gotNPC:
+            npcID = gameObj.GetNPCID()
+            if IpyGameDataPY.GetIpyGameDataNotLog("NPCTimeLostHP", npcID) and not isByTime and value not in [GetMaxHP(gameObj), 0]:
+                #GameWorld.DebugLog("不能设置按时间掉血的怪物血量! id=%s,npciD=%s,value=%s,isByTime=%s" % (gameObj.GetID(), gameObj.GetNPCID(), value, isByTime))
+                return
         gameObj.SetHPEx(value/ShareDefine.Def_PerPointValue)
         gameObj.SetHP(value%ShareDefine.Def_PerPointValue)
         
@@ -59,6 +63,8 @@
 #  @param isTrue 是否设置该状态
 #  @return None
 def SetPyPlayerState(gameObj, pyState, isAdd):
+    if pyState == 0:
+        return
     if pyState not in ChConfig.Def_PlayerStateList:
         return
     
@@ -83,14 +89,65 @@
 #  @param pyState 状态
 #  @return 是否该状态
 #  @remarks 该状态为buff对应的自定义状态效果
-#  目前当目标身上多个buff都有同一效果时(如定身),在一个buff消失时会解除该状态
-#  故该状态标记仅为一个非精确的标记,应用中请注意!!!(当且仅当多个buff有同一个效果时会提前结束该状态)
-def GetPyPlayerState(gameObj, pyState):
+
+#===============================================================================
+# 此问题在4012 消失时处理
+# #  目前当目标身上多个buff都有同一效果时(如定身),在一个buff消失时会解除该状态
+# #  故该状态标记仅为一个非精确的标记,应用中请注意!!!(当且仅当多个buff有同一个效果时会提前结束该状态)
+#===============================================================================
+def GetPyPlayerState(gameObj, pyState, ownerID = 0, ownerType = 0):
+    if not gameObj:
+        return False
+    if pyState == 0:
+        # 0不需要判断
+        return True
     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(i) != ownerID:
+                continue
+            
+            if buffManager.GetEffectOwnerType(i) != ownerType:
+                continue
+            
+            return True
+    return False
+
+
+def ClearPyPlayerState(gameObj):
+    gameObj.SetDict(ChConfig.Def_PlayerKey_CurState, 0)
+    return
 
 def GetPetDamPer(gameObj): return gameObj.GetDictByKey(ChConfig.Def_PlayerKey_AttrPetDamPer)
 def SetPetDamPer(gameObj, value): 

--
Gitblit v1.8.0