コード例 #1
0
        private static IEnumerable <RibbonResult> GetInvalidRibbons6Any(PKM pkm, IRibbonSetCommon6 s6, int gen)
        {
            foreach (var p in GetInvalidRibbons6Memory(pkm, s6, gen))
            {
                yield return(p);
            }

            bool untraded = pkm.IsUntraded;
            var  iter     = untraded ? GetInvalidRibbons6Untraded(pkm, s6) : GetInvalidRibbons6Traded(pkm, s6);

            foreach (var p in iter)
            {
                yield return(p);
            }

            bool allContest = s6.RibbonBitsContest().All(z => z);

            if (allContest ^ s6.RibbonContestStar && !(untraded && pkm.XY)) // if not already checked
            {
                yield return(new RibbonResult(nameof(s6.RibbonContestStar), s6.RibbonContestStar));
            }

            const int mem_Chatelaine = 30;
            bool      hasChampMemory = pkm.HT_Memory == mem_Chatelaine || pkm.OT_Memory == mem_Chatelaine;

            if (!hasChampMemory || s6.RibbonBattlerSkillful || s6.RibbonBattlerExpert)
            {
                yield break;
            }

            var result = new RibbonResult(nameof(s6.RibbonBattlerSkillful), false);

            result.Combine(new RibbonResult(nameof(s6.RibbonBattlerExpert)));
            yield return(result);
        }
コード例 #2
0
        private static IEnumerable <RibbonResult> GetInvalidRibbons6Traded(PKM pkm, IRibbonSetCommon6 s6)
        {
            if (s6.RibbonTraining)
            {
                const int req   = 12; // only first 12
                int       count = pkm.SuperTrainingMedalCount(req);
                if (count < req)
                {
                    yield return(new RibbonResult(nameof(s6.RibbonTraining)));
                }
            }

            const int mem_Champion   = 27;
            bool      hasChampMemory = pkm.HT_Memory == mem_Champion || pkm.OT_Memory == mem_Champion;

            if (!hasChampMemory || s6.RibbonChampionKalos || s6.RibbonChampionG6Hoenn)
            {
                yield break;
            }

            var result = new RibbonResult(nameof(s6.RibbonChampionKalos), false);

            result.Combine(new RibbonResult(nameof(s6.RibbonChampionG6Hoenn)));
            yield return(result);
        }
コード例 #3
0
        private static IEnumerable <RibbonResult> GetInvalidRibbons6Any(PKM pkm, IRibbonSetCommon6 s6, int gen)
        {
            foreach (var p in GetInvalidRibbons6Memory(pkm, s6, gen))
            {
                yield return(p);
            }

            bool untraded = pkm.IsUntraded;
            var  iter     = untraded ? GetInvalidRibbons6Untraded(pkm, s6) : GetInvalidRibbons6Traded(pkm, s6);

            foreach (var p in iter)
            {
                yield return(p);
            }

            var  contest    = s6.RibbonBitsContest();
            bool allContest = contest.All(z => z);

            if (allContest ^ s6.RibbonContestStar && !(untraded && pkm.XY)) // if not already checked
            {
                yield return(new RibbonResult(nameof(s6.RibbonContestStar), s6.RibbonContestStar));
            }

            // Each contest victory requires a contest participation; each participation gives 20 OT affection (not current trainer).
            var affect     = pkm.OT_Affection;
            var contMemory = s6.RibbonNamesContest();
            int contCount  = 0;
            var present    = contMemory.Where((_, i) => contest[i] && affect < 20 * ++contCount);

            foreach (var rib in present)
            {
                yield return(new RibbonResult(rib));
            }

            const int mem_Chatelaine = 30;
            bool      hasChampMemory = pkm.HT_Memory == mem_Chatelaine || pkm.OT_Memory == mem_Chatelaine;

            if (!IsAllowedBattleFrontier(pkm.Species))
            {
                if (hasChampMemory || s6.RibbonBattlerSkillful) // having memory and not ribbon is too rare, just flag here.
                {
                    yield return(new RibbonResult(nameof(s6.RibbonBattlerSkillful)));
                }
                if (s6.RibbonBattlerExpert)
                {
                    yield return(new RibbonResult(nameof(s6.RibbonBattlerExpert)));
                }
                yield break;
            }
            if (!hasChampMemory || s6.RibbonBattlerSkillful || s6.RibbonBattlerExpert)
            {
                yield break;
            }

            var result = new RibbonResult(nameof(s6.RibbonBattlerSkillful), false);

            result.Combine(new RibbonResult(nameof(s6.RibbonBattlerExpert)));
            yield return(result);
        }