| | |
| | | # @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 不处理
|
| | |
| | | #异常
|
| | | else:
|
| | | GameWorld.Log("添加buff刷新失败 curObjType = %s"%(curObjType))
|
| | |
|
| | | |
| | | |
| | | return result
|
| | |
|
| | |
|
| | |
| | | ## 增加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
|
| | |
| | | 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()
|
| | |
| | | if hasEffect:
|
| | | layerMaxCnt = hasEffect.GetEffectValue(0) # 能叠加的最大上限
|
| | | layerCalc = hasEffect.GetEffectValue(1) # 增加层级还是减少层级 Def_BuffLayer_Add
|
| | |
|
| | |
|
| | | #1 检查是否有相同的BUFF,如果有相同的就刷新时间
|
| | | for i in range( 0, buffCount ):
|
| | |
| | | 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)
|
| | |
| | |
|
| | | #是否需要通知客户端
|
| | | 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的循环记录
|
| | |
| | |
|
| | |
|
| | | #添加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
|
| | | #===========================================================================
|
| | |
| | | # @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
|
| | |
|
| | |
| | |
|
| | |
|
| | | # 当层级为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
|
| | |
|
| | |
|
| | |
| | |
|
| | | 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();
|
| | |
| | | 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)
|
| | |
|
| | | |