--local BuffManager = require "Battle/Logic/Buff/BuffManager/BuffManager" local FirstPersonEventDispatcher = require"Battle/Logic/Event/FirstPersonEventDispatcher" local EventSystem = require 'Event/EventSystem' --local BattleEventSystem = require"Battle/Logic/Event/BattleEventSystem" local BattleEventSystem = BattleEventSystem local BattleEventSystem_OnEntityImmuneHardControl = BattleEventSystem.OnEntityImmuneHardControl local BattleEventSystem_OnEntityAddBuffBefore = BattleEventSystem.OnEntityAddBuffBefore local BattleEventSystem_OnBuffAddLayerOrRefresh = BattleEventSystem.OnBuffAddLayerOrRefresh local BattleEventSystem_OnEntityAddBuffOrRefresh = BattleEventSystem.OnEntityAddBuffOrRefresh --buff local BuffSystem = {} local private = {} local ipairs = ipairs local pairs = pairs --缓存一些高频的变量和函数 local SpecialBuffs = LuaConst.SpecialBuffs local SPECIALBUFF_INDYING = SpecialBuffs.InDying local SPECIALBUFF_INDYINGSUPERARMOR = SpecialBuffs.InDyingWithSuperArmor local SPECIALBUFF_INDEADBODY = SpecialBuffs.InDeadBody local SPECIALBUFF_INDEADBODYWITHSUPERARMOR = SpecialBuffs.InDeadBodyWithSuperArmor local SPECIALBUFF_INNORMALWEAK = SpecialBuffs.InNormalWeak local SPECIALBUFF_INSUPERWEAK = SpecialBuffs.InSuperWeak local Const_Zero=FP.Const.Zero local LuaConst=LuaConst local BUFFTYPE_FLAGBUFF = LuaConst.BuffType.FlagBuff local BUFFGROUPTYPE_INVINCIBLE = LuaConst.BuffGroupType.Invincible local BUFFGROUPTYPE_SUPERARMOR = LuaConst.BuffGroupType.SuperArmor local BUFFGROUPTYPE_HARDCONTROL = LuaConst.BuffGroupType.HardControl local UIDAMAGETYPE_INVINCIBLE = LuaConst.UIDamageType.Invincible local UIDAMAGETYPE_SUPERARMOR = LuaConst.UIDamageType.SuperArmor local CHARACTERTYPE_HERO = LuaConst.CharacterType.Hero local BUFFGAINTYPE_BAD = LuaConst.EBuffGainType.BAD local MonsterBeTriggerType_None = LuaConst.MonsterBeTriggerType.None local EventID=EventID local BUFF_INVINCIBLE = 500085 local BuffManager = BuffManager local HaloOperator = require "Battle/Logic/Buff/BuffManager/BuffOperator_Halo" local CheckBuffImmune = BuffManager.CheckBuffImmune local CheckBuffMoveTime = BuffManager.CheckBuffMoveTime local TryExecuteBuffCanTrigger = BuffManager.TryExecuteBuffCanTrigger local ExecuteBuffExclusive = BuffManager.ExecuteBuffExclusive local TryExecuteBuffMove = BuffManager.TryExecuteBuffMove local ExecuteAddTrigger = BuffManager.ExecuteAddTrigger local DontShowHurtNumberFeatureTypeDic = {} DontShowHurtNumberFeatureTypeDic[2022] = true local DontShowHurtNumberBuffIdDic = { [104620104] = true, -- 左慈黑洞吸人 [104621104] = true, -- 左慈黑洞吸人 } local DataSheetManager = DataSheetManager local CONST_ILLUSION_ADOPT_BUFF_LIST = DataSheetManager.ConstData:GetDataByID("IllusionAdoptBuffGroup").IntListValue local DataSheetManager_BuffData = DataSheetManager.BuffData local _buffOp_Dic function BuffSystem.SetBuffOpDic(dic) _buffOp_Dic = dic end function BuffSystem.TryStopGrab(entity) if entity.components.base.GrabbedEntity then SystemManager.StopGrab(entity, entity.components.base.GrabbedEntity) end end --[[ 大变身 --]] function BuffSystem.OnChangeAvatar(entity, recover) BuffSystem.TryStopGrab(entity) local comp_Base = entity.components.base local bornBuffs = comp_Base.CurCharacterData.BornBuffs if bornBuffs then for i,buffId in ipairs(bornBuffs) do SystemManager.AddBuff(entity, buffId, entity) end end local battleBornBuffs = comp_Base.CurCharacterData.OnlyBattleBornBuffs -- 只有主将表才有这个字段,怪物表不存在 if battleBornBuffs then if not LevelManager.IsNoBattleLevel() then for i,buffId in ipairs(battleBornBuffs) do SystemManager.AddBuff(entity, buffId, entity, nil, nil) end end end end --[[ 小变身 --]] function BuffSystem.OnChangeModel(entity, canRideHorse) if not canRideHorse then SystemManager.AddBuff(entity,SpecialBuffs.ForceOffHorse,entity,nil,nil) else SystemManager.DeleteBuff(entity,SpecialBuffs.ForceOffHorse,entity) end end --[[ 霸体值变化 --]] function BuffSystem.OnAMChange(entity,val) if val == Const_Zero then local monsterFeature = entity.components.base.CurMonsterFeature if monsterFeature.AmBuff > 0 then SystemManager.DeleteBuff(entity,monsterFeature.AmBuff,entity) end end end function BuffSystem.DeleteDeadBuff(entity) --这里也得删除buff,死亡删除buff需要冗余删除,否则会出现一些奇怪的问题,比如眩晕时死亡不会播动画,或者鞭尸异常 --删除部分buff for i,buffObject in ipairs(entity.components.buff.CurBuffObjectList) do -- 移动到添加死亡Buff时了, BuffOperator_Sustained:AddHandles里添加了BUFFGROUP_DEAD的buff时 local buffData = buffObject.BuffInfoData if buffData.IsDeadDelete then local buffUpdateData = buffObject.BuffUpdateData local buffUpdateList = buffObject.BuffUpdateList local buffOperator = _buffOp_Dic[buffData.BuffType] if buffUpdateData then if buffUpdateData.BuffLayer >0 then -- require "Battle/Logic/Buff/BuffStatistic".DeleteOneBuff(buffData.BuffID, entity) buffOperator.Delete(buffData, entity, buffUpdateData,nil) end end if buffUpdateList then for i, updateData in ipairs(buffUpdateList) do if updateData.BuffLayer >0 then -- require "Battle/Logic/Buff/BuffStatistic".DeleteOneBuff(buffData.BuffID, entity) buffOperator.Delete(buffData, entity, updateData,nil) end end end end end end --[[ 死亡时 --]] function BuffSystem.OnDead(entity) BuffSystem.DeleteDeadBuff(entity) -- 添加死亡buff SystemManager.AddBuff(entity, SPECIALBUFF_INDYING, entity) end --[[ 直接死亡,删除存储entity的数据 --]] function BuffSystem.OnDeadQuit(entity) BuffSystem.DeleteDeadBuff(entity) private.ClearAllBuff(entity) end --[[ Win Battle Show 时要删除所有Buff ]]-- function BuffSystem.OnWinBattle(entity) private.ClearAllBuff(entity) SystemManager.AddBuff(entity, LuaConst.SkillInvincibleBuffID, entity) -- 防止其他buff改变朝向动作等 end function BuffSystem.AddBornBuffs(entity, isRevive) local comp_Attr = entity.components.attr if not comp_Attr:IsAlive() then return end local characterData = entity.components.base.CurCharacterData local specialBuffs = SpecialBuffs SystemManager.AddBuff(entity, specialBuffs.CanRotate, entity, nil, nil) SystemManager.AddBuff(entity, specialBuffs.CanRide, entity, nil, nil) if LevelManager.IsSyncTeamPVP() then -- 为保持3v3的逻辑和之前的一样(等人时可移动) SystemManager.AddBuff(entity, specialBuffs.CanMove, entity, nil, nil) end --bornBuffs得在specialBuffs.CanRotate、specialBuffs.CanMove、specialBuffs.CanRide之后添加 local bornBuffs = characterData.BornBuffs if bornBuffs then for i,buffId in ipairs(bornBuffs) do SystemManager.AddBuff(entity, buffId, entity, nil, nil) end end local battleBornBuffs = characterData.OnlyBattleBornBuffs -- 只有主将表才有这个字段,怪物表不存在 if battleBornBuffs then if not LevelManager.IsNoBattleLevel() then for i,buffId in ipairs(battleBornBuffs) do SystemManager.AddBuff(entity, buffId, entity, nil, nil) end end end --同步玩法,所有玩家进场后不能释放技能,在所有人都进场后才能释放技能 --复活后能释放技能 --非玩家能释放技能 if LevelManager.ShouldAddCanUseSkillToHeroWhenBorn() or isRevive or entity._logicInitData.CharacterType ~= CHARACTERTYPE_HERO then SystemManager.AddBuff(entity, specialBuffs.CanSkill, entity, nil, nil) SystemManager.AddBuff(entity, specialBuffs.CanMove, entity, nil, nil) end --非同步玩法,并且是玩家自己 -- --可以触发与敌人对峙 -- 对峙机制早就否决了,不再需要添加该buff了 -- if not LevelManager.IsSyncLevel() and entity._logicInitData.IsPlayerSelf then -- SystemManager.AddBuff(entity, specialBuffs.CanConfrontation, entity, nil, nil) -- end --特性buff local monsterFeature = entity.components.base.CurMonsterFeature if monsterFeature.IgnoreBlock then SystemManager.AddBuff(entity, specialBuffs.IgnoreBlock, entity) end if monsterFeature.IgnoreShoveOthers then SystemManager.AddBuff(entity, specialBuffs.IgnoreShoveOthers, entity) end if monsterFeature.AmBuff > 0 and comp_Attr:MaxAM() > Const_Zero then SystemManager.AddBuff(entity, monsterFeature.AmBuff, entity) end if monsterFeature.CantBeAim then SystemManager.AddBuff(entity, specialBuffs.CanNotBeTarget, entity) end if monsterFeature.BeSkillAim then SystemManager.AddBuff(entity, specialBuffs.BeSkillTarget, entity) end if monsterFeature.CantBeTrigger == MonsterBeTriggerType_None then SystemManager.AddBuff(entity, specialBuffs.CantBeTrigger, entity) end if monsterFeature.BeHitNotRotate then SystemManager.AddBuff(entity, specialBuffs.BeHitNotRotate, entity) end if entity:GetCharacterType() == LuaConst.CharacterType.Adjutant then SystemManager.AddBuff(entity,BUFF_INVINCIBLE,entity) end -- 如有天命,则添加天命的监听释放子弹buff if not isRevive and entity.components.weaponSoul then -- 有weaponSoul则需要 SystemManager.AddBuff(entity, specialBuffs.WeaponSoulEventBuffID, entity) end end -- function private.IsInSuperArmorMonster(entity) -- local monsterFeature = entity.components.base.CurMonsterFeature -- if monsterFeature then -- return monsterFeature.AmBuff == SpecialBuffs.InSuperArmor -- else -- return false -- end -- end --所有buff添加都必须走这里,否则会UI收不到事件 function BuffSystem.AddBuff(entity,buffId, sourceEntity, missile, ctrl) -- 新机制,死亡buff重定向↓ if buffId == SPECIALBUFF_INDYING then local monsterFeature = entity.components.base.CurMonsterFeature if monsterFeature and monsterFeature.AmBuff == SpecialBuffs.InSuperArmor then buffId = SPECIALBUFF_INDYINGSUPERARMOR end elseif buffId == SPECIALBUFF_INDEADBODY then local monsterFeature = entity.components.base.CurMonsterFeature if monsterFeature and monsterFeature.AmBuff == SpecialBuffs.InSuperArmor then buffId = SPECIALBUFF_INDEADBODYWITHSUPERARMOR end end -- 新机制,死亡buff重定向↑ -- if BuffManager.FilteredBuffIds[buffId] then -- return -- end local buffData = DataSheetManager_BuffData:GetDataByBuffID(buffId) if not buffData then logging.error(LTAG.ERROR, "HYW : 警告!试图添加没有配置的buff, buffId : ", buffId) return end -- if buffData.BuffType ~= LuaConst.BuffType.OnceBuff then -- require "Battle/Logic/Buff/BuffStatistic".AddOneBuff(buffId, entity) -- end local isImmune , buffGroupID = CheckBuffImmune(entity, buffData) if isImmune then if entity.CampID ~= (sourceEntity and sourceEntity:GetCampID() or nil) then --2022年3月4日 新增过滤,无敌、霸体在entity和sourceEntity的阵营不同时才显示 if buffGroupID == BUFFGROUPTYPE_INVINCIBLE then -- 被无敌拦截 local isFormPlayerSelf = sourceEntity and sourceEntity:SelfAndMasterIsPlayerSelf() if entity._logicInitData.IsPlayerSelf or isFormPlayerSelf then local featureID = entity:GetFeatureID() if featureID == nil or not (DontShowHurtNumberFeatureTypeDic[featureID] or DontShowHurtNumberBuffIdDic[buffId]) then entity.ExpEntity:CreateHurtNumber(0, entity._logicInitData.IsPlayerSelf, UIDAMAGETYPE_INVINCIBLE) end end elseif buffGroupID == BUFFGROUPTYPE_SUPERARMOR then -- 被霸体 拦截 local isFormPlayerSelf = sourceEntity and sourceEntity:SelfAndMasterIsPlayerSelf() if entity._logicInitData.IsPlayerSelf or (isFormPlayerSelf and entity._logicInitData.CharacterType == CHARACTERTYPE_HERO )then -- 只有hero才能显示霸体 字 local featureID = entity:GetFeatureID() if featureID == nil or not (DontShowHurtNumberFeatureTypeDic[featureID] or DontShowHurtNumberBuffIdDic[buffId]) then entity.ExpEntity:CreateHurtNumber(0, entity._logicInitData.IsPlayerSelf, UIDAMAGETYPE_SUPERARMOR) end end end end if buffData.BuffGroup == BUFFGROUPTYPE_HARDCONTROL then BattleEventSystem_OnEntityImmuneHardControl(entity)--暂时不传buffData参数了,因为目前用不上 end return end local buffComp = entity.components.buff --↓ 新增的写死的debuff免疫步骤 if buffData.GainType == BUFFGAINTYPE_BAD then if not buffComp:CanRecvDebuff() then logging.error(LTAG.ERROR, "HYW : 安全区免疫@ buffId : ", buffId) return end end --↑ 新增的写死的debuff免疫步骤 local buffOperator = _buffOp_Dic[buffData.BuffType] if not buffOperator then return end BattleEventSystem_OnEntityAddBuffBefore(entity,buffId,sourceEntity) local sourceEntityID = -1 if buffData.IsRecordSource and sourceEntity then sourceEntityID = sourceEntity._logicInitData.EntityID end -- 如果为子弹拖拽,修改拖拽时间 local moveData = nil local isSuccess = false if ctrl.MissileHitMoveID then isSuccess, moveData = DataSheetManager.BuffMoveData:TryGetDataByMissileID(ctrl.MissileHitMoveID) local hasmove, movetime = CheckBuffMoveTime(moveData, ctrl.HitMoveTime) if hasmove then ctrl.ForceDuration:Reset(movetime):Div(1000) end end -- 如果为虚弱loop buff,修改虚弱时间 if buffId == SPECIALBUFF_INNORMALWEAK or buffId == SPECIALBUFF_INSUPERWEAK then ctrl.ForceDuration:Reset(entity.components.base.CurCharacterData.WeakLoopTime):Div(1000) end TryExecuteBuffCanTrigger(entity, buffData, sourceEntityID, sourceEntity) local updateData,index = buffComp:GetBuffUpdateDataSourced(buffId, sourceEntityID) --为了处理自己互斥自己的情况,先判断互斥,再加进字典中 local hasBuff = updateData ~= nil hasBuff = ExecuteBuffExclusive(entity, buffData, hasBuff) local oldBuffLayer = 0 --如果已经存在此buff,则进行刷新;不存在则进行添加 if hasBuff then oldBuffLayer = updateData.BuffLayer updateData = buffOperator.Refresh(buffData, entity, sourceEntity, missile,ctrl, index) else updateData = buffOperator.Add(buffData, entity, sourceEntity, missile, ctrl, index) end if ctrl.MissileHitMoveID then TryExecuteBuffMove(entity, moveData, buffData, ctrl.HitMoveTime, ctrl.HitDistance, ctrl.HitMoveDir, ctrl.HitMoveDirOffsetAngle,missile, sourceEntity) end if not updateData then return end local isSuccess, buffTriggerData = DataSheetManager.BuffTriggerData:TryGetDataByBuffID(buffId) if isSuccess then ExecuteAddTrigger(entity, buffData, updateData, nil, buffTriggerData) end -- 主视角事件统一用 FirstPersonEventDispatcher 派发 FirstPersonEventDispatcher.UI_MainEntityAddSpecialViewBuff(entity, buffData) BattleEventSystem_OnBuffAddLayerOrRefresh(buffComp:GetBuffObjectByBuffId(buffId), buffId, updateData, oldBuffLayer) BattleEventSystem_OnEntityAddBuffOrRefresh(entity, buffId, updateData, oldBuffLayer) buffOperator.OnBuffAdded(entity,buffId,updateData) if buffOperator.OnBuffChanged then -- 只有瞬时buff没这个方法 buffOperator.OnBuffChanged(buffData,updateData,sourceEntity,entity) end return buffData end -----buff的删除-- function BuffSystem.DeleteBuff(entity,buffId, sourceEntity, forceLayerZero) local buffObject = entity.components.buff:GetBuffObjectByBuffId(buffId) if not buffObject then return end -- require "Battle/Logic/Buff/BuffStatistic".DeleteOneBuff(buffId, entity) local buffData = buffObject.BuffInfoData local buffUpdateData = buffObject.BuffUpdateData local buffUpdateList = buffObject.BuffUpdateList local buffOperator = _buffOp_Dic[buffData.BuffType] local deletedData if buffUpdateData and buffUpdateData.BuffLayer > 0 then buffOperator.Delete(buffData, entity, buffUpdateData,nil, forceLayerZero) BuffManager.ExecuteDeleteTrigger(entity, buffObject.BuffInfoData, buffUpdateData) deletedData = buffData end if buffUpdateList then if sourceEntity then for i,updateData in ipairs(buffUpdateList) do if updateData.SourceEntity == sourceEntity then if updateData.BuffLayer > 0 then buffOperator.Delete(buffData, entity, updateData,nil, forceLayerZero) BuffManager.ExecuteDeleteTrigger(entity, buffData, updateData) deletedData = buffData break end end end else for i,updateData in ipairs(buffUpdateList) do if updateData.BuffLayer > 0 then buffOperator.Delete(buffData, entity, updateData,nil, forceLayerZero) BuffManager.ExecuteDeleteTrigger(entity, buffData, updateData) deletedData = buffData end end end end --主视角事件统一用 FirstPersonEventDispatcher 派发 FirstPersonEventDispatcher.UI_MainEntityRemoveSpecialViewBuff(entity, buffData) if deletedData then return buffData end end -----Buff的刷新 ---- local temp_v1 = FP.newV1(0) function BuffSystem.OnLogicUpdate(entity, deltaTime) temp_v1:Reset(entity.components.timeScale.CurSkillAnimSoundEntityPosRotTimeScale) temp_v1:Mul(deltaTime) -- addBuffList 如果是1个table,则传给后续堆栈后,后续堆栈不会同步添加buff,而是把buff添加请求塞到addBuffList里,在for k,buffObject in pairs(_buffsCopy) do遍历之后再处理请求,效果上是异步添加buff,时序上会有点不符合策划预期 -- addBuffList 如果是nil,则后续堆栈会同步添加buff,这样的时序是符合策划预期的 local addBuffList = nil --new 关闭异步添加 -- new↓ 使用链表遍历,减少gc 目前没有充分测试,可能会有问题 local buffObject = entity.components.buff.CurBuffObjectLinkedListHead local count = 0 local canDeleteCount = 0 local buffDeltaTime local baseComp = entity.components.base while buffObject do -- if not(baseComp.IsActive or baseComp.HidingNeedUpdate) then -- 应该是要这样的逻辑。目前的问题是:在载具上时,会发生buff不更新的情况。但是这个改动影响的地方太多,暂时不敢改 if not baseComp.IsActive then break end local buffData = buffObject.BuffInfoData if buffData then -- 在dispose后,还可能走这块代码 local buffType = buffData.BuffType if buffType ~= BUFFTYPE_FLAGBUFF then if buffData.UseAnimTime then buffDeltaTime = temp_v1 else buffDeltaTime = deltaTime end local buffOperator = _buffOp_Dic[buffType] if buffData.IsRecordSource then local buffUpdateList = buffObject.BuffUpdateList if buffUpdateList then local allLayerIsZero = true for j,updateData in ipairs(buffUpdateList) do -- require "Battle/Logic/Buff/BuffStatistic".AddFrameBuffData(buffData.BuffID, entity, updateData.BuffLayer>0) if updateData.BuffLayer > 0 then allLayerIsZero = false local newUpdateData = buffOperator.OnUpdate(buffData, updateData, entity, buffDeltaTime, addBuffList) if newUpdateData.BuffTimer < Const_Zero then -- require "Battle/Logic/Buff/BuffStatistic".DeleteOneBuff(buffData.BuffID, entity) buffOperator.Delete(buffData, entity, newUpdateData, addBuffList) BuffManager.ExecuteDeleteTrigger(entity, buffData, newUpdateData, addBuffList) end end end if allLayerIsZero then canDeleteCount = canDeleteCount+1 end end else local buffUpdateData = buffObject.BuffUpdateData if buffUpdateData then -- require "Battle/Logic/Buff/BuffStatistic".AddFrameBuffData(buffData.BuffID, entity, buffUpdateData.BuffLayer>0) if buffUpdateData.BuffLayer > 0 then local updateData = buffOperator.OnUpdate(buffData, buffUpdateData, entity, buffDeltaTime, addBuffList) if updateData.BuffTimer < Const_Zero then -- require "Battle/Logic/Buff/BuffStatistic".DeleteOneBuff(buffData.BuffID, entity) buffOperator.Delete(buffData, entity, updateData, addBuffList) BuffManager.ExecuteDeleteTrigger(entity, buffData, updateData, addBuffList) end else canDeleteCount = canDeleteCount+1 end end end end end buffObject = buffObject.nextBuffObject count = count + 1 if count > 999 then logging.error(LTAG.ERROR, "HYW : 代码哪写错了,无限循环了! @BuffSystem.OnLogicUpdate") break end end --线上不一致较多,暂时去掉这个优化 -- if canDeleteCount>=4 then -- for index=#entity.components.buff.CurBuffObjectList, 1, -1 do -- local buffObject = entity.components.buff.CurBuffObjectList[index] -- local buffUpdateData = buffObject.BuffUpdateData -- local buffUpdateList = buffObject.BuffUpdateList -- local isDelete = true -- if not buffObject.BuffInfoData.IsRecordSource then -- if buffUpdateData.BuffLayer > 0 then -- isDelete = false -- end -- else -- if buffUpdateList then -- for i, updateData in ipairs(buffUpdateList) do -- if updateData.BuffLayer >0 then -- isDelete = false -- break -- end -- end -- end -- end -- if isDelete then -- entity.components.buff:RemoveNonValidBuff(buffObject, index) -- end -- end -- end -- new↑ end function BuffSystem.OnMove(entity, turn, moveDir, rotateDir) HaloOperator.UpdateHaloBuffEffect(entity) end ---清除身上的所有Buff-- function private.ClearAllBuff(entity) -- require "Battle/Logic/Buff/BuffStatistic".DeleteEntityBuff(entity) entity.components.buff:ClearAllBuff() end function private.ClearDeadBuff(entity) entity.components.buff:DeleteBuffOfGroup(LuaConst.BuffGroupType.DEAD) end --- function BuffSystem.OnAttackEnter(entity) local curSkillData = entity.components.skillBase.CurSkillData if curSkillData then local buffCtrl = nil for i,id in ipairs(curSkillData.BuffIDs) do buffCtrl = RuntimeDataManager.New_BuffCtrl() buffCtrl.ForceDuration:Reset(999999) --技能全程buff强制设置时间为无限长 SystemManager.AddBuff(entity, id, entity, nil, buffCtrl) end SystemManager.AddBuff(entity, SpecialBuffs.InSkilling, entity) end end function BuffSystem.OnInToSwitchAll(entity) local curSkillData = entity.components.skillBase.CurSkillData if curSkillData then for i,id in ipairs(curSkillData.BuffIDs) do if id == LuaConst.SkillSuperArmorBuffID or id == LuaConst.SkillInvincibleBuffID then-----补丁--------↓ local buffObject = entity.components.buff:GetBuffObjectByBuffId(id) if buffObject then ---这是个补丁:修补玩家当前帧失去技能buff,但是下一帧才进入连续技能。这期间被眩晕子弹打中则不能进入到下一阶段。 --- 如果改为 :在此帧最后删除技能buff是可以的,但是要测试的可能多些。 if buffObject.BuffUpdateList then for i,buffUpdateData in ipairs(buffObject.BuffUpdateList) do if curSkillData.AutoNextID > 0 then --20230420新增补丁,因为底层AutoNextID的设计需要frameCommands驱动,而网络波动会导致某些帧没有frameCommands,最终可能导致AutoNextID延迟释放,所以需要多加一点霸体时间,否则很容易出现连续技间的霸体覆盖有缝隙导致霸体连续技能被打断 buffUpdateData.BuffTimer:Reset(0.2) else buffUpdateData.BuffTimer:Reset(0.05) end end else local buffUpdateData = buffObject:GetUpdateData(1) if buffUpdateData then if curSkillData.AutoNextID > 0 then --20230420新增补丁,因为底层AutoNextID的设计需要frameCommands驱动,而网络波动会导致某些帧没有frameCommands,最终可能导致AutoNextID延迟释放,所以需要多加一点霸体时间,否则很容易出现连续技间的霸体覆盖有缝隙导致霸体连续技能被打断 buffUpdateData.BuffTimer:Reset(0.2) else buffUpdateData.BuffTimer:Reset(0.05) end end end end ---------补丁---- ↑ else SystemManager.DeleteBuff(entity, id, entity) end end end end function BuffSystem.OnAttackQuit(entity) SystemManager.DeleteBuff(entity, SpecialBuffs.InSkilling, nil) end function BuffSystem.OnSwitchHero(fromEntity, toEntity, dontBackground) if not dontBackground then BuffSystem.OnBackground(fromEntity) end BuffSystem.TryStopGrab(fromEntity) end function BuffSystem.OnBackground(entity) for i,buffObject in ipairs(entity.components.buff.CurBuffObjectList) do if buffObject.BuffInfoData.IsSwitchHeroDelete then SystemManager.DeleteBuffAnySourceEntity(entity, buffObject.BuffInfoData.BuffID) end end end function BuffSystem.OnRevive(entity) -- private.ClearAllBuff(entity) --old --复活不再清空buff,因为很多buff死亡不移除,所以复活这里也不能清空buff private.ClearDeadBuff(entity) --new --复活只清除死亡buff BuffSystem.AddBornBuffs(entity, true) end function BuffSystem.OnRideHorse(entity) return SystemManager.AddBuff(entity,SpecialBuffs.InRiding,entity,nil,nil) end -- 只给分身用的拷贝(分身默认继承来源于自身的buff并且只继承策划配置的buffgroup的buff) function BuffSystem.EntityCopy(entity, targetEntity) local buffComp = entity.components.buff -- 删除所有的现有buff for i,buffObject in ipairs(buffComp.CurBuffObjectList) do if buffObject.BuffInfoData.BuffID > SpecialBuffs.CanSkill then -- 基础性buff别删除 SystemManager.DeleteBuff(entity, buffObject.BuffInfoData.BuffID, nil) end end local buffCtrlParam -- 用目标者的所有buff填充自身 local buffObjectList = targetEntity.components.buff.CurBuffObjectList for i,buffObject in ipairs(buffObjectList) do local buffData = buffObject.BuffInfoData local buffGroup = buffData.BuffGroup if table.containValue(CONST_ILLUSION_ADOPT_BUFF_LIST, buffGroup) then local buffUpdateData = buffObject.BuffUpdateData if buffUpdateData and buffUpdateData.BuffLayer > 0 and targetEntity == buffUpdateData.SourceEntity then buffCtrlParam = RuntimeDataManager.New_BuffCtrl() buffCtrlParam.IsTracker = buffUpdateData.IsTracker buffCtrlParam.BuffOverRideFomula = buffUpdateData.BuffOverRideFomula buffCtrlParam.ForceLayer = buffUpdateData.BuffLayer buffCtrlParam.ForceDuration:Reset(buffUpdateData.BuffTimer) SystemManager.AddBuff(entity, buffData.BuffID, nil, nil, buffCtrlParam) end local buffUpdateList = buffObject.BuffUpdateList if buffUpdateList then for i,updateData in ipairs(buffUpdateList) do if updateData.BuffLayer > 0 and targetEntity == updateData.SourceEntity then buffCtrlParam = RuntimeDataManager.New_BuffCtrl() buffCtrlParam.IsTracker = updateData.IsTracker buffCtrlParam.BuffOverRideFomula = updateData.BuffOverRideFomula buffCtrlParam.ForceLayer = updateData.BuffLayer buffCtrlParam.ForceDuration:Reset(updateData.BuffTimer) --local sourceEntity = targetEntity == updateData.SourceEntity and entity or updateData.SourceEntity SystemManager.AddBuff(entity, buffData.BuffID, entity, nil, buffCtrlParam) end end end local newBuffObject = buffComp.CurBuffObjectDic[buffObject.BuffID] if newBuffObject then for index,val in pairs(buffObject.LastTriggerTimeStampDic) do -- pairs is safe newBuffObject.LastTriggerTimeStampDic[index] = val end end end end end function BuffSystem.OnEntityEnterCantBeTriggerState(entity) HaloOperator.OnEntityEnterCantBeTriggerState(entity) end function BuffSystem.GetInHaloBuffCount(checkEntity, haloBuffId, buffCaster) return HaloOperator.GetInHaloBuffNum(checkEntity, haloBuffId, buffCaster) end function BuffSystem.GetInHaloBuffGroupCount(checkEntity, haloBuffId, buffCaster) return HaloOperator.GetInHaloBuffGroupNum(checkEntity, haloBuffId, buffCaster) end return BuffSystem