local FuncNode_CheckBuff = class("FuncNode_CheckBuff") --[[ 初始化 --]] function FuncNode_CheckBuff:initialize(entity) self.LimitChildCount = 2 self.Type = LuaConst.ConditionFuncType.CheckBuff end --[[ 执行 --]] function FuncNode_CheckBuff:Run(conditionDataNode, entity, missile, buffObject, eventParams) local type = conditionDataNode.FirstNode:Run(entity, missile) local buffID = conditionDataNode.SecondNode:Run(entity, missile) local tempEntity if type == FP.Const.Zero then --自己 if entity then return entity.components.buff:GetBuffUpdateData(FP.tonumberV1(buffID)) and FP.Const.One or FP.Const.Zero end elseif type == FP.Const.One then --目标 tempEntity = entity.components.target.Target if tempEntity then return tempEntity.components.buff:GetBuffUpdateData(FP.tonumberV1(buffID)) and FP.Const.One or FP.Const.Zero end elseif type == FP.Const.Two then --和自己同FeatureID的所有怪都具有buff local featureID = entity.components.base.CurMonsterFeature.ID local buffid = FP.tonumberV1(buffID) for i,checkEntity in ipairs(LogicUpdateManager.EntityList_Sync) do if checkEntity.components.base.CurMonsterFeature.ID == featureID then if not checkEntity.components.buff:GetBuffUpdateData(buffid) then return FP.Const.Zero end end end for i,checkEntity in ipairs(LogicUpdateManager.EntityList_Normal) do if checkEntity.components.base.CurMonsterFeature.ID == featureID then if not checkEntity.components.buff:GetBuffUpdateData(buffid) then return FP.Const.Zero end end end return FP.Const.One elseif type == FP.Const.Three then local masterEntity = entity:GetMasterEntity() if masterEntity then return masterEntity.components.buff:GetBuffUpdateData(FP.tonumberV1(buffID)) and FP.Const.One or FP.Const.Zero else return FP.Const.Zero end elseif type == FP.Const.Four then if eventParams.buffCaster then return eventParams.buffCaster.components.buff:GetBuffUpdateData(FP.tonumberV1(buffID)) and FP.Const.One or FP.Const.Zero else logging.error(LTAG.ERROR, "HYW : CheckBuff条件的参数1填4时要求事件参数中有buffCaster,然而现在没有!") end end return FP.Const.Zero end return FuncNode_CheckBuff