예제 #1
0
        ///

        /*public List<T> GetRandomElements<T>(this IEnumerable<T> list, int elementsCount)
         * {
         *      return list.OrderBy(arg => Guid.NewGuid()).Take(elementsCount).ToList();
         * }*/


        public static bool CanReact(SingleCard card1, SingleCard card2)
        {
            // Rule 0 : not belongs to different classes and total cost less than 10
            if (card1.card.Cost + card2.card.Cost > 10)
            {
                return(false);
            }
            if (card1.card.Class.ToString() != "NEUTRAL" && card2.card.Class.ToString() != "NEUTRAL" &&
                card1.card.Class != card2.card.Class)
            {
                return(false);
            }
            // Rule 1 : has same tag
            HashSet <string> intersect = new HashSet <string>(card1.Tags);

            intersect.IntersectWith(card2.Tags);
            if (intersect.Count > 0)
            {
                return(true);
            }
            // Rule 2 : charge + buff (= Remove)
            if ((card1.Tags.Contains("Charge") && card2.Tags.Contains("Buff")) ||
                (card1.Tags.Contains("Buff") && card2.Tags.Contains("Charge")))
            {
                return(true);
            }
            // Rule 3 : AOE + Taunt
            if ((card1.Tags.Contains("AOE") && card2.Tags.Contains("Taunt")) ||
                (card1.Tags.Contains("Taunt") && card2.Tags.Contains("AOE")))
            {
                return(true);
            }

            return(false);
        }
예제 #2
0
        public SmallCombo(SingleCard card1, SingleCard card2)         //from writeCombo
        {
            Tags = new HashSet <string>(card1.Tags);
            Tags.UnionWith(card2.Tags);

            ComboCards = new List <Card>();
            ComboCards.Add(card1.card);
            ComboCards.Add(card2.card);

            ComboClass = "NEUTRAL";
            if (card1.card.Class.ToString() != "NEUTRAL")
            {
                ComboClass = card1.card.Class.ToString();
            }
            if (card2.card.Class.ToString() != "NEUTRAL")
            {
                ComboClass = card2.card.Class.ToString();
            }

            Cost     = -1;
            RMScore  = -1;
            HQScore  = -1;
            AOEScore = -1;
            if (card1 != null && card2 != null)
            {
                Cost = card1.card.Cost + card2.card.Cost;
                if (ComboClass != "NEUTRAL")
                {
                    RMScore = UnitTest.TestRemove(ComboCards, ComboClass);
                    if (Tags.Contains("AOE"))
                    {
                        AOEScore = UnitTest.TestAOE(ComboCards, ComboClass);
                    }
                }
                if (Tags.Contains("High Quality"))
                {
                    HQScore = card1.card.Health + card2.card.Health
                              + card1.card.ATK + card2.card.ATK
                              - Cost;
                }
            }
        }
예제 #3
0
        /*public LargeCombo()
         * {
         *      ComboClass = "NEUTRAL";
         *      Tags.Add("AOE", 0);
         *      Tags.Add("Remove", 0);
         *      Tags.Add("High Quality", 0);
         *      Cost = 0;
         *      ComboCards = new List<Card>();
         * }*/
        public LargeCombo(SingleCard singleCard)
        {
            ComboClass = singleCard.card.Class.ToString();
            Tags       = new Dictionary <string, int>();
            Tags.Add("AOE", 0);
            Tags.Add("Remove", 0);
            Tags.Add("High Quality", 0);
            foreach (string tag in singleCard.Tags)
            {
                if (Tags.ContainsKey(tag))
                {
                    Tags[tag]++;
                }
            }

            Cost = singleCard.card.Cost;

            ComboCards = new List <Card>();
            ComboCards.Add(singleCard.card);
            RMScore  = singleCard.RMScore;
            AOEScore = singleCard.AOEScore;
            HQScore  = singleCard.HQScore;
        }