//是否满足条件 static bool IsEnough(ObjectCard oc, ExplorequestTemplate et) { int needHeroType = et.getNeedHeroType(); bool result = false; switch (needHeroType) { case 1: bool lvEnough = oc.GetHeroData().Level >= et.getNeedHeroLevel(); bool campEnough = new List <int>(et.getNeedHeroCamp()).Contains(oc.GetHeroRow().getCamp()); bool qualityEnough = oc.GetHeroRow().getQuality() >= et.getNeedHeroStar(); result = lvEnough && campEnough && qualityEnough; break; case 2: bool inIds1 = new List <int>(et.getNeedHeroID1()).Contains(oc.GetHeroData().TableID); bool inIds2 = new List <int>(et.getNeedHeroID2()).Contains(oc.GetHeroData().TableID); bool inIds3 = new List <int>(et.getNeedHeroID3()).Contains(oc.GetHeroData().TableID); bool inIds4 = new List <int>(et.getNeedHeroID4()).Contains(oc.GetHeroData().TableID); bool inIds5 = new List <int>(et.getNeedHeroID5()).Contains(oc.GetHeroData().TableID); result = inIds1 || inIds2 || inIds3 || inIds4 || inIds5; break; default: break; } return(result); }
/// <summary> /// 获取探险该任务需要的英雄数量; /// 如果任务需求类型为1(根据阵容、等级、品质)则返回needNum字段的值; /// 如果任务需求类型为2(根据指定的英雄id) 则返回需要英雄id组不为-1的个数; /// </summary> /// <returns></returns> public int GetExploreNeedHeroCount(ExplorequestTemplate exploreT) { switch (exploreT.getNeedHeroType()) { case 1: return(exploreT.getNeedNum()); case 2: int count = 0; if (exploreT.getNeedHeroID1() != null && exploreT.getNeedHeroID1().Length > 0 && exploreT.getNeedHeroID1() [0] != -1) { count++; } if (exploreT.getNeedHeroID2() != null && exploreT.getNeedHeroID2().Length > 0 && exploreT.getNeedHeroID2() [0] != -1) { count++; } if (exploreT.getNeedHeroID3() != null && exploreT.getNeedHeroID3().Length > 0 && exploreT.getNeedHeroID3() [0] != -1) { count++; } if (exploreT.getNeedHeroID4() != null && exploreT.getNeedHeroID4().Length > 0 && exploreT.getNeedHeroID4() [0] != -1) { count++; } if (exploreT.getNeedHeroID5() != null && exploreT.getNeedHeroID5().Length > 0 && exploreT.getNeedHeroID5() [0] != -1) { count++; } return(count); default: LogManager.LogError("不支持的英雄筛选类型type=" + exploreT.getNeedHeroType()); break; } return(-1); }