From 6274c5968871f06e479bf138259c433f5fd7534f Mon Sep 17 00:00:00 2001
From: xdh <xiefantasy@qq.com>
Date: 星期二, 26 三月 2019 14:20:26 +0800
Subject: [PATCH] 6351 【后端】【2.1】新版骑宠争夺(查询血量)
---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/BuffSkill.py | 125 +++++++++++++++++++++++++++++++++++------
1 files changed, 105 insertions(+), 20 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 818c75f..3c3f3ae 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 PlayerTJG
import OperControlManager
import GameObj
+import CrossPlayerData
#---------------------------------------------------------------------
#---------------------------------------------------------------------
@@ -35,18 +36,24 @@
# @param tick 当前时间
# @param value Buff总值->用于持续类技能
# @param buffOwner Buff拥有者
-# @return None
-# @remarks 函数详细说明.
-def DoAddBuff( curObj, buffType, curSkill, tick, addBuffValueList = [], buffOwner = None ):
+# @param addForce 代表是否一定添加buff,避免互相反弹buff
+def DoAddBuff( curObj, buffType, curSkill, tick, addBuffValueList = [], buffOwner = None, addForce = False ):
if curObj == None:
# 避免配表错误导致报错
return False
+
+ if GameWorld.GetMap().GetMapID() == ChConfig.Def_FBMapID_GatherSoul and curObj.GetGameObjType() == IPY_GameWorld.gotNPC:
+ if curSkill.GetSkillTypeID() != 23052:
+ #GameWorld.DebugLog('聚魂副本玩家不能对怪物上buff curSkill=%s,buffOwner=%s'%(curSkill.GetSkillTypeID(),buffOwner.GetID()))
+ return True
+ #GameWorld.DebugLog('聚魂副本对怪物上buff curSkill=%s,buffOwner=%s'%(curSkill.GetSkillTypeID(),buffOwner.GetID()))
+
if curObj.GetGameObjType() == IPY_GameWorld.gotNPC and curObj.GetIsBoss() not in ChConfig.Def_SkillAttack_NPCIsBoss \
and SkillCommon.GetSkillBattleType(curSkill) == ChConfig.Def_BattleRelationType_CommNoBoss:
# 释放后 对指定BOSS无效的技能
return True
- result = AddBuffNoRefreshState(curObj, buffType, curSkill, tick, addBuffValueList, buffOwner)
+ result = AddBuffNoRefreshState(curObj, buffType, curSkill, tick, addBuffValueList, buffOwner, addForce)
if result is not 0:
# 被抵消的buff 不处理
@@ -69,8 +76,7 @@
#异常
else:
GameWorld.Log("添加buff刷新失败 curObjType = %s"%(curObjType))
-
-
+
return result
@@ -111,8 +117,9 @@
## 增加BUFF 减少BUFF(参数 -> 当前对象,buff类型,当前技能,当前时间,Buff总值->用于持续类技能 , Buff拥有者)
# buff的effect在添加和删除的时候处理,buff共存由buff本身决定而不是effect互斥,不再统一调用RefreshPlayerBuffOnAttrAddEffect
# plusValueList 改为buff value列表 第一个为增加数值,其他自定义
+# addForce 表示是否一定会增加buff,避免互相反弹buff
# 返回值 返回真刷属性,返回0 代表被抵消buff
-def AddBuffNoRefreshState( curObj, buffType, curSkill, tick, plusValueList=[] , buffOwner = None ):
+def AddBuffNoRefreshState( curObj, buffType, curSkill, tick, plusValueList=[], buffOwner = None, addForce = False):
if not SkillCommon.IsBuff(curSkill):
GameWorld.ErrLog("%s 不能加这个buff, 因为它是攻击技能! %s-->TypeID = %d"%(curObj.GetName(), curSkill.GetSkillName(), curSkill.GetSkillType()))
return False
@@ -122,11 +129,16 @@
if buffTuple == ():
return False
- if curSkill.GetSkillType() in ChConfig.Def_Debuff_List:
+ if not addForce and curSkill.GetSkillType() in ChConfig.Def_Debuff_List:
if PassiveBuffEffMng.OnPassiveSkillHappen(curObj, buffOwner, curSkill, ChConfig.TriggerType_DebuffOff, tick):
# 此处必须返回0 用于外层判断被抵消
return 0
+ if PassiveBuffEffMng.OnPassiveBuffHappen(curObj, buffOwner, curSkill, ChConfig.TriggerType_DebuffOff, tick):
+ # 被动类buff抵消
+ # 此处必须返回0 用于外层判断被抵消
+ return 0
+
buffState = buffTuple[0]
maxBuffCount = buffTuple[1]
buffCount = buffState.GetBuffCount()
@@ -145,6 +157,9 @@
#用于BUFF满的时候处理刷新逻辑
isDelRefresh = False
+ # 向跨服发送数据
+ CrossPlayerData.SendMergeData_Buff(curObj, curSkillID, plusValueList)
+
# buff层级
layerMaxCnt = 0
layerCalc = 0
@@ -152,6 +167,7 @@
if hasEffect:
layerMaxCnt = hasEffect.GetEffectValue(0) # 能叠加的最大上限
layerCalc = hasEffect.GetEffectValue(1) # 增加层级还是减少层级 Def_BuffLayer_Add
+
#1 检查是否有相同的BUFF,如果有相同的就刷新时间
for i in range( 0, buffCount ):
@@ -202,10 +218,15 @@
if curLayerCnt < layerMaxCnt:
if layerCalc == ChConfig.Def_BuffLayer_Add:
curBuff.SetLayer(curLayerCnt + 1)
+ #BUFF层级变化触发被动
+ if buffOwner:
+ curObj.SetDict(ChConfig.Def_PlayerKey_AddBuffLayer, curBuff.GetLayer())
+ PassiveBuffEffMng.OnPassiveSkillTrigger(buffOwner, curObj, curSkill, ChConfig.TriggerType_AddLayer, tick)
+ PassiveBuffEffMng.OnPassiveBuffTrigger(buffOwner, curObj, curSkill, ChConfig.TriggerType_AddLayer, tick)
+ curObj.SetDict(ChConfig.Def_PlayerKey_AddBuffLayer, 0)
else:
curBuff.SetLayer(layerMaxCnt)
changeLayer = True
-
__BuffCanRemain(buffState, curBuff, i, resultTime, plusValueList, buffOwner)
# 此处考虑下plusValue变强是否刷属性
#DoAddBuffOver(curObj, curSkill, addBuff, tick)
@@ -300,7 +321,8 @@
#是否需要通知客户端
isNotify = True if curSkill.GetClientEffectType() != 0 else False
- addBuff = buffState.AddBuffEx(skillID, tick, isNotify)
+ # 增加第四个参数是否立即广播
+ addBuff = buffState.AddBuff(skillID, tick, isNotify, False)
buffIndex = buffState.GetBuffCount() # buff在管理器中的索引
if updProcessInterval > 0:
# 继承上一个buff的循环记录
@@ -357,10 +379,12 @@
#添加BUFF后的特殊处理
- DoAddBuffOver(curObj, curSkill, addBuff, tick)
+ DoAddBuffOver(curObj, curSkill, addBuff, buffOwner, tick)
# 通知客户端
- buffState.Sync_AddBuffEx()
+ #buffState.Sync_AddBuffEx()
+ if isNotify:
+ PYSync_RefreshBuff(curObj, addBuff, SkillCommon.GetBuffType(curSkill), notifyAll=False, owner = buffOwner)
#检查是否属于刷新BUFF
#===========================================================================
@@ -377,7 +401,11 @@
# @param addBuff 玩家身上的BUFF实例
# @param tick 时间戳
# @return None
-def DoAddBuffOver(curObj, curSkill, addBuff, tick):
+def DoAddBuffOver(curObj, curSkill, addBuff, buffOwner, tick):
+ #触发被动技能
+ if buffOwner:
+ PassiveBuffEffMng.OnPassiveSkillTrigger(buffOwner, curObj, curSkill, ChConfig.TriggerType_AddBuffOver, tick)
+
#是否是持续性技能
isLstSkill = curSkill.GetSkillType() in ChConfig.Def_LstBuff_List
@@ -705,6 +733,47 @@
if passiveEff:
passiveEff.DelBuffInfo(skillData)
return
+
+
+#---------------------------------------------------------------------
+## 执行buff消失触发逻辑,不处理buff的功能逻辑,只处理需要的必须状态逻辑
+# 如不处理buff的 伤害,爆炸等,但必须处理恢复眩晕状态等
+def DoBuffDisApperEx( curObj, curBuff, tick ):
+ #这个函数里面不能做Buff添加和删除逻辑!!!!!不然指针会错乱
+ curSkill = curBuff.GetSkill()
+
+ skillData = GameWorld.GetGameData().GetSkillBySkillID(curSkill.GetSkillID())
+
+ #是否是持续性技能
+ isLstSkill = curSkill.GetSkillType() in ChConfig.Def_LstBuff_List
+
+ PassiveBuffEffMng.OnPassiveSkillTrigger(curObj, None, curSkill, ChConfig.TriggerType_BuffDisappear, tick)
+
+ #buff消失的触发
+ for effectIndex in range( 0, curSkill.GetEffectCount() ):
+ curEffect = curSkill.GetEffect( effectIndex )
+ effectID = curEffect.GetEffectID()
+
+ if not effectID:
+ continue
+
+ if isLstSkill:
+ callFunc = GameWorld.GetExecFunc( GameBuffs, "BuffProcess_%d.%s"%( effectID, "OnBuffDisappearEx") )
+ if not callFunc:
+ callFunc = GameWorld.GetExecFunc( GameBuffs, "Buff_%d.%s"%( effectID, "OnBuffDisappearEx") )
+ else:
+ callFunc = GameWorld.GetExecFunc( GameBuffs, "Buff_%d.%s"%( effectID, "OnBuffDisappearEx") )
+
+ if not callFunc:
+ continue
+
+ callFunc( curObj, curSkill, curBuff, curEffect, tick )
+
+ passiveEff = PassiveBuffEffMng.GetPassiveEffManager().GetPassiveEff(curObj)
+ if passiveEff:
+ passiveEff.DelBuffInfo(skillData)
+ return
+
#---------------------------------------------------------------------
## buff消失
# @param curObj 当前目标
@@ -815,12 +884,24 @@
# 当层级为0的时候删除此buff
-def SetBuffLayer(curPlayer, buff, layer, delBuff=True, skillTypeID=0, disappearTrigger=True):
+def SetBuffLayer(gameObj, buff, layer, delBuff=True, skillTypeID=0, disappearTrigger=True):
buff.SetLayer(layer)
if layer == 0 and delBuff:
tick = GameWorld.GetGameWorld().GetTick()
- DelBuffBySkillTypeID(curPlayer, skillTypeID, tick, disappearTrigger)
- PlayerControl.PlayerControl(curPlayer).RefreshPlayerAttrByBuff()
+ DelBuffBySkillTypeID(gameObj, skillTypeID, tick, disappearTrigger)
+
+ curObjType = gameObj.GetGameObjType()
+ #玩家
+ if curObjType == IPY_GameWorld.gotPlayer:
+ #刷新玩家属性
+ playerControl = PlayerControl.PlayerControl(gameObj)
+ #playerControl.CalcPassiveBuffAttr()
+ playerControl.RefreshPlayerAttrByBuff()
+ #NPC
+ elif curObjType == IPY_GameWorld.gotNPC:
+ npcControl = NPCCommon.NPCControl(gameObj)
+ npcControl.RefreshNPCAttrState()
+
return
@@ -881,9 +962,8 @@
return DelBuffBySkillID(curObj, skillID, tick)
-def PYSync_RefreshBuff(gameObj, curBuff, buffType):
+def PYSync_RefreshBuff(gameObj, curBuff, buffType, notifyAll=True, owner = None):
sendPack = ChNetSendPack.tagObjAddBuff()
- sendPack
sendPack.ObjType = gameObj.GetGameObjType()
sendPack.ObjID = gameObj.GetID();
@@ -894,7 +974,12 @@
sendPack.Value1 = curBuff.GetValue1();
sendPack.Value2 = curBuff.GetValue2();
sendPack.Layer = curBuff.GetLayer();
- gameObj.NotifyAll(sendPack.GetBuffer(), sendPack.GetLength());
-
+ if owner:
+ sendPack.OwnerID = owner.GetID()
+ sendPack.OwnerType = owner.GetGameObjType()
+ if notifyAll or gameObj.GetGameObjType() != IPY_GameWorld.gotPlayer:
+ gameObj.NotifyAll(sendPack.GetBuffer(), sendPack.GetLength());
+ else:
+ PlayerControl.PyNotifyAll(gameObj, sendPack, notifySelf=True, notifyCnt=-1)
\ No newline at end of file
--
Gitblit v1.8.0