Exemplo n.º 1
0
        public void AddMain(int cardId)
        {
            Card card = Card.Get(cardId);

            if (card == null)
            {
                return;
            }
            if ((card.Type & (int)CardType.Token) != 0)
            {
                return;
            }
            if ((card.Type & 0x802040) != 0)
            {
                if (Extra.Count < 15)
                {
                    Extra.Add(cardId);
                }
            }
            else
            {
                if (Main.Count < 60)
                {
                    Main.Add(cardId);
                }
            }
        }
Exemplo n.º 2
0
        public void AddSide(int cardId)
        {
            Card card = Card.Get(cardId);

            if (card == null)
            {
                return;
            }
            if ((card.Type & (int)CardType.Token) != 0)
            {
                return;
            }
            if (Side.Count < 15)
            {
                Side.Add(cardId);
            }
        }
Exemplo n.º 3
0
        public int Check(Banlist ban, bool ocg, bool tcg)
        {
            if (Main.Count < 40 ||
                Main.Count > 60 ||
                Extra.Count > 15 ||
                Side.Count > 15)
            {
                return(1);
            }

            IDictionary <int, int> cards = new Dictionary <int, int>();

            IList <int>[] stacks = { Main, Extra, Side };
            foreach (IList <int> stack in stacks)
            {
                foreach (int id in stack)
                {
                    Card card = Card.Get(id);
                    AddToCards(cards, card);
                    if (!ocg && card.Ot == 1 || !tcg && card.Ot == 2)
                    {
                        return(id);
                    }
                    if (card.HasType(CardType.Token))
                    {
                        return(id);
                    }
                }
            }

            if (ban == null)
            {
                return(0);
            }

            foreach (var pair in cards)
            {
                int max = ban.GetQuantity(pair.Key);
                if (pair.Value > max)
                {
                    return(pair.Key);
                }
            }

            return(0);
        }
Exemplo n.º 4
0
        public int Check(Banlist ban, bool ocg, bool tcg)
        {
            if (Main.Count < Config.GetInt("MainDeckMinSize", 40) ||
                Main.Count > Config.GetInt("MainDeckMaxSize", 60) ||
                Extra.Count > Config.GetInt("ExtraDeckMaxSize", 15) ||
                Side.Count > Config.GetInt("SideDeckMaxSize", 15))
            {
                return(1);
            }

            IDictionary <int, int> cards = new Dictionary <int, int>();

            IList <int>[] stacks = { Main, Extra, Side };
            foreach (IList <int> stack in stacks)
            {
                foreach (int id in stack)
                {
                    Card card = Card.Get(id);
                    AddToCards(cards, card);
                    if (!ocg && card.Ot == 1 || !tcg && card.Ot == 2)
                    {
                        return(id);
                    }
                }
            }

            if (ban == null)
            {
                return(0);
            }

            foreach (var pair in cards)
            {
                int max = ban.GetQuantity(pair.Key);
                if (pair.Value > max)
                {
                    return(pair.Key);
                }
            }

            return(0);
        }