示例#1
0
        private static List <IdolSummary> getRankedIdol(List <Idol> idols, int leaderId, int[] skillCount, int[] typeCount, Bonus bonus, int count)
        {
            string             key  = string.Format("{0}:{1}:{2}:{3}", bonus, skillCount, typeCount, leaderId);
            List <IdolSummary> list = null;

            if (CacheList.ContainsKey(key))
            {
                list = CacheList[key];
            }
            else
            {
                list = new List <IdolSummary>();
                foreach (Idol idol in idols)
                {
                    list.Add(applyBonus2(idol, bonus, false));
                }
                list.Sort();

                List <IdolSummary> templist = new List <IdolSummary>();

                int i = 0;
                while (templist.Count < 6)
                {
                    if (i >= list.Count)
                    {
                        break;
                    }
                    if (list[i].Id != leaderId)
                    {
                        if ((skillCount[getSkillIndex(list[i].Skill)] != 0 || skillCount[getSkillIndex(Skill.Ignore)] != 0) &&
                            (typeCount[getTypeIndex(list[i].Type)] != 0 || typeCount[getTypeIndex(Type.All)] != 0))
                        {
                            templist.Add(list[i]);

                            if (skillCount[getSkillIndex(list[i].Skill)] != 0)
                            {
                                skillCount[getSkillIndex(list[i].Skill)]--;
                            }
                            else
                            {
                                skillCount[getSkillIndex(Skill.Ignore)]--;
                            }
                            if (typeCount[getTypeIndex(list[i].Type)] != 0)
                            {
                                typeCount[getTypeIndex(list[i].Type)]--;
                            }
                            else
                            {
                                typeCount[getTypeIndex(Type.All)]--;
                            }
                        }
                    }
                    i++;
                }

                list = templist;

                CacheList.Add(key, list);
            }

            return(list.Where(idol => idol.Id != leaderId).Take(count).ToList());
        }
示例#2
0
        private static Bonus getBonus(Type musicType, Burst burst, Idol[] effectIdols, bool isSupporter = false)
        {
            Bonus bonus = new Bonus();

            bonus.AddAppeal(Type.All, AppealType.Vocal, 100);
            bonus.AddAppeal(Type.All, AppealType.Dance, 100);
            bonus.AddAppeal(Type.All, AppealType.Visual, 100);

            if (!isSupporter)
            {
                bonus.AddAppeal(Type.All, AppealType.Vocal, 10);
                bonus.AddAppeal(Type.All, AppealType.Dance, 10);
                bonus.AddAppeal(Type.All, AppealType.Visual, 10);
            }

            switch (burst)
            {
            case Burst.Vocal:
                bonus.AddAppeal(Type.All, AppealType.Vocal, 150);
                break;

            case Burst.Dance:
                bonus.AddAppeal(Type.All, AppealType.Dance, 150);
                break;

            case Burst.Visual:
                bonus.AddAppeal(Type.All, AppealType.Visual, 150);
                break;
            }

            bonus.AddAppeal(musicType, AppealType.Vocal, 30);
            bonus.AddAppeal(musicType, AppealType.Dance, 30);
            bonus.AddAppeal(musicType, AppealType.Visual, 30);

            if (effectIdols != null)
            {
                foreach (Idol effectIdol in effectIdols)
                {
                    int value = 0;
                    if (effectIdol.CenterSkill == CenterSkill.All)
                    {
                        if (effectIdol.Rarity == Rarity.SSR && effectIdol.CenterSkillCondition != CenterSkillCondition.None)
                        {
                            value = 50;
                        }
                        else if (effectIdol.Rarity == Rarity.SSR && effectIdol.CenterSkillCondition == CenterSkillCondition.None)
                        {
                            value = 30;
                        }
                        else if (effectIdol.Rarity == Rarity.SR && effectIdol.CenterSkillCondition == CenterSkillCondition.None)
                        {
                            value = 20;
                        }
                        bonus.AddAppeal(effectIdol.Type, AppealType.Vocal, value);
                        bonus.AddAppeal(effectIdol.Type, AppealType.Dance, value);
                        bonus.AddAppeal(effectIdol.Type, AppealType.Visual, value);
                    }
                    else if (effectIdol.CenterSkill == CenterSkill.Vocal ||
                             effectIdol.CenterSkill == CenterSkill.Dance || effectIdol.CenterSkill == CenterSkill.Visual)
                    {
                        AppealType appealType = AppealType.Vocal;
                        if (effectIdol.CenterSkill == CenterSkill.Dance)
                        {
                            appealType = AppealType.Dance;
                        }
                        if (effectIdol.CenterSkill == CenterSkill.Visual)
                        {
                            appealType = AppealType.Visual;
                        }

                        if (effectIdol.CenterSkillType == CenterSkillType.All)
                        {
                            if (effectIdol.Rarity == Rarity.SSR && effectIdol.CenterSkillCondition == CenterSkillCondition.None)
                            {
                                value = 80;
                            }
                            else if (effectIdol.Rarity == Rarity.SSR && effectIdol.CenterSkillCondition != CenterSkillCondition.None)
                            {
                                value = 100;
                            }
                            else if (effectIdol.Rarity == Rarity.SR && effectIdol.CenterSkillCondition == CenterSkillCondition.None)
                            {
                                value = 80;
                            }
                            else if (effectIdol.Rarity == Rarity.SR && effectIdol.CenterSkillCondition != CenterSkillCondition.None)
                            {
                                value = 48;
                            }
                            bonus.AddAppeal(Type.All, appealType, value);
                        }
                        else
                        {
                            if (effectIdol.Rarity == Rarity.SSR)
                            {
                                value = 90;
                            }
                            else if (effectIdol.Rarity == Rarity.SR)
                            {
                                value = 60;
                            }
                            else if (effectIdol.Rarity == Rarity.R)
                            {
                                value = 30;
                            }
                            bonus.AddAppeal(effectIdol.Type, appealType, value);
                        }
                    }
                }
            }

            return(bonus);
        }
示例#3
0
        public static Deck CalculateBest(Burst burstMode, Type musicType)
        {
            if (musicType == Type.All && burstMode != Burst.None)
            {
                return(null);
            }

            List <Idol> guests = null;

            if (burstMode != Burst.None)
            {
                guests = new List <Idol>(new Idol[] { new Idol() });
            }
            else
            {
                guests = Idols.Where(i => i.RarityNumber == 8).ToList();
            }

            List <Idol> myIdols = Idols
                                  .Where(i => CountMap.ContainsKey(i.Id) &&
                                         CountMap[i.Id] > 0)
                                  .ToList();

            Deck        bestDeck = null;
            List <Deck> deckRank = new List <Deck>();

            foreach (Idol guest in guests)
            {
                foreach (Idol leader in myIdols)
                {
                    if (guest.CenterSkillCondition != leader.CenterSkillCondition)
                    {
                        continue;
                    }

                    Idol[] effectIdols = new Idol[] { leader, guest };

                    Bonus bonus = getBonus(musicType, burstMode, effectIdols);

                    IdolSummary nGuest  = applyBonus2(guest, bonus, false);
                    IdolSummary nLeader = applyBonus2(leader, bonus, false);

                    List <IdolSummary> members = new List <IdolSummary>();

                    int[] skillCount, typeCount;

                    if (leader.CenterSkillCondition == CenterSkillCondition.All)
                    {
                        typeCount = new int[] { 2, 1, 1, 1 };
                        if (typeCount[getTypeIndex(leader.Type)] != 0)
                        {
                            typeCount[getTypeIndex(leader.Type)]--;
                        }
                    }
                    else if (leader.CenterSkillCondition != CenterSkillCondition.None)
                    {
                        typeCount = new int[] { 0, 0, 0, 0 };
                        typeCount[getTypeIndex(leader.Type)] += 4;
                    }
                    else
                    {
                        typeCount = new int[] { 4, 0, 0, 0 }
                    };

                    skillCount = new int[SkillCount.Length + 1];
                    skillCount[getSkillIndex(Skill.Ignore)] = 5;
                    if (CheckSkill)
                    {
                        for (int i = 0; i < SkillCount.Length; i++)
                        {
                            skillCount[i] = SkillCount[i];
                            skillCount[getSkillIndex(Skill.Ignore)] -= SkillCount[i];
                        }
                    }
                    if (skillCount[getSkillIndex(leader.Skill)] != 0)
                    {
                        skillCount[getSkillIndex(leader.Skill)]--;
                    }
                    else if (skillCount[getSkillIndex(Skill.Ignore)] == 0)
                    {
                        continue;
                    }
                    else
                    {
                        skillCount[getSkillIndex(Skill.Ignore)]--;
                    }


                    members.AddRange(getRankedIdol(myIdols, leader.Id, skillCount, typeCount, bonus, 4));

                    Deck deck = new Deck(nGuest, nLeader, members);

                    if (bestDeck == null)
                    {
                        bestDeck = deck;
                    }
                    else if (bestDeck.isBetter(deck))
                    {
                        bestDeck = deck;
                    }
                }
            }

            if (bestDeck == null)
            {
                return(null);
            }

            Bonus supportBonus = getBonus(musicType, burstMode, null, true);

            List <IdolSummary> supporters = Idols
                                            .Where(i => getIdolLessCount(i.Id, bestDeck) > 0)
                                            .SelectMany(i => Enumerable.Repeat(i, getIdolLessCount(i.Id, bestDeck)))
                                            .Select(i => applyBonus2(i, supportBonus, true))
                                            .OrderByDescending(i => i.Appeal)
                                            .Take(10)
                                            .ToList();

            bestDeck.SetSupporters(supporters);

            return(bestDeck);
        }