//挑出阵营,但是不应该把施法者过滤掉 //后续如果有要求,才会过滤施法者 IEnumerable <ServerNPC> SelectCamp(ServerNPC caster, IEnumerable <ServerNPC> targets, EffectConfigData efCfg) { CAMP camp = efCfg.Flags.switchTo(caster.Camp); IEnumerable <ServerNPC> itor = targets.Where(n => camp.check(n.Camp) || caster.UniqueID == n.UniqueID); return(itor); }
/// <summary> /// 获取阵营的BNPC列表, 默认获取活着的BNPC /// </summary> /// <returns>The camp bnpc.</returns> public IEnumerable <ServerNPC> getCampBnpc(CAMP camp, LiveOrDie live = LiveOrDie.Live) { List <ServerNPC> bnpc = new List <ServerNPC>(); /// /// ------- 依次测试CAMP,从容器中获取 ------- /// CAMP toTest = CAMP.None; List <ServerNPC> outValue = null; ///检查是否有Enemy bool ck = camp.check(CAMP.Enemy); if (ck) { toTest = CAMP.Enemy; if (campNicDic.TryGetValue(toTest, out outValue)) { bnpc.AddRange(outValue); } } ck = camp.check(CAMP.Player); if (ck) { toTest = CAMP.Player; if (campNicDic.TryGetValue(toTest, out outValue)) { bnpc.AddRange(outValue); } } ck = camp.check(CAMP.Neutral); if (ck) { toTest = CAMP.Neutral; if (campNicDic.TryGetValue(toTest, out outValue)) { bnpc.AddRange(outValue); } } IEnumerable <ServerNPC> itor = null; int count = bnpc.Count; if (count > 0) { if (live == LiveOrDie.Live) { itor = bnpc.Where(n => n.data != null && n.data.rtData != null && n.data.rtData.curHp > 0); } else if (live == LiveOrDie.Die) { itor = bnpc.Where(n => n.data != null && n.data.rtData != null && n.data.rtData.curHp <= 0); } else { itor = bnpc.AsEnumerable <ServerNPC>(); } } else { itor = bnpc.AsEnumerable <ServerNPC>(); } return(itor); }