Esempio n. 1
0
        private static IdolSummary applyBonus2(Idol idol, Bonus bonus, bool isSupporter)
        {
            IdolSummary idolSummary = new IdolSummary();

            if (idol.Id < 0)
            {
                return(idolSummary);
            }

            int vocal  = bonus.GetAppeal(idol.Type, AppealType.Vocal);
            int dance  = bonus.GetAppeal(idol.Type, AppealType.Dance);
            int visual = bonus.GetAppeal(idol.Type, AppealType.Visual);

            vocal  = roundUp(idol.Vocal * vocal, 100);
            dance  = roundUp(idol.Dance * dance, 100);
            visual = roundUp(idol.Visual * visual, 100);

            if (isSupporter)
            {
                vocal  = roundUp(vocal * 5, 10);
                dance  = roundUp(dance * 5, 10);
                visual = roundUp(visual * 5, 10);
            }

            idolSummary.Id     = idol.Id;
            idolSummary.Skill  = idol.Skill;
            idolSummary.Appeal = vocal + dance + visual;
            idolSummary.Type   = idol.Type;

            return(idolSummary);
        }
Esempio n. 2
0
        public Deck(IdolSummary guest, IdolSummary leader, List <IdolSummary> members)
        {
            this.Guest      = guest;
            this.Leader     = leader;
            this.Members    = members;
            this.MainAppeal = 0;

            MemberIds = new HashSet <int>(members.Select(i => i.Id));
            MemberIds.Add(leader.Id);

            MainAppeal += guest.Appeal;
            MainAppeal += leader.Appeal;
            members.ForEach(i => MainAppeal += i.Appeal);
        }
Esempio n. 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);
        }