local Base = require "Battle/Logic/Buff/BuffManager/BuffOperator_Sustained" local BuffObject = require "Battle/Logic/Buff/BuffData/BuffObject" local BuffOperator_Flag = {} for k,func in pairs(Base) do BuffOperator_Flag[k] = func end function BuffOperator_Flag.Add(buffData,targetEntity,sourceEntity,missile,ctrlParam,index) --buff对应的动画可能为N个动画间随机 --先根据Buff改变当前动画,再根据当前动画获取Buff时间 BuffOperator_Flag.ChangeStateOnAddBuff(buffData, targetEntity, sourceEntity,missile) local updateData local buffObject = targetEntity.components.buff:GetBuffObjectByBuffId(buffData.BuffID) if buffObject then --更新已有的buff数据 updateData = buffObject:GetUpdateData(index) if updateData then updateData.BuffLayer = updateData.BuffLayer + 1 else updateData = BuffOperator_Flag.CreateBuffUpdateData(buffData, sourceEntity, targetEntity, ctrlParam) buffObject:SetData(updateData) end else --添加新的buff数据 buffObject = BuffObject:new(buffData) buffObject:SetHost(targetEntity) updateData = BuffOperator_Flag.CreateBuffUpdateData(buffData, sourceEntity, targetEntity, ctrlParam) buffObject:SetHost(targetEntity) buffObject:SetData(updateData) targetEntity.components.buff:SetBuffObject(buffObject) end BuffOperator_Flag.Execute(buffData, targetEntity, sourceEntity, updateData) BuffOperator_Flag.AddHandles(buffData, targetEntity, sourceEntity, ctrlParam) return updateData end function BuffOperator_Flag.Delete(buffData, entity, updateData, addList ) if (updateData.BuffLayer > 0) then Base.Delete(buffData, entity, updateData) else updateData.BuffLayer = updateData.BuffLayer -1 end end function BuffOperator_Flag.ExclusiveDelete( buffData, entity,addBuffIdExclus, addBuffGroupExclus, updateData) if (updateData.BuffLayer > 0) then Base.ExclusiveDelete(buffData, entity, addBuffIdExclus, addBuffGroupExclus, updateData) else updateData.BuffLayer = updateData.BuffLayer - 1 end end function BuffOperator_Flag.AddHandles(buffData, targetEntity, sourceEntity, ctrlParam) targetEntity.components.buff.CurrentBuffStates:Set(buffData.BuffID,true) end return BuffOperator_Flag