From f0302a8aa76c1475917cbb09ec9a3ca599d65d3a Mon Sep 17 00:00:00 2001
From: xdh <xiefantasy@qq.com>
Date: 星期四, 30 五月 2019 10:12:33 +0800
Subject: [PATCH] 7003 【后端】【2.0】丹塔活跃值

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/BuffSkill.py |   65 ++++++++++++++++++++++++++------
 1 files changed, 53 insertions(+), 12 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..162dabd 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/BuffSkill.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/BuffSkill.py
@@ -25,6 +25,7 @@
 import OperControlManager
 import GameObj
 import CrossPlayerData
+import AttackCommon
 #---------------------------------------------------------------------
 
 #---------------------------------------------------------------------
@@ -51,6 +52,8 @@
     and SkillCommon.GetSkillBattleType(curSkill) == ChConfig.Def_BattleRelationType_CommNoBoss:
         # 释放后 对指定BOSS无效的技能
         return True
+    
+    buffOwner = AttackCommon.ElfChangeAttacker(buffOwner)  # Elf灵为替身攻击,要取玩家的属性
     
     result = AddBuffNoRefreshState(curObj, buffType, curSkill, tick, addBuffValueList, buffOwner, addForce)
     
@@ -88,6 +91,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)
@@ -119,7 +126,7 @@
     if not SkillCommon.IsBuff(curSkill):
         GameWorld.ErrLog("%s 不能加这个buff, 因为它是攻击技能! %s-->TypeID = %d"%(curObj.GetName(), curSkill.GetSkillName(), curSkill.GetSkillType()))
         return False
-    
+
     buffTuple = SkillCommon.GetBuffManagerByBuffType( curObj, buffType )
     #通过类型获取目标的buff管理器为空,则跳出
     if buffTuple == ():
@@ -148,6 +155,8 @@
     curSkillLV = curSkill.GetSkillLV()
     #替换模式
     buffReplaceType = GetBuffReplaceType(curSkill)
+    #共存模式 
+    buffCoexistType = GetBuffCoexistType(curSkill)
     #时间处理类型
     buffRepeatTimeType = GetBuffRepeatTimeType(curSkill) 
     #用于BUFF满的时候处理刷新逻辑
@@ -176,9 +185,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相同
@@ -223,14 +232,13 @@
                 changeLayer = True
                     
             # Def_Buff_Replace_New和Def_Buff_Recharge 均可走到此逻辑
-            __BuffCanRemain(buffState, curBuff, i, resultTime, plusValueList, buffOwner)
-            # 此处考虑下plusValue变强是否刷属性
-            #DoAddBuffOver(curObj, curSkill, addBuff, tick)
+            __BuffCanRemain(curObj, buffState, curBuff, i, resultTime, plusValueList, buffOwner)
+
             return changeLayer
         else:
             if buffReplaceType == ChConfig.Def_Buff_Recharge:
                 # 充能型
-                __BuffCanRemain(buffState, curBuff, i, resultTime, plusValueList, buffOwner)
+                __BuffCanRemain(curObj, buffState, curBuff, i, resultTime, plusValueList, buffOwner)
                 return
             
             processInterval = curBuff.GetProcessInterval()
@@ -372,7 +380,7 @@
         if triggerType == -1:
             continue
         passiveEff = PassiveBuffEffMng.GetPassiveEffManager().InitObjPassiveEff(curObj)
-        passiveEff.AddBuffInfoByEffect(curEffect, skillID)
+        passiveEff.AddBuffInfoByEffect(curEffect, skillID, onwerID, onwerType)
 
         
     #添加BUFF后的特殊处理
@@ -402,7 +410,11 @@
     #触发被动技能
     if buffOwner:
         PassiveBuffEffMng.OnPassiveSkillTrigger(buffOwner, curObj, curSkill, ChConfig.TriggerType_AddBuffOver, tick)
-    
+        # 此处不能传技能curSkill 屏蔽被动触发被动限制
+        # 暂且特殊处理控制类buff才触发
+        if SkillCommon.GetBuffType(curSkill) == IPY_GameWorld.bfActionBuff:
+            PassiveBuffEffMng.OnPassiveBuffTrigger(curObj, buffOwner, None, ChConfig.TriggerType_AddBuffOver, tick)
+        
     #是否是持续性技能
     isLstSkill = curSkill.GetSkillType() in ChConfig.Def_LstBuff_List
     
@@ -424,7 +436,7 @@
         if not callFunc:
             continue
         
-        callFunc(curObj, addBuff, curEffect, tick)
+        callFunc(curObj, addBuff, curEffect, tick, buffOwner)
     
     return
 
@@ -532,14 +544,15 @@
 #  @param tick 当前时间
 #  @return None
 #  @remarks 函数详细说明.
-def __BuffCanRemain(buffState, curBuff, buffIndex, resultTime, plusValueList, buffOwner):
+def __BuffCanRemain(curObj, buffState, curBuff, buffIndex, resultTime, plusValueList, buffOwner):
     if resultTime != -1:
         curBuff.SetRemainTime(resultTime)
     #重置buff总值
     __SetBuffValue(curBuff , plusValueList , buffOwner)
 
     buffState.Sync_RefreshBuff(buffIndex, curBuff.GetRemainTime())
-        
+    
+    DoAddBuffOver(curObj, curBuff.GetSkill(), curBuff, buffOwner, GameWorld.GetGameWorld().GetTick())  
     return
 
 #---------------------------------------------------------------------
@@ -562,6 +575,8 @@
         return curBuff, i
     
     return None, 0
+
+
 #---------------------------------------------------------------------
 ## 刷新BUFF的时间
 #  @param curBuff 当前BUFF
@@ -627,6 +642,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 +693,35 @@
         buffState.DeleteBuffByIndex( index )
         SkillShell.ClearBuffEffectBySkillID(curObj, curSkill.GetSkillID(), ownerID, ownerType)
         
+        addSkillID = curObj.GetDictByKey(ChConfig.Def_PlayerKey_SkillInDelBuff) 
+        if addSkillID:
+            skillInfo = [addSkillID, ownerID, ownerType]
+            if skillInfo not in skillIDListInDelBuff:
+                skillIDListInDelBuff.append(skillInfo)
+            curObj.SetDict(ChConfig.Def_PlayerKey_SkillInDelBuff, 0) 
+            
+    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 skillInfo in skillIDListInDelBuff:
+        attacker = GameWorld.GetObj(skillInfo[1], skillInfo[2])
+        if not attacker:
+            attacker = curObj
+        skillData = GameWorld.GetGameData().GetSkillBySkillID(skillInfo[0])
+        if not skillData:
+            continue
+        
+        SkillShell.Trigger_UseSkill(attacker, curObj, skillData, tick, posX, posY)
+    return
+
 #---------------------------------------------------------------------
 ## 执行buff消失触发逻辑
 #  @param curObj 当前OBj

--
Gitblit v1.8.0