From 18a10a74bd18363b8a325044d0cec5e4838531a3 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期日, 05 五月 2019 10:55:50 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.87:10010/r/SnxxServerCode

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/BuffSkill.py |   30 ++++++++++++++++++++++++++++--
 1 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/BuffSkill.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/BuffSkill.py
index 338b59f..88f9e7d 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/BuffSkill.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/BuffSkill.py
@@ -88,6 +88,10 @@
 def GetBuffReplaceType(curSkill):
     return curSkill.GetCanRepeatTime()/10
 
+# buff根据释放者不同判断是否共存buff,百位数 Def_Buff_NoCoexist 
+def GetBuffCoexistType(curSkill):
+    return curSkill.GetCanRepeatTime()/10%10
+
 def GetBuffMaxLayer(curSkill):
     layerMaxCnt = 0
     hasEffect = SkillCommon.GetSkillEffectByEffectID(curSkill, ChConfig.Def_Skill_Effect_LayerCnt)
@@ -148,6 +152,8 @@
     curSkillLV = curSkill.GetSkillLV()
     #替换模式
     buffReplaceType = GetBuffReplaceType(curSkill)
+    #共存模式 
+    buffCoexistType = GetBuffCoexistType(curSkill)
     #时间处理类型
     buffRepeatTimeType = GetBuffRepeatTimeType(curSkill) 
     #用于BUFF满的时候处理刷新逻辑
@@ -176,9 +182,9 @@
         if buffSkill.GetSkillTypeID() != curSkillTypeID:
             continue
         
-        if buffReplaceType == ChConfig.Def_Buff_Coexist and buffOwner:
+        if buffCoexistType == ChConfig.Def_Buff_Coexist and buffOwner:
             #可同时存在的buff,判断释放者是否不一样
-            if buffSkill.GetOwnerID() != buffOwner.GetID() or buffSkill.GetOwnerType() != buffOwner.GetGameObjType():
+            if curBuff.GetOwnerID() != buffOwner.GetID() or curBuff.GetOwnerType() != buffOwner.GetGameObjType():
                 continue
         
         #--------------技能类型ID相同
@@ -627,6 +633,9 @@
     
     index = 0
     isPlayerTJG = (curObj.GetGameObjType() == IPY_GameWorld.gotPlayer and PlayerTJG.GetIsTJG(curObj))
+    
+    skillIDListInDelBuff = []   # buff消失中需要处理添加buff,外层处理避免错乱
+    
     while index < buffState.GetBuffCount():
         curBuff = buffState.GetBuff( index )
         if not curBuff:
@@ -675,12 +684,29 @@
         buffState.DeleteBuffByIndex( index )
         SkillShell.ClearBuffEffectBySkillID(curObj, curSkill.GetSkillID(), ownerID, ownerType)
         
+        addSkillID = curObj.GetDictByKey(ChConfig.Def_PlayerKey_SkillInDelBuff) 
+        if addSkillID and addSkillID not in skillIDListInDelBuff:
+            skillIDListInDelBuff.append(addSkillID)
+        
+    OnSkillAfterBuffDisappear(curObj, skillIDListInDelBuff, tick)
+    
     #执行DoBuffDisApper中,标记的玩家处理要求
     __DoBuffDisApperByKey( curObj , tick )
         
     return isRefresh, delResult
 
 
+# DoBuffDisApper不能做Buff添加和删除逻辑!!!!!不然指针会错乱, 故在外层处理
+def OnSkillAfterBuffDisappear(curObj, skillIDListInDelBuff, tick):
+    posX, posY = curObj.GetPosX(), curObj.GetPosY()
+    for skillID in skillIDListInDelBuff:
+        skillData = GameWorld.GetGameData().GetSkillBySkillID(skillID)
+        if not skillData:
+            continue
+        
+        SkillShell.Trigger_UseSkill(curObj, curObj, skillData, tick, posX, posY)
+    return
+
 #---------------------------------------------------------------------
 ## 执行buff消失触发逻辑
 #  @param curObj 当前OBj

--
Gitblit v1.8.0