Beispiel #1
0
        private void Combinations(Hero leader, IList <Hero> heroesPool, int len, int offset, IList <Hero> result)
        {
            if (len == 0)
            {
                Deck deck = new Deck(new[] { leader, result[0], result[1], result[2], result[3] });
                for (int i = 0; i < HeroStat.Affinity.Names.Length; i++)
                {
                    DeckStats deckStats = deck.Calculate(HeroStat.Affinity.Types[i]);
                    if (deckStats.Power > bestDecks[i].Power)
                    {
                        bestDecks[i] = new BestDeck(deckStats.Power, deck);
                    }
                }

                return;
            }

            for (int i = offset, rl = result.Count, hl = heroesPool.Count; i <= hl - len; i++)
            {
                result[rl - len] = heroesPool[i];
                Combinations(leader, heroesPool, len - 1, i + 1, result);
            }
        }
Beispiel #2
0
        public DeckStats Calculate(HeroStat.Affinity.Type opponentAffinity)
        {
            DeckStats deckStats = new DeckStats();

            foreach (Hero hero in heroes)
            {
                HeroBaseStats deckHeroBaseStats = new HeroBaseStats(hero);

                ApplyAffinityBonus(ref deckHeroBaseStats, opponentAffinity);
                ApplyLeaderAbilityBonus(hero, ref deckHeroBaseStats);
//                ApplyEventBonus(ref deckHero);

                deckStats.Attack += deckHeroBaseStats.Attack;
                deckStats.Power  += HeroStat.Power.Calculate(
                    deckHeroBaseStats.Attack,
                    deckHeroBaseStats.Recovery,
                    deckHeroBaseStats.Health,
                    deckHeroBaseStats.IsWarden
                    );
            }

            return(deckStats);
        }