From f8cbb085900ff5959d302879b8073e5cf79aa322 Mon Sep 17 00:00:00 2001 From: hxp <ale99527@vip.qq.com> Date: 星期四, 27 十二月 2018 22:28:49 +0800 Subject: [PATCH] 5424 【后端】【1.4】跨服竞技场开发(修复无法领奖bug) --- ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/BuffSkill.py | 80 ++++++++++++++++++++++++++++++---------- 1 files changed, 60 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..c035c9f 100644 --- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/BuffSkill.py +++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/BuffSkill.py @@ -35,18 +35,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 buffOwner and curObj.GetGameObjType() == IPY_GameWorld.gotNPC: + if buffOwner.GetGameObjType() == IPY_GameWorld.gotPlayer or (buffOwner.GetGameObjType() == IPY_GameWorld.gotNPC and NPCCommon.GetNpcObjOwnerIsPlayer(buffOwner)): + #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 +75,7 @@ #异常 else: GameWorld.Log("添加buff刷新失败 curObjType = %s"%(curObjType)) - - + return result @@ -111,8 +116,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 +128,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() @@ -152,6 +163,7 @@ if hasEffect: layerMaxCnt = hasEffect.GetEffectValue(0) # 能叠加的最大上限 layerCalc = hasEffect.GetEffectValue(1) # 增加层级还是减少层级 Def_BuffLayer_Add + #1 检查是否有相同的BUFF,如果有相同的就刷新时间 for i in range( 0, buffCount ): @@ -202,10 +214,15 @@ if curLayerCnt < layerMaxCnt: if layerCalc == ChConfig.Def_BuffLayer_Add: curBuff.SetLayer(curLayerCnt + 1) + #BUFF层级变化触发被动 + if buffOwner: + curObj.SetDict("addBuffLayer", curBuff.GetLayer()) + PassiveBuffEffMng.OnPassiveSkillTrigger(buffOwner, curObj, curSkill, ChConfig.TriggerType_AddLayer, tick) + PassiveBuffEffMng.OnPassiveBuffTrigger(buffOwner, curObj, curSkill, ChConfig.TriggerType_AddLayer, tick) + curObj.SetDict("addBuffLayer", 0) else: curBuff.SetLayer(layerMaxCnt) changeLayer = True - __BuffCanRemain(buffState, curBuff, i, resultTime, plusValueList, buffOwner) # 此处考虑下plusValue变强是否刷属性 #DoAddBuffOver(curObj, curSkill, addBuff, tick) @@ -300,7 +317,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 +375,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 +397,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 @@ -815,12 +839,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 +917,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 +929,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