local FuncNode_IsFlagAmountReachLimit = class("FuncNode_IsFlagAmountReachLimit") local FP=FP --[[ 初始化 --]] function FuncNode_IsFlagAmountReachLimit:initialize(entity) self.LimitChildCount = 1 self.Type = LuaConst.ConditionFuncType.IsFlagAmountReachLimit end --[[ 执行 --]] function FuncNode_IsFlagAmountReachLimit:Run(conditionDataNode, entity, missile, buffObject) local targetType = conditionDataNode.FirstNode:Run(entity, missile, buffObject) local target if targetType == FP.Const.Two then target = entity.components.target.Target else target = entity end if target then target = target:GetOriginEntity() if target:IsHero() then if LevelManager.CurLevelFunc.GetFlagAmountOfPlayer then return LevelManager.CurLevelFunc:GetFlagAmountOfPlayer(target:GetPlayerID()) >= 1 and FP.Const.One or FP.Const.Zero else --如果关卡没有这个功能,则统一认为已经达到上限 logging.error(LTAG.ERROR, "HYW : 试图在不正确的关卡里访问GetFlagAmountOfPlayer(获得玩家令旗数) @FuncNode_IsFlagAmountReachLimit:Run LevelID : ", LevelManager.GetCurLevelID()) return FP.Const.One end else --非英雄,则统一认为已经到达上限(认为非英雄无法携带令旗) return FP.Const.One end else --注意!如果没有目标,则统一认为已经达到上限 return FP.Const.One end end return FuncNode_IsFlagAmountReachLimit